|
|
| version 1.1, 2003/10/16 17:59:28 | version 1.7, 2011/02/15 00:51:51 |
|---|---|
| Line 2 | Line 2 |
| #include <windowsx.h> | #include <windowsx.h> |
| #include <commctrl.h> | #include <commctrl.h> |
| #include <prsht.h> | #include <prsht.h> |
| #include "resource.h" | |
| #include "strres.h" | #include "strres.h" |
| #include "resource.h" | |
| #include "np2.h" | #include "np2.h" |
| #include "dosio.h" | |
| #include "joymng.h" | #include "joymng.h" |
| #include "sysmng.h" | #include "sysmng.h" |
| #include "menu.h" | #include "menu.h" |
| #include "dialog.h" | |
| #include "dialogs.h" | |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "sound.h" | #include "sound.h" |
| #include "fmboard.h" | #include "fmboard.h" |
| #include "bit2res.h" | |
| #include "dialog.h" | |
| #include "dialogs.h" | |
| #include "s98.h" | #include "s98.h" |
| #include "dipswbmp.h" | |
| static const char *sndioport[4] = {"0088", "0188", "0288", "0388"}; | static const TCHAR *sndioport[4] = {_T("0088"), _T("0188"), |
| static const char *sndinterrupt[4] = {str_int0, str_int4, str_int5, str_int6}; | _T("0288"), _T("0388")}; |
| static const char *sndromaddr[5] = {"C8000", "CC000", "D0000", "D4000", "N/C"}; | static const TCHAR *sndinterrupt[4] = |
| static const char *sndid[8] = {"0x", "1x", "2x", "3x", "4x", "5x", "6x", "7x"}; | {str_int0, str_int4, str_int5, str_int6}; |
| static const TCHAR *sndromaddr[5] = | |
| {_T("C8000"), _T("CC000"), _T("D0000"), | |
| _T("D4000"), _T("N/C")}; | |
| static const TCHAR *sndid[8] = {_T("0x"), _T("1x"), _T("2x"), _T("3x"), | |
| _T("4x"), _T("5x"), _T("6x"), _T("7x")}; | |
| static const char str_sndopt[] = "Sound board option"; | static const TCHAR str_sndopt[] = _T("Sound board option"); |
| typedef struct { | typedef struct { |
| int res; | UINT16 res; |
| int resstr; | UINT16 resstr; |
| BYTE *value; | UINT8 *value; |
| WORD min; | UINT16 min; |
| WORD max; | UINT16 max; |
| } SLIDER_T; | } SLIDERTBL; |
| static void slidersetvaluestr(HWND hWnd, const SLIDER_T *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, str_d, value); |
| SetDlgItemText(hWnd, item->resstr, work); | SetDlgItemText(hWnd, item->resstr, work); |
| } | } |
| static void slidersetvalue(HWND hWnd, const SLIDER_T *item, BYTE value) { | static void slidersetvalue(HWND hWnd, const SLIDERTBL *item, UINT8 value) { |
| if (value > (BYTE)(item->max)) { | if (value > (UINT8)item->max) { |
| value = (BYTE)(item->max); | value = (UINT8)item->max; |
| } | } |
| else if (value < (BYTE)(item->min)) { | else if (value < (UINT8)item->min) { |
| value = (BYTE)(item->min); | value = (UINT8)item->min; |
| } | } |
| SendDlgItemMessage(hWnd, item->res, TBM_SETPOS, TRUE, value); | SendDlgItemMessage(hWnd, item->res, TBM_SETPOS, TRUE, value); |
| slidersetvaluestr(hWnd, item, value); | slidersetvaluestr(hWnd, item, value); |
| } | } |
| static void sliderinit(HWND hWnd, const SLIDER_T *item) { | static void sliderinit(HWND hWnd, const SLIDERTBL *item) { |
| SendDlgItemMessage(hWnd, item->res, TBM_SETRANGE, TRUE, | SendDlgItemMessage(hWnd, item->res, TBM_SETRANGE, TRUE, |
| MAKELONG(item->min, item->max)); | MAKELONG(item->min, item->max)); |
| slidersetvalue(hWnd, item, *(item->value)); | slidersetvalue(hWnd, item, *(item->value)); |
| } | } |
| static void sliderresetpos(HWND hWnd, const SLIDER_T *item) { | static void sliderresetpos(HWND hWnd, const SLIDERTBL *item) { |
| BYTE value; | UINT8 value; |
| value = (BYTE)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); | value = (UINT8)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); |
| if (value > (BYTE)(item->max)) { | if (value > (UINT8)item->max) { |
| value = (BYTE)(item->max); | value = (UINT8)item->max; |
| } | } |
| else if (value < (BYTE)(item->min)) { | else if (value < (UINT8)item->min) { |
| value = (BYTE)(item->min); | value = (UINT8)item->min; |
| } | } |
| slidersetvaluestr(hWnd, item, value); | slidersetvaluestr(hWnd, item, value); |
| } | } |
| static BYTE sliderrestore(HWND hWnd, const SLIDER_T *item) { | static UINT8 sliderrestore(HWND hWnd, const SLIDERTBL *item) { |
| BYTE value; | UINT8 value; |
| BYTE ret; | UINT8 ret; |
| value = (BYTE)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); | value = (UINT8)SendDlgItemMessage(hWnd, item->res, TBM_GETPOS, 0, 0); |
| if (value > (BYTE)(item->max)) { | if (value > (UINT8)item->max) { |
| value = (BYTE)(item->max); | value = (UINT8)item->max; |
| } | } |
| else if (value < (BYTE)(item->min)) { | else if (value < (UINT8)item->min) { |
| value = (BYTE)(item->min); | value = (UINT8)item->min; |
| } | } |
| ret = (*(item->value)) - value; | ret = (*(item->value)) - value; |
| if (ret) { | if (ret) { |
| Line 94 static BYTE sliderrestore(HWND hWnd, con | Line 100 static BYTE sliderrestore(HWND hWnd, con |
| return(ret); | return(ret); |
| } | } |
| // -------------------------------------------------------- mixer | // ---- mixer |
| static const SLIDER_T sndmixitem[] = { | static const SLIDERTBL sndmixitem[] = { |
| {IDC_VOLFM, IDC_VOLFMSTR, &np2cfg.vol_fm, 0,128}, | {IDC_VOLFM, IDC_VOLFMSTR, &np2cfg.vol_fm, 0,128}, |
| {IDC_VOLPSG, IDC_VOLPSGSTR, &np2cfg.vol_ssg, 0,128}, | {IDC_VOLPSG, IDC_VOLPSGSTR, &np2cfg.vol_ssg, 0,128}, |
| {IDC_VOLADPCM, IDC_VOLADPCMSTR, &np2cfg.vol_adpcm, 0,128}, | {IDC_VOLADPCM, IDC_VOLADPCMSTR, &np2cfg.vol_adpcm, 0,128}, |
| Line 117 static LRESULT CALLBACK SndmixDlgProc(HW | Line 123 static LRESULT CALLBACK SndmixDlgProc(HW |
| return(TRUE); | return(TRUE); |
| case WM_COMMAND: | case WM_COMMAND: |
| switch (LOWORD(wp)) { | switch(LOWORD(wp)) { |
| case IDC_SNDMIXDEF: | case IDC_SNDMIXDEF: |
| for (i=0; i<5; i++) { | for (i=0; i<5; i++) { |
| slidersetvalue(hWnd, &sndmixitem[i], 64); | slidersetvalue(hWnd, &sndmixitem[i], 64); |
| Line 137 static LRESULT CALLBACK SndmixDlgProc(HW | Line 143 static LRESULT CALLBACK SndmixDlgProc(HW |
| break; | break; |
| case WM_NOTIFY: | case WM_NOTIFY: |
| if ((((NMHDR *)lp)->code) == PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { |
| for (i=0; i<5; i++) { | for (i=0; i<5; i++) { |
| if (sliderrestore(hWnd, &sndmixitem[i])) { | if (sliderrestore(hWnd, &sndmixitem[i])) { |
| sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); |
| Line 159 static LRESULT CALLBACK SndmixDlgProc(HW | Line 165 static LRESULT CALLBACK SndmixDlgProc(HW |
| } | } |
| // -------------------------------------------------------- PC-9801-14 | // ---- PC-9801-14 |
| const static SLIDER_T snd14item[] = { | static const SLIDERTBL snd14item[] = { |
| {IDC_VOL14L, IDC_VOL14LSTR, np2cfg.vol14+0, 0,15}, | {IDC_VOL14L, IDC_VOL14LSTR, np2cfg.vol14+0, 0,15}, |
| {IDC_VOL14R, IDC_VOL14RSTR, np2cfg.vol14+1, 0,15}, | {IDC_VOL14R, IDC_VOL14RSTR, np2cfg.vol14+1, 0,15}, |
| {IDC_VOLF2, IDC_VOLF2STR, np2cfg.vol14+2, 0,15}, | {IDC_VOLF2, IDC_VOLF2STR, np2cfg.vol14+2, 0,15}, |
| Line 193 static LRESULT CALLBACK Snd14optDlgProc( | Line 199 static LRESULT CALLBACK Snd14optDlgProc( |
| break; | break; |
| case WM_NOTIFY: | case WM_NOTIFY: |
| if ((((NMHDR *)lp)->code) == PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { |
| for (i=0; i<6; i++) { | for (i=0; i<6; i++) { |
| if (sliderrestore(hWnd, &snd14item[i])) { | if (sliderrestore(hWnd, &snd14item[i])) { |
| sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); |
| Line 207 static LRESULT CALLBACK Snd14optDlgProc( | Line 213 static LRESULT CALLBACK Snd14optDlgProc( |
| return(FALSE); | return(FALSE); |
| } | } |
| // -------------------------------------------------------- 26K, SPB jumper | |
| static void setsnd26iopara(HWND hWnd, BYTE value) { | // ---- 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); | 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)); | GetDlgItemText(hWnd, res, work, NELEMENTS(work)); |
| return((BYTE)((work[1] == '1')?0x10:0x00)); | return((UINT8)((work[1] == '1')?0x10:0x00)); |
| } | } |
| static void setsnd26intpara(HWND hWnd, BYTE value) { | static void setsnd26intpara(HWND hWnd, UINT8 value) { |
| static WPARAM paranum[4] = {(WPARAM)0, (WPARAM)3, (WPARAM)1, (WPARAM)2}; | SendMessage(hWnd, CB_SETCURSEL, |
| (WPARAM)snd26paranum[(value >> 6) & 3], (LPARAM)0); | |
| SendMessage(hWnd, CB_SETCURSEL, paranum[(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]) { | switch(work[3]) { |
| case '0': | case '0': |
| return(0x00); | return(0x00); |
| Line 247 static BYTE getsnd26int(HWND hWnd, WORD | Line 255 static BYTE getsnd26int(HWND hWnd, WORD |
| return(0xc0); | return(0xc0); |
| } | } |
| static void setsnd26rompara(HWND hWnd, BYTE value) { | static void setsnd26rompara(HWND hWnd, UINT8 value) { |
| int para; | int para; |
| Line 258 static void setsnd26rompara(HWND hWnd, B | Line 266 static void setsnd26rompara(HWND hWnd, B |
| SendMessage(hWnd, CB_SETCURSEL, (WPARAM)para, (LPARAM)0); | 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]; | TCHAR work[8]; |
| DWORD adrs; | UINT32 adrs; |
| GetDlgItemText(hWnd, res, work, sizeof(work)); | GetDlgItemText(hWnd, res, work, NELEMENTS(work)); |
| adrs = ((DWORD)milstr_solveHEX(work) - 0xc8000) >> 14; | adrs = ((UINT32)milstr_solveHEX(work) - 0xc8000) >> 14; |
| if (adrs < 4) { | if (adrs < 4) { |
| return((BYTE)adrs); | return((UINT8)adrs); |
| } | } |
| return(4); | return(4); |
| } | } |
| void setsnd26iodip(BYTE *image, int px, int py, int align, BYTE v) { | |
| if (v & 0x10) { | // ---- PC-9801-26 |
| px++; | |
| } | |
| dlgs_setjumpery(image, px, py, align); | |
| } | |
| void setsnd26intdip(BYTE *image, int px, int py, int align, BYTE v) { | static UINT8 snd26 = 0; |
| 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) { | static void set26jmp(HWND hWnd, UINT8 value, UINT8 bit) { |
| v &= 7; | if ((snd26 ^ value) & bit) { |
| if (v >= 4) { | snd26 &= ~bit; |
| v = 4; | snd26 |= value; |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE); | |
| } | } |
| dlgs_setjumpery(image, px + v, py, align); | |
| } | } |
| // -------------------------------------------------------- PC-9801-26 | static void snd26cmdjmp(HWND hWnd) { |
| static BYTE snd26 = 0; | RECT rect1; |
| static SUBCLASSPROC oldidc_snd26jmp = NULL; | RECT rect2; |
| POINT p; | |
| static LRESULT CALLBACK Snd26jmp(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | BOOL redraw; |
| UINT8 b; | |
| PAINTSTRUCT ps; | UINT8 bit; |
| HDC hdc; | |
| HBITMAP hBitmap; | GetWindowRect(GetDlgItem(hWnd, IDC_SND26JMP), &rect1); |
| HDC hMemDC; | GetClientRect(GetDlgItem(hWnd, IDC_SND26JMP), &rect2); |
| BYTE *image; | GetCursorPos(&p); |
| HANDLE hwork; | redraw = FALSE; |
| BITMAPINFO *work; | p.x += rect2.left - rect1.left; |
| BYTE *imgbtm; | p.y += rect2.top - rect1.top; |
| int align; | p.x /= 9; |
| p.y /= 9; | |
| if ((p.y < 1) || (p.y >= 3)) { | |
| return; | |
| } | |
| if ((p.x >= 2) && (p.x < 7)) { | |
| b = (UINT8)(p.x - 2); | |
| if ((snd26 ^ b) & 7) { | |
| snd26 &= ~0x07; | |
| snd26 |= b; | |
| setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), b); | |
| redraw = TRUE; | |
| } | |
| } | |
| else if ((p.x >= 9) && (p.x < 12)) { | |
| b = snd26; | |
| bit = 0x40 << (2 - p.y); | |
| switch(p.x) { | |
| case 9: | |
| b |= bit; | |
| break; | |
| switch(msg) { | case 10: |
| case WM_PAINT: | b ^= bit; |
| hdc = BeginPaint(hWnd, &ps); | |
| if ((hwork = GlobalAlloc(GPTR, bit2res_getsize(&snd26dip))) | |
| == NULL) { | |
| break; | break; |
| } | |
| if ((work = (BITMAPINFO *)GlobalLock(hwork)) == NULL) { | case 11: |
| GlobalFree(hwork); | b &= ~bit; |
| break; | break; |
| } | } |
| bit2res_sethead(work, &snd26dip); | if (snd26 != b) { |
| hBitmap = CreateDIBSection(hdc, work, DIB_RGB_COLORS, | snd26 = b; |
| (void **)&image, NULL, 0); | setsnd26intpara(GetDlgItem(hWnd, IDC_SND26INT), b); |
| bit2res_setdata(image, &snd26dip); | redraw = TRUE; |
| align = ((snd26dip.x + 7) / 2) & ~3; | } |
| imgbtm = image + align * (snd26dip.y - 1); | } |
| setsnd26iodip(imgbtm, 15, 1, align, snd26); | else if ((p.x >= 15) && (p.x < 17)) { |
| setsnd26intdip(imgbtm, 9, 1, align, snd26); | b = (UINT8)((p.x - 15) << 4); |
| setsnd26romdip(imgbtm, 2, 1, align, snd26); | if ((snd26 ^ b) & 0x10) { |
| if ((hMemDC = CreateCompatibleDC(hdc)) != NULL) { | snd26 &= ~0x10; |
| SelectObject(hMemDC, hBitmap); | snd26 |= b; |
| StretchBlt(hdc, 0, 0, snd26dip.x, snd26dip.y, hMemDC, | setsnd26iopara(GetDlgItem(hWnd, IDC_SND26IO), b); |
| 0, 0, snd26dip.x, snd26dip.y, SRCCOPY); | redraw = TRUE; |
| DeleteDC(hMemDC); | } |
| } | |
| DeleteObject(hBitmap); | |
| EndPaint(hWnd, &ps); | |
| GlobalUnlock(hwork); | |
| GlobalFree(hwork); | |
| break; | |
| default: | |
| return(CallWindowProc(oldidc_snd26jmp, hWnd, msg, wp, lp)); | |
| } | } |
| return(FALSE); | if (redraw) { |
| } | |
| static void set26jmp(HWND hWnd, BYTE value, BYTE bit) { | |
| if ((snd26 ^ value) & bit) { | |
| snd26 &= ~bit; | |
| snd26 |= value; | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE); |
| } | } |
| } | } |
| static LRESULT CALLBACK Snd26optDlgProc(HWND hWnd, UINT msg, | static LRESULT CALLBACK Snd26optDlgProc(HWND hWnd, UINT msg, |
| WPARAM wp, LPARAM lp) { | WPARAM wp, LPARAM lp) { |
| BYTE b, bit; | |
| RECT rect1; | HWND sub; |
| RECT rect2; | |
| POINT p; | |
| switch(msg) { | switch(msg) { |
| case WM_INITDIALOG: | case WM_INITDIALOG: |
| Line 373 static LRESULT CALLBACK Snd26optDlgProc( | Line 373 static LRESULT CALLBACK Snd26optDlgProc( |
| setsnd26intpara(GetDlgItem(hWnd, IDC_SND26INT), snd26); | setsnd26intpara(GetDlgItem(hWnd, IDC_SND26INT), snd26); |
| SETLISTSTR(hWnd, IDC_SND26ROM, sndromaddr); | SETLISTSTR(hWnd, IDC_SND26ROM, sndromaddr); |
| setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), snd26); | setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), snd26); |
| oldidc_snd26jmp = (SUBCLASSPROC)GetWindowLong(GetDlgItem(hWnd, | sub = GetDlgItem(hWnd, IDC_SND26JMP); |
| IDC_SND26JMP), GWL_WNDPROC); | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + |
| SetWindowLong(GetDlgItem(hWnd, IDC_SND26JMP), GWL_WNDPROC, | (GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK))); |
| (LONG)Snd26jmp); | |
| return(TRUE); | return(TRUE); |
| case WM_COMMAND: | case WM_COMMAND: |
| Line 384 static LRESULT CALLBACK Snd26optDlgProc( | Line 383 static LRESULT CALLBACK Snd26optDlgProc( |
| case IDC_SND26IO: | case IDC_SND26IO: |
| set26jmp(hWnd, getsnd26io(hWnd, IDC_SND26IO), 0x10); | set26jmp(hWnd, getsnd26io(hWnd, IDC_SND26IO), 0x10); |
| break; | break; |
| case IDC_SND26INT: | case IDC_SND26INT: |
| set26jmp(hWnd, getsnd26int(hWnd, IDC_SND26INT), 0xc0); | set26jmp(hWnd, getsnd26int(hWnd, IDC_SND26INT), 0xc0); |
| break; | break; |
| case IDC_SND26ROM: | case IDC_SND26ROM: |
| set26jmp(hWnd, getsnd26rom(hWnd, IDC_SND26ROM), 0x07); | set26jmp(hWnd, getsnd26rom(hWnd, IDC_SND26ROM), 0x07); |
| break; | break; |
| case IDC_SND26DEF: | case IDC_SND26DEF: |
| snd26 = 0xd1; | snd26 = 0xd1; |
| setsnd26iopara(GetDlgItem(hWnd, IDC_SND26IO), snd26); | setsnd26iopara(GetDlgItem(hWnd, IDC_SND26IO), snd26); |
| Line 397 static LRESULT CALLBACK Snd26optDlgProc( | Line 399 static LRESULT CALLBACK Snd26optDlgProc( |
| setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), snd26); | setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), snd26); |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), NULL, TRUE); |
| break; | break; |
| case IDC_SND26JMP: | case IDC_SND26JMP: |
| GetWindowRect(GetDlgItem(hWnd, IDC_SND26JMP), &rect1); | snd26cmdjmp(hWnd); |
| GetClientRect(GetDlgItem(hWnd, IDC_SND26JMP), &rect2); | |
| GetCursorPos(&p); | |
| p.x += rect2.left - rect1.left; | |
| p.y += rect2.top - rect1.top; | |
| p.x /= 9; | |
| p.y /= 9; | |
| if ((p.y < 1) || (p.y >= 3)) { | |
| break; | |
| } | |
| if ((p.x >= 2) && (p.x < 7)) { | |
| b = (BYTE)(p.x - 2); | |
| if ((snd26 ^ b) & 7) { | |
| snd26 &= ~0x07; | |
| snd26 |= b; | |
| setsnd26rompara(GetDlgItem(hWnd, IDC_SND26ROM), | |
| b); | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), | |
| NULL, TRUE); | |
| } | |
| } | |
| else if ((p.x >= 9) && (p.x < 12)) { | |
| b = snd26; | |
| bit = 0x40 << (2 - p.y); | |
| switch(p.x) { | |
| case 9: | |
| b |= bit; | |
| break; | |
| case 10: | |
| b ^= bit; | |
| break; | |
| case 11: | |
| b &= ~bit; | |
| break; | |
| } | |
| if (snd26 != b) { | |
| snd26 = b; | |
| setsnd26intpara(GetDlgItem(hWnd, IDC_SND26INT), | |
| b); | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), | |
| NULL, TRUE); | |
| } | |
| } | |
| else if ((p.x >= 15) && (p.x < 17)) { | |
| b = (BYTE)((p.x - 15) << 4); | |
| if ((snd26 ^ b) & 0x10) { | |
| snd26 &= ~0x10; | |
| snd26 |= b; | |
| setsnd26iopara(GetDlgItem(hWnd, IDC_SND26IO), b); | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND26JMP), | |
| NULL, TRUE); | |
| } | |
| } | |
| break; | break; |
| } | } |
| break; | break; |
| case WM_NOTIFY: | case WM_NOTIFY: |
| if ((((NMHDR *)lp)->code) == PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { |
| if (np2cfg.snd26opt != snd26) { | if (np2cfg.snd26opt != snd26) { |
| np2cfg.snd26opt = snd26; | np2cfg.snd26opt = snd26; |
| sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); |
| Line 464 static LRESULT CALLBACK Snd26optDlgProc( | Line 415 static LRESULT CALLBACK Snd26optDlgProc( |
| return(TRUE); | return(TRUE); |
| } | } |
| break; | break; |
| case WM_DRAWITEM: | |
| if (LOWORD(wp) == IDC_SND26JMP) { | |
| dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | |
| dipswbmp_getsnd26(snd26)); | |
| } | |
| return(FALSE); | |
| } | } |
| return(FALSE); | return(FALSE); |
| } | } |
| // ------------------------------------------------------ PC-9801-86 | |
| static BYTE snd86 = 0; | |
| static SUBCLASSPROC oldidc_snd86dip = NULL; | |
| static LRESULT CALLBACK snd86jmp(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | // ---- PC-9801-86 |
| PAINTSTRUCT ps; | static UINT8 snd86 = 0; |
| HDC hdc; | |
| HBITMAP hBitmap; | |
| HDC hMemDC; | |
| BYTE *image; | |
| HANDLE hwork; | |
| BITMAPINFO *work; | |
| BYTE *imgbtm; | |
| int align; | |
| int i; | |
| int x, y, yl; | |
| switch(msg) { | static const UINT snd86paranum[4] = {0, 1, 3, 2}; |
| case WM_PAINT: | |
| hdc = BeginPaint(hWnd, &ps); | |
| if ((hwork = GlobalAlloc(GPTR, bit2res_getsize(&snd86dip))) | |
| == NULL) { | |
| break; | |
| } | |
| if ((work = (BITMAPINFO *)GlobalLock(hwork)) == NULL) { | |
| GlobalFree(hwork); | |
| break; | |
| } | |
| bit2res_sethead(work, &snd86dip); | |
| hBitmap = CreateDIBSection(hdc, work, 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); | |
| } | |
| } | |
| if ((hMemDC = CreateCompatibleDC(hdc)) != NULL) { | |
| SelectObject(hMemDC, hBitmap); | |
| StretchBlt(hdc, 0, 0, snd86dip.x, snd86dip.y, hMemDC, | |
| 0, 0, snd86dip.x, snd86dip.y, SRCCOPY); | |
| DeleteDC(hMemDC); | |
| } | |
| DeleteObject(hBitmap); | |
| EndPaint(hWnd, &ps); | |
| GlobalUnlock(hwork); | |
| GlobalFree(hwork); | |
| break; | |
| default: | |
| return(CallWindowProc(oldidc_snd86dip, hWnd, msg, wp, lp)); | |
| } | |
| return(FALSE); | |
| } | |
| static void setsnd86iopara(HWND hWnd, BYTE value) { | static void setsnd86iopara(HWND hWnd, UINT8 value) { |
| SendMessage(hWnd, CB_SETCURSEL, (WPARAM)((~value) & 1), (LPARAM)0); | 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)); | GetDlgItemText(hWnd, res, work, NELEMENTS(work)); |
| return((BYTE)((work[1] == '1')?0x01:0x00)); | return((UINT8)((work[1] == '1')?0x01:0x00)); |
| } | } |
| static void setsnd86intpara(HWND hWnd, BYTE value) { | static void setsnd86intpara(HWND hWnd, UINT8 value) { |
| static WPARAM paranum[4] = {(WPARAM)0, (WPARAM)1, (WPARAM)3, (WPARAM)2}; | SendMessage(hWnd, CB_SETCURSEL, |
| (WPARAM)snd86paranum[(value >> 2) & 3], (LPARAM)0); | |
| SendMessage(hWnd, CB_SETCURSEL, paranum[(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]) { | switch(work[3]) { |
| case '0': | case '0': |
| return(0x00); | return(0x00); |
| case '4': | case '4': |
| return(0x04); | return(0x04); |
| case '6': | case '6': |
| return(0x08); | return(0x08); |
| } | } |
| return(0x0c); | 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); | 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); | 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) { | if ((snd86 ^ value) & bit) { |
| snd86 &= ~bit; | snd86 &= ~bit; |
| Line 587 static void set86jmp(HWND hWnd, BYTE val | Line 493 static void set86jmp(HWND hWnd, BYTE val |
| } | } |
| } | } |
| static LRESULT CALLBACK Snd86optDlgProc(HWND hWnd, UINT msg, | static void snd86cmddipsw(HWND hWnd) { |
| WPARAM wp, LPARAM lp) { | |
| RECT rect1; | RECT rect1; |
| RECT rect2; | RECT rect2; |
| POINT p; | POINT p; |
| GetWindowRect(GetDlgItem(hWnd, IDC_SND86DIP), &rect1); | |
| GetClientRect(GetDlgItem(hWnd, IDC_SND86DIP), &rect2); | |
| GetCursorPos(&p); | |
| p.x += rect2.left - rect1.left; | |
| p.y += rect2.top - rect1.top; | |
| p.x /= 8; | |
| p.y /= 8; | |
| if ((p.x < 2) || (p.x >= 10) || | |
| (p.y < 1) || (p.y >= 3)) { | |
| return; | |
| } | |
| p.x -= 2; | |
| snd86 ^= (1 << p.x); | |
| switch(p.x) { | |
| case 0: | |
| setsnd86iopara(GetDlgItem(hWnd, IDC_SND86IO), snd86); | |
| break; | |
| case 1: | |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), snd86 & 2); | |
| break; | |
| case 2: | |
| case 3: | |
| setsnd86intpara(GetDlgItem(hWnd, IDC_SND86INTA), snd86); | |
| break; | |
| case 4: | |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86INT), snd86 & 0x10); | |
| break; | |
| case 5: | |
| case 6: | |
| case 7: | |
| setsnd86idpara(GetDlgItem(hWnd, IDC_SND86ID), snd86); | |
| break; | |
| } | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); | |
| } | |
| static LRESULT CALLBACK Snd86optDlgProc(HWND hWnd, UINT msg, | |
| WPARAM wp, LPARAM lp) { | |
| HWND sub; | |
| switch(msg) { | switch(msg) { |
| case WM_INITDIALOG: | case WM_INITDIALOG: |
| snd86 = np2cfg.snd86opt; | snd86 = np2cfg.snd86opt; |
| Line 605 static LRESULT CALLBACK Snd86optDlgProc( | Line 555 static LRESULT CALLBACK Snd86optDlgProc( |
| SETLISTSTR(hWnd, IDC_SND86ID, sndid); | SETLISTSTR(hWnd, IDC_SND86ID, sndid); |
| setsnd86idpara(GetDlgItem(hWnd, IDC_SND86ID), snd86); | setsnd86idpara(GetDlgItem(hWnd, IDC_SND86ID), snd86); |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), snd86 & 2); | Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), snd86 & 2); |
| oldidc_snd86dip = (SUBCLASSPROC)GetWindowLong(GetDlgItem(hWnd, | |
| IDC_SND86DIP), GWL_WNDPROC); | sub = GetDlgItem(hWnd, IDC_SND86DIP); |
| SetWindowLong(GetDlgItem(hWnd, IDC_SND86DIP), GWL_WNDPROC, | SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + |
| (LONG)snd86jmp); | (GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK))); |
| return(TRUE); | return(TRUE); |
| case WM_COMMAND: | case WM_COMMAND: |
| Line 634 static LRESULT CALLBACK Snd86optDlgProc( | Line 584 static LRESULT CALLBACK Snd86optDlgProc( |
| set86jmp(hWnd, | set86jmp(hWnd, |
| getsnd86id(GetDlgItem(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); | setsnd86iopara(GetDlgItem(hWnd, IDC_SND86IO), snd86); |
| Line 643 static LRESULT CALLBACK Snd86optDlgProc( | Line 594 static LRESULT CALLBACK Snd86optDlgProc( |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), TRUE); | Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), TRUE); |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); |
| break; | break; |
| case IDC_SND86DIP: | case IDC_SND86DIP: |
| GetWindowRect(GetDlgItem(hWnd, IDC_SND86DIP), &rect1); | snd86cmddipsw(hWnd); |
| GetClientRect(GetDlgItem(hWnd, IDC_SND86DIP), &rect2); | |
| GetCursorPos(&p); | |
| p.x += rect2.left - rect1.left; | |
| p.y += rect2.top - rect1.top; | |
| p.x /= 8; | |
| p.y /= 8; | |
| if ((p.x < 2) || (p.x >= 10) || | |
| (p.y < 1) || (p.y >= 3)) { | |
| break; | |
| } | |
| p.x -= 2; | |
| snd86 ^= (1 << p.x); | |
| switch(p.x) { | |
| case 0: | |
| setsnd86iopara(GetDlgItem(hWnd, IDC_SND86IO), | |
| snd86); | |
| break; | |
| case 1: | |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86ROM), | |
| snd86 & 2); | |
| break; | |
| case 2: | |
| case 3: | |
| setsnd86intpara(GetDlgItem(hWnd, IDC_SND86INTA), | |
| snd86); | |
| break; | |
| case 4: | |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SND86INT), | |
| snd86 & 0x10); | |
| break; | |
| case 5: | |
| case 6: | |
| case 7: | |
| setsnd86idpara(GetDlgItem(hWnd, IDC_SND86ID), | |
| snd86); | |
| break; | |
| } | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), | |
| NULL, TRUE); | |
| break; | break; |
| } | } |
| break; | break; |
| case WM_NOTIFY: | case WM_NOTIFY: |
| if ((((NMHDR *)lp)->code) == PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { |
| if (np2cfg.snd86opt != snd86) { | if (np2cfg.snd86opt != snd86) { |
| np2cfg.snd86opt = snd86; | np2cfg.snd86opt = snd86; |
| sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); |
| Line 697 static LRESULT CALLBACK Snd86optDlgProc( | Line 610 static LRESULT CALLBACK Snd86optDlgProc( |
| return(TRUE); | return(TRUE); |
| } | } |
| break; | break; |
| case WM_DRAWITEM: | |
| if (LOWORD(wp) == IDC_SND86DIP) { | |
| dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | |
| dipswbmp_getsnd86(snd86)); | |
| } | |
| return(FALSE); | |
| } | } |
| return(FALSE); | return(FALSE); |
| } | } |
| // ------------------------------------------------------ Speak board | |
| static BYTE spb = 0; | // ---- Speak board |
| static BYTE spbvrc = 0; | |
| static SUBCLASSPROC oldidc_spbjmp = NULL; | |
| static LRESULT CALLBACK spbjmp(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) { | |
| PAINTSTRUCT ps; | |
| HDC hdc; | |
| HBITMAP hBitmap; | |
| HDC hMemDC; | |
| BYTE *image; | |
| HANDLE hwork; | |
| BITMAPINFO *work; | |
| BYTE *imgbtm; | |
| int align; | |
| switch(msg) { | static UINT8 spb = 0; |
| case WM_PAINT: | static UINT8 spbvrc = 0; |
| hdc = BeginPaint(hWnd, &ps); | |
| if ((hwork = GlobalAlloc(GPTR, bit2res_getsize(&spbdip))) | |
| == NULL) { | static void setspbVRch(HWND hWnd) { |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SPBVRL), spbvrc & 1); | |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SPBVRR), spbvrc & 2); | |
| } | |
| 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); | |
| 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); | |
| sub = GetDlgItem(hWnd, IDC_SPBJMP); | |
| SetWindowLong(sub, GWL_STYLE, SS_OWNERDRAW + | |
| (GetWindowLong(sub, GWL_STYLE) & (~SS_TYPEMASK))); | |
| } | |
| static void spbcmdjmp(HWND hWnd) { | |
| RECT rect1; | |
| RECT rect2; | |
| POINT p; | |
| BOOL redraw; | |
| UINT8 b; | |
| UINT8 bit; | |
| GetWindowRect(GetDlgItem(hWnd, IDC_SPBJMP), &rect1); | |
| GetClientRect(GetDlgItem(hWnd, IDC_SPBJMP), &rect2); | |
| GetCursorPos(&p); | |
| redraw = FALSE; | |
| p.x += rect2.left - rect1.left; | |
| p.y += rect2.top - rect1.top; | |
| p.x /= 9; | |
| p.y /= 9; | |
| if ((p.y < 1) || (p.y >= 3)) { | |
| return; | |
| } | |
| if ((p.x >= 2) && (p.x < 5)) { | |
| b = spb; | |
| bit = 0x40 << (2 - p.y); | |
| switch(p.x) { | |
| case 2: | |
| b |= bit; | |
| break; | break; |
| } | |
| if ((work = (BITMAPINFO *)GlobalLock(hwork)) == NULL) { | case 3: |
| GlobalFree(hwork); | b ^= bit; |
| break; | break; |
| } | |
| bit2res_sethead(work, &spbdip); | case 4: |
| hBitmap = CreateDIBSection(hdc, work, DIB_RGB_COLORS, | b &= ~bit; |
| (void **)&image, NULL, 0); | break; |
| bit2res_setdata(image, &spbdip); | } |
| align = ((spbdip.x + 7) / 2) & ~3; | if (spb != b) { |
| imgbtm = image + align * (spbdip.y - 1); | spb = b; |
| setsnd26intdip(imgbtm, 2, 1, align, spb); | setsnd26intpara(GetDlgItem(hWnd, IDC_SPBINT), b); |
| setsnd26iodip(imgbtm, 10, 1, align, spb); | redraw = TRUE; |
| setsnd26romdip(imgbtm, 14, 1, align, spb); | } |
| if (spb & 0x20) { | } |
| dlgs_setjumpery(imgbtm, 7, 1, align); | else if (p.x == 7) { |
| } | spb ^= 0x20; |
| dlgs_setjumperx(imgbtm, ((spbvrc&2)?21:22), 1, align); | redraw = TRUE; |
| dlgs_setjumperx(imgbtm, ((spbvrc&1)?21:22), 2, align); | } |
| if ((hMemDC = CreateCompatibleDC(hdc)) != NULL) { | else if ((p.x >= 10) && (p.x < 12)) { |
| SelectObject(hMemDC, hBitmap); | b = (UINT8)((p.x - 10) << 4); |
| StretchBlt(hdc, 0, 0, spbdip.x, spbdip.y, hMemDC, | if ((spb ^ b) & 0x10) { |
| 0, 0, spbdip.x, spbdip.y, SRCCOPY); | spb &= ~0x10; |
| DeleteDC(hMemDC); | spb |= b; |
| } | setsnd26iopara(GetDlgItem(hWnd, IDC_SPBIO), b); |
| DeleteObject(hBitmap); | redraw = TRUE; |
| EndPaint(hWnd, &ps); | } |
| GlobalUnlock(hwork); | } |
| GlobalFree(hwork); | else if ((p.x >= 14) && (p.x < 19)) { |
| break; | b = (UINT8)(p.x - 14); |
| default: | if ((spb ^ b) & 7) { |
| return(CallWindowProc(oldidc_spbjmp, hWnd, msg, wp, lp)); | spb &= ~0x07; |
| spb |= b; | |
| setsnd26rompara(GetDlgItem(hWnd, IDC_SPBROM), b); | |
| redraw = TRUE; | |
| } | |
| } | |
| else if ((p.x >= 21) && (p.x < 24)) { | |
| spbvrc ^= (UINT8)(3 - p.y); | |
| setspbVRch(hWnd); | |
| redraw = TRUE; | |
| } | |
| if (redraw) { | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), NULL, TRUE); | |
| } | } |
| return(FALSE); | |
| } | } |
| static void setspbjmp(HWND hWnd, BYTE value, BYTE bit) { | static void setspbjmp(HWND hWnd, UINT8 value, UINT8 bit) { |
| if ((spb ^ value) & bit) { | if ((spb ^ value) & bit) { |
| spb &= ~bit; | spb &= ~bit; |
| Line 771 static void setspbjmp(HWND hWnd, BYTE va | Line 741 static void setspbjmp(HWND hWnd, BYTE va |
| } | } |
| } | } |
| static void setspbVRch(HWND hWnd) { | static UINT8 getspbVRch(HWND hWnd) { |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SPBVRL), spbvrc & 1); | |
| Button_SetCheck(GetDlgItem(hWnd, IDC_SPBVRR), spbvrc & 2); | |
| } | |
| static BYTE getspbVRch(HWND hWnd) { | |
| BYTE ret = 0; | UINT8 ret; |
| ret = 0; | |
| if (Button_GetCheck(GetDlgItem(hWnd, IDC_SPBVRL))) { | if (Button_GetCheck(GetDlgItem(hWnd, IDC_SPBVRL))) { |
| ret++; | ret++; |
| } | } |
| Line 790 static BYTE getspbVRch(HWND hWnd) { | Line 755 static BYTE getspbVRch(HWND hWnd) { |
| return(ret); | return(ret); |
| } | } |
| static LRESULT CALLBACK SPBoptDlgProc(HWND hWnd, UINT msg, | static LRESULT CALLBACK SPBoptDlgProc(HWND hWnd, UINT msg, |
| WPARAM wp, LPARAM lp) { | WPARAM wp, LPARAM lp) { |
| BYTE b, bit; | UINT8 b; |
| RECT rect1; | |
| RECT rect2; | |
| POINT p; | |
| UINT update; | UINT update; |
| switch(msg) { | switch(msg) { |
| case WM_INITDIALOG: | case WM_INITDIALOG: |
| spb = np2cfg.spbopt; | spbcreate(hWnd); |
| 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); | |
| 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); | |
| oldidc_spbjmp = (SUBCLASSPROC)GetWindowLong(GetDlgItem(hWnd, | |
| IDC_SPBJMP), GWL_WNDPROC); | |
| SetWindowLong(GetDlgItem(hWnd, IDC_SPBJMP), GWL_WNDPROC, | |
| (LONG)spbjmp); | |
| return(TRUE); | return(TRUE); |
| case WM_COMMAND: | case WM_COMMAND: |
| switch (LOWORD(wp)) { | switch(LOWORD(wp)) { |
| case IDC_SPBIO: | case IDC_SPBIO: |
| setspbjmp(hWnd, getsnd26io(hWnd, IDC_SPBIO), 0x10); | setspbjmp(hWnd, getsnd26io(hWnd, IDC_SPBIO), 0x10); |
| break; | break; |
| case IDC_SPBINT: | case IDC_SPBINT: |
| setspbjmp(hWnd, getsnd26int(hWnd, IDC_SPBINT), 0xc0); | setspbjmp(hWnd, getsnd26int(hWnd, IDC_SPBINT), 0xc0); |
| break; | break; |
| case IDC_SPBROM: | case IDC_SPBROM: |
| setspbjmp(hWnd, getsnd26rom(hWnd, IDC_SPBROM), 0x07); | setspbjmp(hWnd, getsnd26rom(hWnd, IDC_SPBROM), 0x07); |
| break; | break; |
| case IDC_SPBDEF: | case IDC_SPBDEF: |
| spb = 0xd1; | spb = 0xd1; |
| setsnd26iopara(GetDlgItem(hWnd, IDC_SPBIO), spb); | setsnd26iopara(GetDlgItem(hWnd, IDC_SPBIO), spb); |
| Line 842 static LRESULT CALLBACK SPBoptDlgProc(HW | Line 788 static LRESULT CALLBACK SPBoptDlgProc(HW |
| setspbVRch(hWnd); | setspbVRch(hWnd); |
| InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), NULL, TRUE); | InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), NULL, TRUE); |
| break; | break; |
| case IDC_SPBVRL: | case IDC_SPBVRL: |
| case IDC_SPBVRR: | case IDC_SPBVRR: |
| b = getspbVRch(hWnd); | b = getspbVRch(hWnd); |
| Line 851 static LRESULT CALLBACK SPBoptDlgProc(HW | Line 798 static LRESULT CALLBACK SPBoptDlgProc(HW |
| NULL, TRUE); | NULL, TRUE); |
| } | } |
| break; | break; |
| case IDC_SPBJMP: | case IDC_SPBJMP: |
| GetWindowRect(GetDlgItem(hWnd, IDC_SPBJMP), &rect1); | spbcmdjmp(hWnd); |
| GetClientRect(GetDlgItem(hWnd, IDC_SPBJMP), &rect2); | |
| GetCursorPos(&p); | |
| p.x += rect2.left - rect1.left; | |
| p.y += rect2.top - rect1.top; | |
| p.x /= 9; | |
| p.y /= 9; | |
| if ((p.y < 1) || (p.y >= 3)) { | |
| break; | |
| } | |
| if ((p.x >= 2) && (p.x < 5)) { | |
| b = spb; | |
| bit = 0x40 << (2 - p.y); | |
| switch(p.x) { | |
| case 2: | |
| b |= bit; | |
| break; | |
| case 3: | |
| b ^= bit; | |
| break; | |
| case 4: | |
| b &= ~bit; | |
| break; | |
| } | |
| if (spb != b) { | |
| spb = b; | |
| setsnd26intpara(GetDlgItem(hWnd, IDC_SPBINT), b); | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), | |
| NULL, TRUE); | |
| } | |
| } | |
| else if (p.x == 7) { | |
| spb ^= 0x20; | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), | |
| NULL, TRUE); | |
| } | |
| else if ((p.x >= 10) && (p.x < 12)) { | |
| b = (BYTE)((p.x - 10) << 4); | |
| if ((spb ^ b) & 0x10) { | |
| spb &= ~0x10; | |
| spb |= b; | |
| setsnd26iopara(GetDlgItem(hWnd, IDC_SPBIO), b); | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), | |
| NULL, TRUE); | |
| } | |
| } | |
| else if ((p.x >= 14) && (p.x < 19)) { | |
| b = (BYTE)(p.x - 14); | |
| if ((spb ^ b) & 7) { | |
| spb &= ~0x07; | |
| spb |= b; | |
| setsnd26rompara(GetDlgItem(hWnd, IDC_SPBROM), b); | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), | |
| NULL, TRUE); | |
| } | |
| } | |
| else if ((p.x >= 21) && (p.x < 24)) { | |
| spbvrc ^= (BYTE)(3 - p.y); | |
| setspbVRch(hWnd); | |
| InvalidateRect(GetDlgItem(hWnd, IDC_SPBJMP), | |
| NULL, TRUE); | |
| } | |
| break; | break; |
| } | } |
| break; | break; |
| case WM_NOTIFY: | case WM_NOTIFY: |
| if ((((NMHDR *)lp)->code) == PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { |
| update = 0; | update = 0; |
| if (np2cfg.spbopt != spb) { | if (np2cfg.spbopt != spb) { |
| np2cfg.spbopt = spb; | np2cfg.spbopt = spb; |
| Line 929 static LRESULT CALLBACK SPBoptDlgProc(HW | Line 816 static LRESULT CALLBACK SPBoptDlgProc(HW |
| np2cfg.spb_vrc = spbvrc; | np2cfg.spb_vrc = spbvrc; |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| } | } |
| b = (BYTE)SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, | b = (UINT8)SendDlgItemMessage(hWnd, IDC_SPBVRLEVEL, |
| TBM_GETPOS, 0, 0); | TBM_GETPOS, 0, 0); |
| if (np2cfg.spb_vrl != b) { | if (np2cfg.spb_vrl != b) { |
| np2cfg.spb_vrl = b; | np2cfg.spb_vrl = b; |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| } | } |
| // FM_setVR(np2cfg.spb_vrc, np2cfg.spb_vrl); | 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) { | if (np2cfg.spb_x != b) { |
| np2cfg.spb_x = b; | np2cfg.spb_x = b; |
| update |= SYS_UPDATECFG; | update |= SYS_UPDATECFG; |
| Line 945 static LRESULT CALLBACK SPBoptDlgProc(HW | Line 833 static LRESULT CALLBACK SPBoptDlgProc(HW |
| return(TRUE); | return(TRUE); |
| } | } |
| break; | break; |
| case WM_DRAWITEM: | |
| if (LOWORD(wp) == IDC_SPBJMP) { | |
| dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | |
| dipswbmp_getsndspb(spb, spbvrc)); | |
| } | |
| return(FALSE); | |
| } | } |
| return(FALSE); | return(FALSE); |
| } | } |
| // ----------------------------------------------------------- JOYPAD | |
| // ver0.28 | // ---- JOYPAD |
| typedef struct { | typedef struct { |
| int res; | UINT16 res; |
| BYTE *ptr; | UINT16 bit; |
| DWORD bit; | UINT8 *ptr; |
| } CHKBTN_RES; | } CHECKTBL; |
| const static CHKBTN_RES pad1opt[13] = { | static const CHECKTBL pad1opt[13] = { |
| {IDC_JOYPAD1, &np2oscfg.JOYPAD1, 0}, | {IDC_JOYPAD1, 0, &np2oscfg.JOYPAD1}, |
| {IDC_PAD1_1A, np2oscfg.JOY1BTN + 0, 0}, | {IDC_PAD1_1A, 0, np2oscfg.JOY1BTN + 0}, |
| {IDC_PAD1_1B, np2oscfg.JOY1BTN + 1, 0}, | {IDC_PAD1_1B, 0, np2oscfg.JOY1BTN + 1}, |
| {IDC_PAD1_1C, np2oscfg.JOY1BTN + 2, 0}, | {IDC_PAD1_1C, 0, np2oscfg.JOY1BTN + 2}, |
| {IDC_PAD1_1D, np2oscfg.JOY1BTN + 3, 0}, | {IDC_PAD1_1D, 0, np2oscfg.JOY1BTN + 3}, |
| {IDC_PAD1_2A, np2oscfg.JOY1BTN + 0, 1}, | {IDC_PAD1_2A, 1, np2oscfg.JOY1BTN + 0}, |
| {IDC_PAD1_2B, np2oscfg.JOY1BTN + 1, 1}, | {IDC_PAD1_2B, 1, np2oscfg.JOY1BTN + 1}, |
| {IDC_PAD1_2C, np2oscfg.JOY1BTN + 2, 1}, | {IDC_PAD1_2C, 1, np2oscfg.JOY1BTN + 2}, |
| {IDC_PAD1_2D, np2oscfg.JOY1BTN + 3, 1}, | {IDC_PAD1_2D, 1, np2oscfg.JOY1BTN + 3}, |
| {IDC_PAD1_RA, np2oscfg.JOY1BTN + 0, 2}, | {IDC_PAD1_RA, 2, np2oscfg.JOY1BTN + 0}, |
| {IDC_PAD1_RB, np2oscfg.JOY1BTN + 1, 2}, | {IDC_PAD1_RB, 2, np2oscfg.JOY1BTN + 1}, |
| {IDC_PAD1_RC, np2oscfg.JOY1BTN + 2, 2}, | {IDC_PAD1_RC, 2, np2oscfg.JOY1BTN + 2}, |
| {IDC_PAD1_RD, np2oscfg.JOY1BTN + 3, 2}}; | {IDC_PAD1_RD, 2, np2oscfg.JOY1BTN + 3}}; |
| static void checkbtnres_load(HWND hWnd, const CHKBTN_RES *item) { | static void checkbtnres_load(HWND hWnd, const CHECKTBL *item) { |
| Button_SetCheck(GetDlgItem(hWnd, item->res), | Button_SetCheck(GetDlgItem(hWnd, item->res), |
| (*(item->ptr)) & (1 << (item->bit))); | (*(item->ptr)) & (1 << (item->bit))); |
| } | } |
| static BYTE checkbtnres_store(HWND hWnd, const CHKBTN_RES *item) { | static UINT8 checkbtnres_store(HWND hWnd, const CHECKTBL *item) { |
| BYTE value; | UINT8 value; |
| BYTE bit; | UINT8 bit; |
| BYTE ret; | UINT8 ret; |
| bit = 1 << (item->bit); | bit = 1 << (item->bit); |
| value = ((Button_GetCheck(GetDlgItem(hWnd, item->res)))?0xff:0) & bit; | value = ((Button_GetCheck(GetDlgItem(hWnd, item->res)))?0xff:0) & bit; |
| Line 994 static BYTE checkbtnres_store(HWND hWnd, | Line 890 static BYTE checkbtnres_store(HWND hWnd, |
| return(ret); | return(ret); |
| } | } |
| static LRESULT CALLBACK PAD1optDlgProc(HWND hWnd, UINT msg, | static LRESULT CALLBACK PAD1optDlgProc(HWND hWnd, UINT msg, |
| WPARAM wp, LPARAM lp) { | WPARAM wp, LPARAM lp) { |
| int i; | int i; |
| BYTE renewal; | UINT8 renewal; |
| switch(msg) { | switch(msg) { |
| case WM_INITDIALOG: | case WM_INITDIALOG: |
| Line 1012 static LRESULT CALLBACK PAD1optDlgProc(H | Line 907 static LRESULT CALLBACK PAD1optDlgProc(H |
| return(TRUE); | return(TRUE); |
| case WM_NOTIFY: | case WM_NOTIFY: |
| if ((((NMHDR *)lp)->code) == PSN_APPLY) { | if ((((NMHDR *)lp)->code) == (UINT)PSN_APPLY) { |
| renewal = 0; | renewal = 0; |
| for (i=0; i<13; i++) { | for (i=0; i<13; i++) { |
| renewal |= checkbtnres_store(hWnd, pad1opt + i); | renewal |= checkbtnres_store(hWnd, pad1opt + i); |
| Line 1029 static LRESULT CALLBACK PAD1optDlgProc(H | Line 924 static LRESULT CALLBACK PAD1optDlgProc(H |
| } | } |
| // -------------------------------------------------------------------------- | // ---- |
| void dialog_sndopt(HWND hWnd) { | void dialog_sndopt(HWND hWnd) { |
| Line 1038 void dialog_sndopt(HWND hWnd) { | Line 933 void dialog_sndopt(HWND hWnd) { |
| PROPSHEETHEADER psh; | PROPSHEETHEADER psh; |
| HPROPSHEETPAGE hpsp[6]; // ver0.29 | HPROPSHEETPAGE hpsp[6]; // ver0.29 |
| hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | #if defined(_WIN64) |
| hinst = reinterpret_cast<HINSTANCE>(::GetWindowLongPtr(hWnd, GWLP_HINSTANCE)); | |
| #else | |
| hinst = reinterpret_cast<HINSTANCE>(::GetWindowLong(hWnd, GWL_HINSTANCE)); | |
| #endif | |
| ZeroMemory(&psp, sizeof(psp)); | ZeroMemory(&psp, sizeof(psp)); |
| psp.dwSize = sizeof(PROPSHEETPAGE); | psp.dwSize = sizeof(PROPSHEETPAGE); |
| Line 1074 void dialog_sndopt(HWND hWnd) { | Line 973 void dialog_sndopt(HWND hWnd) { |
| psh.dwFlags = PSH_NOAPPLYNOW; | psh.dwFlags = PSH_NOAPPLYNOW; |
| psh.hwndParent = hWnd; | psh.hwndParent = hWnd; |
| psh.hInstance = hinst; | psh.hInstance = hinst; |
| psh.nPages = 6; // ver0.29 | psh.nPages = 6; |
| psh.phpage = hpsp; | psh.phpage = hpsp; |
| psh.pszCaption = str_sndopt; | psh.pszCaption = str_sndopt; |
| PropertySheet(&psh); | PropertySheet(&psh); |
| InvalidateRect(hWndMain, NULL, TRUE); | InvalidateRect(hWnd, NULL, TRUE); |
| } | } |
| // ---- | // ---- |
| static const char s98ui_file[] = "NP2_%04d.S98"; | #if defined(SUPPORT_S98) |
| static const char s98ui_title[] = "Save as S98 log"; | static const TCHAR s98ui_file[] = _T("NP2_%04d.S98"); |
| static const char s98ui_ext[] = "s98"; | static const TCHAR s98ui_title[] = _T("Save as S98 log"); |
| static const char s98ui_filter[] = "S98 log (*.s98)\0*.s98\0"; | 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}; | static const FILESEL s98ui = {s98ui_title, s98ui_ext, s98ui_filter, 1}; |
| void dialog_s98(HWND hWnd) { | void dialog_s98(HWND hWnd) { |
| BOOL check; | BOOL check; |
| const char *p; | TCHAR path[MAX_PATH]; |
| S98_close(); | S98_close(); |
| check = FALSE; | check = FALSE; |
| p = dlgs_selectwritenum(hWnd, &s98ui, s98ui_file, | file_cpyname(path, bmpfilefolder, NELEMENTS(path)); |
| bmpfilefolder, sizeof(bmpfilefolder)); | file_cutname(path); |
| if ((p != NULL) && (S98_open(p) == SUCCESS)) { | 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)); | |
| sysmng_update(SYS_UPDATEOSCFG); | |
| check = TRUE; | check = TRUE; |
| } | } |
| xmenu_sets98logging(check); | xmenu_sets98logging(check); |
| } | } |
| #endif | |
| // ---- | |
| #if defined(SUPPORT_WAVEREC) | |
| static const TCHAR wrui_file[] = _T("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; | |
| TCHAR 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 | |