| version 1.7, 2005/02/07 15:39:27 | version 1.10, 2007/01/08 08:52:22 | 
| Line 2 | Line 2 | 
 | #include        "strres.h" | #include        "strres.h" | 
 | #include        "resource.h" | #include        "resource.h" | 
 | #include        "np2.h" | #include        "np2.h" | 
 |  | #include        "oemtext.h" | 
 | #include        "commng.h" | #include        "commng.h" | 
 | #include        "sysmng.h" | #include        "sysmng.h" | 
 | #include        "dialog.h" | #include        "dialog.h" | 
| Line 20  extern COMMNG cm_mpu98; | Line 21  extern COMMNG cm_mpu98; | 
 | } | } | 
 | #endif | #endif | 
 |  |  | 
| static const char *mpuinterrupt[4] = {str_int0, str_int1, str_int2, str_int5}; | static const TCHAR *mpuinterrupt[4] = { | 
|  | str_int0, str_int1, str_int2, str_int5}; | 
 |  |  | 
 | static  UINT8   mpu = 0; | static  UINT8   mpu = 0; | 
 |  |  | 
| Line 33  static void setmpuiopara(HWND hWnd, UINT | Line 35  static void setmpuiopara(HWND hWnd, UINT | 
 |  |  | 
 | static UINT8 getmpuio(HWND hWnd, UINT16 res) { | static UINT8 getmpuio(HWND hWnd, UINT16 res) { | 
 |  |  | 
| char    work[8]; | TCHAR   work[8]; | 
 |  |  | 
| GetDlgItemText(hWnd, res, work, sizeof(work)); | GetDlgItemText(hWnd, res, work, NELEMENTS(work)); | 
| return((milstr_solveHEX(work) >> 6) & 0xf0); | return((UINT8)((miltchar_solveHEX(work) >> 6) & 0xf0)); | 
 | } | } | 
 |  |  | 
 | static void setmpuintpara(HWND hWnd, UINT16 res, UINT8 value) { | static void setmpuintpara(HWND hWnd, UINT16 res, UINT8 value) { | 
| Line 47  static void setmpuintpara(HWND hWnd, UIN | Line 49  static void setmpuintpara(HWND hWnd, UIN | 
 |  |  | 
 | static UINT8 getmpuint(HWND hWnd, UINT16 res) { | static UINT8 getmpuint(HWND hWnd, UINT16 res) { | 
 |  |  | 
| char    work[8]; | TCHAR   work[8]; | 
| UINT8   ret; | TCHAR   ret; | 
 |  |  | 
| GetDlgItemText(hWnd, res, work, sizeof(work)); | GetDlgItemText(hWnd, res, work, NELEMENTS(work)); | 
 | ret = work[3] - '0'; | ret = work[3] - '0'; | 
| if (ret >= 3) { | if (ret < 0) { | 
|  | ret = 0; | 
|  | } | 
|  | else if (ret >= 3) { | 
 | ret = 3; | ret = 3; | 
 | } | } | 
| return(ret); | return((UINT8)ret); | 
 | } | } | 
 |  |  | 
 | static void setmpujmp(HWND hWnd, UINT8 value, UINT8 bit) { | static void setmpujmp(HWND hWnd, UINT8 value, UINT8 bit) { | 
| Line 73  static void setmpujmp(HWND hWnd, UINT8 v | Line 78  static void setmpujmp(HWND hWnd, UINT8 v | 
 | static void mpucreate(HWND hWnd) { | static void mpucreate(HWND hWnd) { | 
 |  |  | 
 | UINT    i; | UINT    i; | 
| char    buf[8]; | TCHAR   buf[8]; | 
 | HWND    sub; | HWND    sub; | 
 |  |  | 
 | mpu = np2cfg.mpuopt; | mpu = np2cfg.mpuopt; | 
 | for (i=0; i<16; i++) { | for (i=0; i<16; i++) { | 
| wsprintf(buf, str_4X, 0xC0D0 + (i << 10)); | wsprintf(buf, tchar_4X, 0xC0D0 + (i << 10)); | 
 | SendDlgItemMessage(hWnd, IDC_MPUIO, | SendDlgItemMessage(hWnd, IDC_MPUIO, | 
 | CB_INSERTSTRING, (WPARAM)i, (LPARAM)buf); | CB_INSERTSTRING, (WPARAM)i, (LPARAM)buf); | 
 | } | } | 
| Line 104  static void mpucreate(HWND hWnd) { | Line 109  static void mpucreate(HWND hWnd) { | 
 | static void mpuupdate(HWND hWnd) { | static void mpuupdate(HWND hWnd) { | 
 |  |  | 
 | union { | union { | 
| char    mmap[MAXPNAMELEN]; | OEMCHAR mmap[MAXPNAMELEN]; | 
| char    mmdl[64]; | OEMCHAR mmdl[64]; | 
| char    mdef[MAX_PATH]; | OEMCHAR mdef[MAX_PATH]; | 
| char    mdin[MAXPNAMELEN]; | OEMCHAR mdin[MAXPNAMELEN]; | 
 | } s; | } s; | 
 | UINT    update; | UINT    update; | 
 |  |  | 
| Line 116  static void mpuupdate(HWND hWnd) { | Line 121  static void mpuupdate(HWND hWnd) { | 
 | np2cfg.mpuopt = mpu; | np2cfg.mpuopt = mpu; | 
 | update |= SYS_UPDATECFG | SYS_UPDATEMIDI; | update |= SYS_UPDATECFG | SYS_UPDATEMIDI; | 
 | } | } | 
| GetDlgItemText(hWnd, IDC_MPU98MMAP, s.mmap, sizeof(s.mmap)); | GetDlgItemText(hWnd, IDC_MPU98MMAP, s.mmap, NELEMENTS(s.mmap)); | 
 | if (milstr_cmp(np2oscfg.mpu.mout, s.mmap)) { | if (milstr_cmp(np2oscfg.mpu.mout, s.mmap)) { | 
| milstr_ncpy(np2oscfg.mpu.mout, s.mmap, sizeof(np2oscfg.mpu.mout)); | milstr_ncpy(np2oscfg.mpu.mout, s.mmap, NELEMENTS(np2oscfg.mpu.mout)); | 
 | update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI; | update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI; | 
 | } | } | 
| GetDlgItemText(hWnd, IDC_MPU98MDIN, s.mdin, sizeof(s.mdin)); | GetDlgItemText(hWnd, IDC_MPU98MDIN, s.mdin, NELEMENTS(s.mdin)); | 
 | if (milstr_cmp(np2oscfg.mpu.min, s.mdin)) { | if (milstr_cmp(np2oscfg.mpu.min, s.mdin)) { | 
| milstr_ncpy(np2oscfg.mpu.min, s.mdin, sizeof(np2oscfg.mpu.min)); | milstr_ncpy(np2oscfg.mpu.min, s.mdin, NELEMENTS(np2oscfg.mpu.min)); | 
 | update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI; | update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI; | 
 | } | } | 
| GetDlgItemText(hWnd, IDC_MPU98MMDL, s.mmdl, sizeof(s.mmdl)); | GetDlgItemText(hWnd, IDC_MPU98MMDL, s.mmdl, NELEMENTS(s.mmdl)); | 
 | if (milstr_cmp(np2oscfg.mpu.mdl, s.mmdl)) { | if (milstr_cmp(np2oscfg.mpu.mdl, s.mmdl)) { | 
| milstr_ncpy(np2oscfg.mpu.mdl, s.mmdl, sizeof(np2oscfg.mpu.mdl)); | milstr_ncpy(np2oscfg.mpu.mdl, s.mmdl, NELEMENTS(np2oscfg.mpu.mdl)); | 
 | update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI; | update |= SYS_UPDATEOSCFG | SYS_UPDATEMIDI; | 
 | } | } | 
 |  |  | 
| Line 136  static void mpuupdate(HWND hWnd) { | Line 141  static void mpuupdate(HWND hWnd) { | 
 | if (cm_mpu98) { | if (cm_mpu98) { | 
 | cm_mpu98->msg(cm_mpu98, COMMSG_MIMPIDEFEN, np2oscfg.mpu.def_en); | cm_mpu98->msg(cm_mpu98, COMMSG_MIMPIDEFEN, np2oscfg.mpu.def_en); | 
 | } | } | 
| GetDlgItemText(hWnd, IDC_MPU98DEFF, s.mdef, sizeof(s.mdef)); | GetDlgItemText(hWnd, IDC_MPU98DEFF, s.mdef, NELEMENTS(s.mdef)); | 
 | if (milstr_cmp(np2oscfg.mpu.def, s.mdef)) { | if (milstr_cmp(np2oscfg.mpu.def, s.mdef)) { | 
| milstr_ncpy(np2oscfg.mpu.def, s.mdef, sizeof(np2oscfg.mpu.def)); | milstr_ncpy(np2oscfg.mpu.def, s.mdef, NELEMENTS(np2oscfg.mpu.def)); | 
 | if (cm_mpu98) { | if (cm_mpu98) { | 
 | cm_mpu98->msg(cm_mpu98, COMMSG_MIMPIDEFFILE, (long)s.mdef); | cm_mpu98->msg(cm_mpu98, COMMSG_MIMPIDEFFILE, (long)s.mdef); | 
 | } | } |