| version 1.9, 2003/11/04 19:23:03 | version 1.14, 2004/03/31 14:02:51 | 
| Line 12 | Line 12 | 
 | #include        "np2class.h" | #include        "np2class.h" | 
 | #include        "dialog.h" | #include        "dialog.h" | 
 | #include        "dialogs.h" | #include        "dialogs.h" | 
 | #include        "bit2res.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        "s98.h" | #include        "s98.h" | 
 |  | #include        "dipswbmp.h" | 
 |  |  | 
 |  |  | 
 | static const char *sndioport[4] = {"0088", "0188", "0288", "0388"}; | static const char *sndioport[4] = {"0088", "0188", "0288", "0388"}; | 
| Line 275  static BYTE getsnd26rom(HWND hWnd, WORD | Line 275  static BYTE getsnd26rom(HWND hWnd, WORD | 
 | return(4); | 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 | // ---- PC-9801-26 | 
 |  |  | 
| Line 378  static void snd26cmdjmp(HWND hWnd) { | Line 355  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, | static LRESULT CALLBACK Snd26optDlgProc(HWND hWnd, UINT msg, | 
 | WPARAM wp, LPARAM lp) { | WPARAM wp, LPARAM lp) { | 
 |  |  | 
| Line 467  static LRESULT CALLBACK Snd26optDlgProc( | Line 414  static LRESULT CALLBACK Snd26optDlgProc( | 
 |  |  | 
 | case WM_DRAWITEM: | case WM_DRAWITEM: | 
 | if (LOWORD(wp) == IDC_SND26JMP) { | if (LOWORD(wp) == IDC_SND26JMP) { | 
| snd26drawjmp(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC); | dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | 
|  | dipswbmp_getsnd26(snd26)); | 
 | } | } | 
 | return(FALSE); | return(FALSE); | 
 | } | } | 
| Line 482  static BYTE snd86 = 0; | Line 430  static BYTE snd86 = 0; | 
 | static const UINT snd86paranum[4] = {0, 1, 3, 2}; | static const UINT snd86paranum[4] = {0, 1, 3, 2}; | 
 |  |  | 
 |  |  | 
 |  |  | 
 | static void setsnd86iopara(HWND hWnd, BYTE value) { | static void setsnd86iopara(HWND hWnd, BYTE value) { | 
 |  |  | 
 | SendMessage(hWnd, CB_SETCURSEL, (WPARAM)((~value) & 1), (LPARAM)0); | SendMessage(hWnd, CB_SETCURSEL, (WPARAM)((~value) & 1), (LPARAM)0); | 
| Line 588  static void snd86cmddipsw(HWND hWnd) { | Line 535  static void snd86cmddipsw(HWND hWnd) { | 
 | InvalidateRect(GetDlgItem(hWnd, IDC_SND86DIP), NULL, TRUE); | 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, | static LRESULT CALLBACK Snd86optDlgProc(HWND hWnd, UINT msg, | 
 | WPARAM wp, LPARAM lp) { | WPARAM wp, LPARAM lp) { | 
 |  |  | 
| Line 698  static LRESULT CALLBACK Snd86optDlgProc( | Line 609  static LRESULT CALLBACK Snd86optDlgProc( | 
 |  |  | 
 | case WM_DRAWITEM: | case WM_DRAWITEM: | 
 | if (LOWORD(wp) == IDC_SND86DIP) { | if (LOWORD(wp) == IDC_SND86DIP) { | 
| snd86drawdipsw(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC); | dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | 
|  | dipswbmp_getsnd86(snd86)); | 
 | } | } | 
 | return(FALSE); | return(FALSE); | 
 | } | } | 
| Line 816  static void spbcmdjmp(HWND hWnd) { | Line 728  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, BYTE value, BYTE bit) { | 
 |  |  | 
 | if ((spb ^ value) & bit) { | if ((spb ^ value) & bit) { | 
| Line 954  static LRESULT CALLBACK SPBoptDlgProc(HW | Line 831  static LRESULT CALLBACK SPBoptDlgProc(HW | 
 |  |  | 
 | case WM_DRAWITEM: | case WM_DRAWITEM: | 
 | if (LOWORD(wp) == IDC_SPBJMP) { | if (LOWORD(wp) == IDC_SPBJMP) { | 
| spbdrawjumper(hWnd, ((LPDRAWITEMSTRUCT)lp)->hDC); | dlgs_drawbmp(((LPDRAWITEMSTRUCT)lp)->hDC, | 
|  | dipswbmp_getsndspb(spb, spbvrc)); | 
 | } | } | 
 | return(FALSE); | return(FALSE); | 
 | } | } | 
| Line 1030  static LRESULT CALLBACK PAD1optDlgProc(H | Line 908  static LRESULT CALLBACK PAD1optDlgProc(H | 
 | renewal |= checkbtnres_store(hWnd, pad1opt + i); | renewal |= checkbtnres_store(hWnd, pad1opt + i); | 
 | } | } | 
 | if (renewal) { | if (renewal) { | 
| joy_init(); | joymng_initialize(); | 
 | sysmng_update(SYS_UPDATECFG); | sysmng_update(SYS_UPDATECFG); | 
 | } | } | 
 | return(TRUE); | return(TRUE); | 
| Line 1048  void dialog_sndopt(HWND hWnd) { | Line 926  void dialog_sndopt(HWND hWnd) { | 
 | HINSTANCE               hinst; | HINSTANCE               hinst; | 
 | PROPSHEETPAGE   psp; | PROPSHEETPAGE   psp; | 
 | PROPSHEETHEADER psh; | PROPSHEETHEADER psh; | 
| HPROPSHEETPAGE  hpsp[6];                                                                                // ver0.29 | HPROPSHEETPAGE  hpsp[6]; | 
 |  |  | 
 | hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | hinst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE); | 
 |  |  | 
| Line 1098  void dialog_sndopt(HWND hWnd) { | Line 976  void dialog_sndopt(HWND hWnd) { | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
 |  | #if defined(SUPPORT_S98) | 
 | static const char s98ui_file[] = "NP2_%04d.S98"; | static const char s98ui_file[] = "NP2_%04d.S98"; | 
 | static const char s98ui_title[] = "Save as S98 log"; | static const char s98ui_title[] = "Save as S98 log"; | 
 | static const char s98ui_ext[] = "s98"; | static const char s98ui_ext[] = "s98"; | 
| Line 1122  void dialog_s98(HWND hWnd) { | Line 1001  void dialog_s98(HWND hWnd) { | 
 | } | } | 
 | xmenu_sets98logging(check); | xmenu_sets98logging(check); | 
 | } | } | 
 |  | #endif | 
 |  |  | 
 |  |  | 
 |  | // ---- | 
 |  |  | 
 |  | #if defined(SUPPORT_WAVEREC) | 
 |  | static const char wrui_file[] = "NP2_%04d.WAV"; | 
 |  | static const char wrui_title[] = "Save as Sound"; | 
 |  | static const char wrui_ext[] = "WAV"; | 
 |  | static const char wrui_filter[] = "Wave files (*.wav)\0*.wav\0"; | 
 |  | static const FILESEL wrui = {wrui_title, wrui_ext, wrui_filter, 1}; | 
 |  |  | 
 |  | void dialog_waverec(HWND hWnd) { | 
 |  |  | 
 |  | BYTE    check; | 
 |  | char    path[MAX_PATH]; | 
 |  |  | 
 |  | check = FALSE; | 
 |  | sound_recstop(); | 
 |  | file_cpyname(path, bmpfilefolder, sizeof(path)); | 
 |  | file_cutname(path); | 
 |  | file_catname(path, wrui_file, sizeof(path)); | 
 |  | if ((dlgs_selectwritenum(hWnd, &wrui, path, sizeof(path))) && | 
 |  | (sound_recstart(path) == SUCCESS)) { | 
 |  | file_cpyname(bmpfilefolder, path, sizeof(bmpfilefolder)); | 
 |  | sysmng_update(SYS_UPDATEOSCFG); | 
 |  | check = TRUE; | 
 |  | } | 
 |  | xmenu_setwaverec(check); | 
 |  | } | 
 |  | #endif | 
 |  |  |