void TcsToAscii(char* Out,size_t OutLen,const tchar_t* In) { #ifdef UNICODE if (!WideCharToMultiByte(CP_ACP,0,In,-1,Out,OutLen,0,0)) TcsToStr(Out,OutLen,In); #else TcsToStr(Out,OutLen,In); #endif }
void TcsToUTF8(char* Out,size_t OutLen,const tchar_t* In) { #ifdef UNICODE if (!WideCharToMultiByte(CP_UTF8,0,In,-1,Out,OutLen,0,0)) TcsToStr(Out,OutLen,In); #else WCHAR Temp[512]; if (!MultiByteToWideChar(CP_ACP,0,In,-1,Temp,512) || !WideCharToMultiByte(CP_UTF8,0,Temp,-1,Out,OutLen,0,0)) TcsToStr(Out,OutLen,In); #endif }
static bool_t Load(ape* p) { format_reader* Reader = p->Format.Reader; char Path8[MAXPATH]; tchar_t Path[MAXPATH]; int errorCode = 0; int size; wchar_t* PathW; Reader->Input->Get(Reader->Input,STREAM_URL,Path,sizeof(Path)); TcsToStr(Path8,sizeof(Path8),Path); size = sizeof(wchar_t) * strlen(Path8); PathW = (wchar_t*)malloc(size); size = mbstowcs(PathW, Path8, size); p->Decoder = CreateIAPEDecompress(PathW, &errorCode); free(PathW); if (!p->Decoder) { #if defined(TARGET_WINCE) || defined(TARGET_WIN32) TCHAR cNumber[255]; _stprintf(cNumber, _T("Could not load decoder, Error code: %d"), errorCode); MessageBox(NULL, cNumber, L"Error", MB_OK); #endif return 0; } return 1; }
static bool_t Load(asap* p) { format_reader* Reader = p->Format.Reader; char Path8[MAXPATH]; tchar_t Path[MAXPATH]; void* buf; int n = p->Format.FileSize; if (n<=0) n=65536; buf = malloc(n); if (!buf) return 0; Reader->Input->Get(Reader->Input,STREAM_URL,Path,sizeof(Path)); TcsToStr(Path8,sizeof(Path8),Path); n = Reader->Read(Reader,buf,n); n = ASAP_Load(Path8, buf, n); free(buf); if (!n) return 0; ASAP_PlaySong(ASAP_GetDefSong()); p->Samples = 0; return 1; }
void TcsToUTF8(char* Out,size_t OutLen,const tchar_t* In) { TcsToStr(Out,OutLen,In); //todo: fix }
void TcsToAscii(char* Out,size_t OutLen,const tchar_t* In) { TcsToStr(Out,OutLen,In); }