--- np2/common/mimpidef.c 2003/10/16 17:57:11 1.1.1.1 +++ np2/common/mimpidef.c 2005/03/18 09:23:10 1.4 @@ -4,38 +4,38 @@ #include "mimpidef.h" -static const char str_la[] = "LA"; -static const char str_pcm[] = "PCM"; -static const char str_gs[] = "GS"; -static const char str_rhythm[] = "RHYTHM"; +static const OEMCHAR str_la[] = OEMTEXT("LA"); +static const OEMCHAR str_pcm[] = OEMTEXT("PCM"); +static const OEMCHAR str_gs[] = OEMTEXT("GS"); +static const OEMCHAR str_rhythm[] = OEMTEXT("RHYTHM"); -static char *cutdelimit(char *buf) { +static OEMCHAR *cutdelimit(const OEMCHAR *buf) { while((buf[0] > 0) && (buf[0] <= ' ')) { buf++; } - return(buf); + return((OEMCHAR *)buf); } -static BOOL getvalue(char **buf, int *value) { +static BRESULT getvalue(OEMCHAR **buf, int *value) { - char *p; + OEMCHAR *p; int val; - BOOL ret; - char c; + BRESULT ret; + OEMCHAR c; p = cutdelimit(*buf); val = 0; ret = FAILURE; while(1) { - c = *p++; - c -= '0'; - if ((c & 0xff) >= 10) { + c = *p; + if ((c < '0') || (c > '9')) { break; } + p++; val *= 10; - val += c; + val += c - '0'; ret = SUCCESS; } if (ret == SUCCESS) { @@ -45,7 +45,7 @@ static BOOL getvalue(char **buf, int *va return(ret); } -static void analyze(MIMPIDEF *def, char *buf) { +static void analyze(MIMPIDEF *def, OEMCHAR *buf) { int num; int mod; @@ -95,17 +95,17 @@ static void analyze(MIMPIDEF *def, char return; } tone--; - def->bank[mod][num] = (BYTE)bank; + def->bank[mod][num] = (UINT8)bank; } - def->map[mod][num] = (BYTE)tone; + def->map[mod][num] = (UINT8)tone; } } -BOOL mimpidef_load(MIMPIDEF *def, const char *filename) { +BRESULT mimpidef_load(MIMPIDEF *def, const OEMCHAR *filename) { - BYTE b; + UINT8 b; TEXTFILEH fh; - char buf[256]; + OEMCHAR buf[256]; if (def == NULL) { goto mdld_err; @@ -124,7 +124,7 @@ BOOL mimpidef_load(MIMPIDEF *def, const if (fh == NULL) { goto mdld_err; } - while(textfile_read(fh, buf, sizeof(buf)) == SUCCESS) { + while(textfile_read(fh, buf, NELEMENTS(buf)) == SUCCESS) { analyze(def, buf); } textfile_close(fh);