|
|
| version 1.6, 2005/02/07 14:46:14 | version 1.11, 2007/12/28 20:36:40 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "strres.h" | #include "strres.h" |
| #include "np2.h" | #include "np2.h" |
| #include "oemtext.h" | |
| #include "scrnmng.h" | #include "scrnmng.h" |
| #include "sysmng.h" | #include "sysmng.h" |
| #include "sstp.h" | #include "sstp.h" |
| Line 12 | Line 13 |
| #include "np2info.h" | #include "np2info.h" |
| static char cr[] = "\\n"; | static const OEMCHAR cr[] = OEMTEXT("\\n"); |
| // ---- np2info extend | // ---- np2info extend |
| static const char str_jwinclr[] = | static const OEMCHAR str_jwinclr[] = |
| "256色\0ハイカラー\0フルカラー\0トゥルーカラー"; | OEMTEXT("256色\0ハイカラー\0フルカラー\0トゥルーカラー"); |
| static const char str_jwinmode[] = | static const OEMCHAR str_jwinmode[] = |
| " (窓モード)\0 (フルスクリーン)"; | OEMTEXT(" (窓モード)\0 (フルスクリーン)"); |
| static void info_progtitle(char *str, int maxlen, NP2INFOEX *ex) { | static void info_progtitle(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) { |
| milstr_ncpy(str, np2oscfg.titles, maxlen); | milstr_ncpy(str, np2oscfg.titles, maxlen); |
| } | } |
| static void info_jsound(char *str, int maxlen, NP2INFOEX *ex) { | static void info_jsound(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) { |
| const char *p; | const OEMCHAR *p; |
| switch(usesound) { | switch(usesound) { |
| case 0x01: | case 0x01: |
| p = "14ボード"; | p = OEMTEXT("14ボード"); |
| break; | break; |
| case 0x02: | case 0x02: |
| p = "26音源"; | p = OEMTEXT("26音源"); |
| break; | break; |
| case 0x04: | case 0x04: |
| p = "86音源"; | p = OEMTEXT("86音源"); |
| break; | break; |
| case 0x06: | case 0x06: |
| p = "2枚刺し"; | p = OEMTEXT("2枚刺し"); |
| break; | break; |
| case 0x08: | case 0x08: |
| p = "118音源"; | p = OEMTEXT("118音源"); |
| break; | break; |
| case 0x14: | case 0x14: |
| p = "86音源(ちびおと付)"; | p = OEMTEXT("86音源(ちびおと付)"); |
| break; | break; |
| case 0x20: | case 0x20: |
| p = "スピークボード"; | p = OEMTEXT("スピークボード"); |
| break; | break; |
| case 0x40: | case 0x40: |
| p = "スパークボード"; | p = OEMTEXT("スパークボード"); |
| break; | break; |
| case 0x80: | case 0x80: |
| p = "AMD-98"; | p = OEMTEXT("AMD-98"); |
| break; | break; |
| default: | default: |
| p = "なし"; | p = OEMTEXT("なし"); |
| break; | break; |
| } | } |
| milstr_ncpy(str, p, maxlen); | milstr_ncpy(str, p, maxlen); |
| } | } |
| static void info_jdisp(char *str, int maxlen, NP2INFOEX *ex) { | static void info_jdisp(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) { |
| UINT bpp; | UINT bpp; |
| Line 87 static void info_jdisp(char *str, int ma | Line 88 static void info_jdisp(char *str, int ma |
| (void)ex; | (void)ex; |
| } | } |
| static void info_jbios(char *str, int maxlen, NP2INFOEX *ex) { | static void info_jbios(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) { |
| str[0] = '\0'; | str[0] = '\0'; |
| if (pccore.rom & PCROM_BIOS) { | if (pccore.rom & PCROM_BIOS) { |
| Line 95 static void info_jbios(char *str, int ma | Line 96 static void info_jbios(char *str, int ma |
| } | } |
| if (soundrom.name[0]) { | if (soundrom.name[0]) { |
| if (str[0]) { | if (str[0]) { |
| milstr_ncat(str, "と", maxlen); | milstr_ncat(str, OEMTEXT("と"), maxlen); |
| } | } |
| milstr_ncat(str, soundrom.name, maxlen); | milstr_ncat(str, soundrom.name, maxlen); |
| } | } |
| if (str[0] == '\0') { | if (str[0] == '\0') { |
| milstr_ncat(str, "なし", maxlen); | milstr_ncat(str, OEMTEXT("なし"), maxlen); |
| } | } |
| } | } |
| static void info_jrhythm(char *str, int maxlen, NP2INFOEX *ex) { | static void info_jrhythm(OEMCHAR *str, int maxlen, const NP2INFOEX *ex) { |
| const char *p; | const OEMCHAR *p; |
| char jrhythmstr[16]; | OEMCHAR jrhythmstr[16]; |
| UINT exist; | UINT exist; |
| UINT i; | UINT i; |
| if (!(usesound & 0x6c)) { | if (!(usesound & 0x6c)) { |
| p = "不要やで"; | p = OEMTEXT("不要やで"); |
| } | } |
| else { | else { |
| exist = rhythm_getcaps(); | exist = rhythm_getcaps(); |
| if (exist == 0) { | if (exist == 0) { |
| p = "用意されてないんか…"; | p = OEMTEXT("用意されてないんか…"); |
| } | } |
| else if (exist == 0x3f) { | else if (exist == 0x3f) { |
| p = "全部あるで"; | p = OEMTEXT("全部あるで"); |
| } | } |
| else { | else { |
| milstr_ncpy(jrhythmstr, "BSCHTRや", sizeof(jrhythmstr)); | milstr_ncpy(jrhythmstr, OEMTEXT("BSCHTRや"), NELEMENTS(jrhythmstr)); |
| for (i=0; i<6; i++) { | for (i=0; i<6; i++) { |
| if (!(exist & (1 << i))) { | if (!(exist & (1 << i))) { |
| jrhythmstr[i] = '_'; | jrhythmstr[i] = '_'; |
| Line 136 const char *p; | Line 137 const char *p; |
| } | } |
| typedef struct { | typedef struct { |
| char key[8]; | OEMCHAR key[8]; |
| void (*proc)(char *str, int maxlen, NP2INFOEX *ex); | void (*proc)(OEMCHAR *str, int maxlen, const NP2INFOEX *ex); |
| } INFOPROC; | } INFOPROC; |
| static const INFOPROC infoproc[] = { | static const INFOPROC infoproc[] = { |
| {"PROG", info_progtitle}, | {OEMTEXT("PROG"), info_progtitle}, |
| {"JSND", info_jsound}, | {OEMTEXT("JSND"), info_jsound}, |
| {"JBIOS", info_jbios}, | {OEMTEXT("JBIOS"), info_jbios}, |
| {"JDISP", info_jdisp}, | {OEMTEXT("JDISP"), info_jdisp}, |
| {"JRHYTHM", info_jrhythm}}; | {OEMTEXT("JRHYTHM"), info_jrhythm}}; |
| static BOOL sstpext(char *dst, const char *key, int maxlen, NP2INFOEX *ex) { | static BOOL sstpext(OEMCHAR *dst, const OEMCHAR *key, int maxlen, |
| const NP2INFOEX *ex) { | |
| const INFOPROC *inf; | const INFOPROC *inf; |
| const INFOPROC *infterm; | const INFOPROC *infterm; |
| Line 164 const INFOPROC *infterm; | Line 166 const INFOPROC *infterm; |
| return(FALSE); | return(FALSE); |
| } | } |
| static const NP2INFOEX sstpex = {"\\n", sstpext}; | static const NP2INFOEX sstpex = {OEMTEXT("\\n"), sstpext}; |
| // ---- | // ---- |
| Line 185 static const UINT8 prs2[] = {0xaa,0xac,0 | Line 187 static const UINT8 prs2[] = {0xaa,0xac,0 |
| (a) = ((a) << 2) | ((a) >> 6); \ | (a) = ((a) << 2) | ((a) >> 6); \ |
| } | } |
| static char *sstpsolve(char *buf, const unsigned char *dat) { | static OEMCHAR *sstpsolve(OEMCHAR *buf, const UINT8 *dat) { |
| UINT8 c; | UINT8 c; |
| UINT8 last; | UINT8 last; |
| #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | |
| char sjis[4]; | |
| #endif | |
| last = 0x80; | last = 0x80; |
| while(1) { | while(1) { |
| Line 222 static char *sstpsolve(char *buf, const | Line 227 static char *sstpsolve(char *buf, const |
| break; | break; |
| } | } |
| while(ms > 10) { | while(ms > 10) { |
| CopyMemory(buf, "\\w9", 3); | CopyMemory(buf, OEMTEXT("\\w9"), 3 * sizeof(OEMCHAR)); |
| buf += 3; | buf += 3; |
| ms -= 10; | ms -= 10; |
| } | } |
| if (ms) { | if (ms) { |
| wsprintf(buf, "\\w%u", ms); | OEMSPRINTF(buf, OEMTEXT("\\w%1u"), ms); |
| buf += 3; | buf += 3; |
| } | } |
| } | } |
| Line 235 static char *sstpsolve(char *buf, const | Line 240 static char *sstpsolve(char *buf, const |
| UINT8 c2; | UINT8 c2; |
| GETSSTPDAT1(c2); | GETSSTPDAT1(c2); |
| if (c2) { | if (c2) { |
| #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) | |
| sjis[0] = c2; | |
| sjis[1] = '\0'; | |
| buf += oemtext_sjistooem(buf, 4, sjis, 1); | |
| #else | |
| *buf++ = c2; | *buf++ = c2; |
| #endif | |
| } | } |
| else { | else { |
| break; | break; |
| Line 260 static char *sstpsolve(char *buf, const | Line 271 static char *sstpsolve(char *buf, const |
| buf = sstpsolve(buf, p); | buf = sstpsolve(buf, p); |
| } | } |
| else if ((c >= 0xa0) && (c < 0xe0)) { | else if ((c >= 0xa0) && (c < 0xe0)) { |
| *buf++ = (UINT8)0x82; | #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) |
| *buf++ = prs2[c-0xa0]; | sjis[0] = (UINT8)0x82; |
| sjis[1] = prs2[c-0xa0]; | |
| sjis[2] = '\0'; | |
| buf += oemtext_sjistooem(buf, 4, sjis, 2); | |
| #else | |
| buf[0] = (UINT8)0x82; | |
| buf[1] = prs2[c-0xa0]; | |
| buf += 2; | |
| #endif | |
| } | } |
| else { | else { |
| UINT8 c2; | UINT8 c2; |
| GETSSTPDAT1(c2); | GETSSTPDAT1(c2); |
| if (c2) { | if (c2) { |
| *buf++ = c; | #if defined(OSLANG_UTF8) || defined(OSLANG_UCS2) |
| *buf++ = c2; | sjis[0] = c; |
| sjis[1] = c2; | |
| sjis[2] = '\0'; | |
| buf += oemtext_sjistooem(buf, 4, sjis, 2); | |
| #else | |
| buf[0] = c; | |
| buf[1] = c2; | |
| buf += 2; | |
| #endif | |
| } | } |
| else { | else { |
| break; | break; |
| Line 282 static char *sstpsolve(char *buf, const | Line 309 static char *sstpsolve(char *buf, const |
| // ------------------------------- | // ------------------------------- |
| static const UINT8 *prcs[4] = {k_keropi, k_winx68k, k_t98next, k_anex86}; | |
| static int check_keropi(void) { | static int check_keropi(void) { |
| char buf[64]; | UINT i; |
| sstpsolve(buf, k_keropi); | for (i=0; i<NELEMENTS(prcs); i++) { |
| if (FindWindow(buf, NULL)) { | OEMCHAR buf[64]; |
| return(1); | sstpsolve(buf, prcs[i]); |
| } | #if defined(OSLANG_UTF8) |
| sstpsolve(buf, k_winx68k); | TCHAR tchr[64]; |
| if (FindWindow(buf, NULL)) { | oemtotchar(tchr, NELEMENTS(tchr), buf, -1); |
| return(2); | #else |
| } | const TCHAR *tchr = buf; |
| sstpsolve(buf, k_t98next); | #endif |
| if (FindWindow(NULL, buf)) { | if (FindWindow(tchr, NULL)) { |
| return(3); | return(i + 1); |
| } | } |
| sstpsolve(buf, k_anex86); | |
| if (FindWindow(NULL, buf)) { | |
| return(4); | |
| } | } |
| return(0); | return(0); |
| } | } |
| Line 310 static int check_keropi(void) { | Line 336 static int check_keropi(void) { |
| void sstpmsg_welcome(void) { | void sstpmsg_welcome(void) { |
| int kero; | UINT kero; |
| char *p; | OEMCHAR *p; |
| char buf[512]; | OEMCHAR buf[512]; |
| p = buf; | p = buf; |
| kero = check_keropi(); | kero = check_keropi(); |
| if (!kero) { | if (!kero) { |
| switch(rand() & 15) { | switch(rand() & 15) { |
| Line 358 void sstpmsg_welcome(void) { | Line 383 void sstpmsg_welcome(void) { |
| case 0: | case 0: |
| p = sstpsolve(p, s_keropi1); | p = sstpsolve(p, s_keropi1); |
| break; | break; |
| case 1: | case 1: |
| p = sstpsolve(p, s_keropi2); | p = sstpsolve(p, s_keropi2); |
| break; | break; |
| default: | default: |
| p = sstpsolve(p, s_keropi3); | p = sstpsolve(p, s_keropi3); |
| break; | break; |
| } | } |
| break; | break; |
| case 2: | case 2: |
| p = sstpsolve(p, s_winx68k); | p = sstpsolve(p, s_winx68k); |
| break; | break; |
| case 3: | case 3: |
| p = sstpsolve(p, s_t98next); | p = sstpsolve(p, s_t98next); |
| break; | break; |
| case 4: | case 4: |
| p = sstpsolve(p, s_anex86); | p = sstpsolve(p, s_anex86); |
| break; | break; |
| default: | default: |
| p = sstpsolve(p, s_error); | p = sstpsolve(p, s_error); |
| break; | break; |
| Line 385 void sstpmsg_welcome(void) { | Line 416 void sstpmsg_welcome(void) { |
| void sstpmsg_reset(void) { | void sstpmsg_reset(void) { |
| char str[1024]; | OEMCHAR str[1024]; |
| UINT update; | UINT update; |
| str[0] = '\0'; | str[0] = '\0'; |
| update = sys_updates; | update = sys_updates; |
| if (update & SYS_UPDATECLOCK) { | if (update & SYS_UPDATECLOCK) { |
| strcat(str, "CPUクロックを %CLOCK%に"); | milstr_ncat(str, OEMTEXT("CPUクロックを %CLOCK%に"), NELEMENTS(str)); |
| } | } |
| if (update & SYS_UPDATEMEMORY) { | if (update & SYS_UPDATEMEMORY) { |
| if (str[0]) { | if (str[0]) { |
| strcat(str, cr); | milstr_ncat(str, cr, NELEMENTS(str)); |
| } | } |
| strcat(str, "メモリを %MEM3%に"); | milstr_ncat(str, OEMTEXT("メモリを %MEM3%に"), NELEMENTS(str)); |
| } | } |
| if (update & SYS_UPDATESBOARD) { | if (update & SYS_UPDATESBOARD) { |
| if (str[0]) { | if (str[0]) { |
| strcat(str, cr); | milstr_ncat(str, cr, NELEMENTS(str)); |
| } | } |
| strcat(str, "音源を %JSND%に"); | milstr_ncat(str, OEMTEXT("音源を %JSND%に"), NELEMENTS(str)); |
| } | } |
| if (update & (SYS_UPDATERATE | SYS_UPDATESBUF | SYS_UPDATEMIDI | | if (update & (SYS_UPDATERATE | SYS_UPDATESBUF | SYS_UPDATEMIDI | |
| SYS_UPDATEHDD | SYS_UPDATESERIAL1)) { | SYS_UPDATEHDD | SYS_UPDATESERIAL1)) { |
| BOOL hit = FALSE; | BOOL hit = FALSE; |
| if (str[0]) { | if (str[0]) { |
| strcat(str, "\\nあと…\\w5"); | milstr_ncat(str, OEMTEXT("\\nあと…\\w5"), NELEMENTS(str)); |
| } | } |
| if (update & SYS_UPDATEMIDI) { | if (update & SYS_UPDATEMIDI) { |
| hit = TRUE; | hit = TRUE; |
| strcat(str, "MIDI"); | milstr_ncat(str, OEMTEXT("MIDI"), NELEMENTS(str)); |
| } | } |
| if (update & (SYS_UPDATERATE | SYS_UPDATESBUF)) { | if (update & (SYS_UPDATERATE | SYS_UPDATESBUF)) { |
| if (hit) { | if (hit) { |
| strcat(str, " "); | milstr_ncat(str, str_space, NELEMENTS(str)); |
| } | } |
| hit = TRUE; | hit = TRUE; |
| strcat(str, "サウンド設定"); | milstr_ncat(str, OEMTEXT("サウンド設定"), NELEMENTS(str)); |
| } | } |
| if (update & SYS_UPDATEHDD) { | if (update & SYS_UPDATEHDD) { |
| if (hit) { | if (hit) { |
| strcat(str, " "); | milstr_ncat(str, str_space, NELEMENTS(str)); |
| } | } |
| hit = TRUE; | hit = TRUE; |
| strcat(str, "ハードディスク"); | milstr_ncat(str, OEMTEXT("ハードディスク"), NELEMENTS(str)); |
| } | } |
| if (update & SYS_UPDATESERIAL1) { | if (update & SYS_UPDATESERIAL1) { |
| if (hit) { | if (hit) { |
| strcat(str, " "); | milstr_ncat(str, str_space, NELEMENTS(str)); |
| } | } |
| hit = TRUE; | hit = TRUE; |
| strcat(str, "シリアル"); | milstr_ncat(str, OEMTEXT("シリアル"), NELEMENTS(str)); |
| } | } |
| strcat(str, "の設定を"); | milstr_ncat(str, OEMTEXT("の設定を"), NELEMENTS(str)); |
| } | } |
| if (str[0]) { | if (str[0]) { |
| char out[1024]; | OEMCHAR out[1024]; |
| strcat(str, "変更しました。"); | milstr_ncat(str, OEMTEXT("変更しました。"), NELEMENTS(str)); |
| np2info(out, str, sizeof(out), &sstpex); | np2info(out, str, NELEMENTS(out), &sstpex); |
| sstp_send(out, NULL); | sstp_send(out, NULL); |
| } | } |
| } | } |
| void sstpmsg_about(void) { | void sstpmsg_about(void) { |
| char str[1024]; | OEMCHAR str[1024]; |
| char out[1024]; | OEMCHAR out[1024]; |
| char *p; | OEMCHAR *p; |
| int nostat = FALSE; | int nostat = FALSE; |
| p = str; | p = str; |
| Line 468 void sstpmsg_about(void) { | Line 497 void sstpmsg_about(void) { |
| case 5: | case 5: |
| p = sstpsolve(p, s_ver1); | p = sstpsolve(p, s_ver1); |
| break; | break; |
| case 6: | case 6: |
| p = sstpsolve(p, s_ver2); | p = sstpsolve(p, s_ver2); |
| break; | break; |
| Line 480 void sstpmsg_about(void) { | Line 510 void sstpmsg_about(void) { |
| if (!nostat) { | if (!nostat) { |
| p = sstpsolve(p, s_info); | p = sstpsolve(p, s_info); |
| } | } |
| np2info(out, str, sizeof(out), &sstpex); | np2info(out, str, NELEMENTS(out), &sstpex); |
| sstp_send(out, NULL); | sstp_send(out, NULL); |
| } | } |
| void sstpmsg_config(void) { | void sstpmsg_config(void) { |
| char str[1024]; | OEMCHAR str[1024]; |
| char *p; | OEMCHAR *p; |
| p = sstpsolve(str, s_config0); | p = sstpsolve(str, s_config0); |
| switch(rand() & 7) { | switch(rand() & 7) { |
| case 0: | case 0: |
| p = sstpsolve(p, s_config1); | p = sstpsolve(p, s_config1); |
| break; | break; |
| case 1: | case 1: |
| p = sstpsolve(p, s_config2); | p = sstpsolve(p, s_config2); |
| break; | break; |
| case 2: | case 2: |
| case 3: | case 3: |
| p = sstpsolve(p, s_config3); | p = sstpsolve(p, s_config3); |
| break; | break; |
| default: | default: |
| p = sstpsolve(p, s_config4); | p = sstpsolve(p, s_config4); |
| break; | break; |
| Line 514 void sstpmsg_config(void) { | Line 547 void sstpmsg_config(void) { |
| static char *get_code(char *buf, int *ret) { | static char *get_code(char *buf, int *ret) { |
| int stat; | int stat; |
| stat = 0; | stat = 0; |
| if (!memcmp(buf, "SSTP", 4)) { | if (!memcmp(buf, "SSTP", 4)) { |
| Line 554 static void e_sstpreset(HWND hWnd, char | Line 587 static void e_sstpreset(HWND hWnd, char |
| BOOL sstpconfirm_reset(void) { | BOOL sstpconfirm_reset(void) { |
| char str[256]; | OEMCHAR str[256]; |
| sstpsolve(str, s_reset); | sstpsolve(str, s_reset); |
| return(sstp_send(str, e_sstpreset)); | return(sstp_send(str, e_sstpreset)); |
| Line 575 static void e_sstpexit(HWND hWnd, char * | Line 608 static void e_sstpexit(HWND hWnd, char * |
| BOOL sstpconfirm_exit(void) { | BOOL sstpconfirm_exit(void) { |
| char str[512]; | OEMCHAR str[512]; |
| sstpsolve(str, s_exit); | sstpsolve(str, s_exit); |
| return(sstp_send(str, e_sstpexit)); | return(sstp_send(str, e_sstpexit)); |
| Line 586 BOOL sstpconfirm_exit(void) { | Line 619 BOOL sstpconfirm_exit(void) { |
| BOOL sstpmsg_running(void) { | BOOL sstpmsg_running(void) { |
| char buf[256]; | OEMCHAR buf[256]; |
| char *p; | OEMCHAR *p; |
| p = buf; | p = buf; |
| switch(rand() & 7) { | switch(rand() & 7) { |
| case 0: | case 0: |
| p = sstpsolve(p, s_running1); | p = sstpsolve(p, s_running1); |
| break; | break; |
| case 1: | case 1: |
| p = sstpsolve(p, s_running2); | p = sstpsolve(p, s_running2); |
| break; | break; |
| case 2: | case 2: |
| p = sstpsolve(p, s_running3); | p = sstpsolve(p, s_running3); |
| break; | break; |
| default: | default: |
| p = sstpsolve(p, s_running4); | p = sstpsolve(p, s_running4); |
| break; | break; |
| Line 610 BOOL sstpmsg_running(void) { | Line 646 BOOL sstpmsg_running(void) { |
| BOOL sstpmsg_dxerror(void) { | BOOL sstpmsg_dxerror(void) { |
| char buf[256]; | OEMCHAR buf[256]; |
| sstpsolve(buf, s_dxerror); | sstpsolve(buf, s_dxerror); |
| return(sstp_sendonly(buf)); | return(sstp_sendonly(buf)); |