Commit 8fa62e29 authored by nanahira's avatar nanahira

add better logs

parent c6e89bec
Pipeline #36868 passed with stages
in 6 minutes and 45 seconds
......@@ -2006,6 +2006,11 @@ void Game::ErrorLog(const char* msg) {
std::fprintf(fp, "[%s]%s\n", timebuf, msg);
std::fclose(fp);
}
void Game::ErrorLog(const wchar_t* msg) {
char msgbuf[2048];
BufferIO::EncodeUTF8(msg, msgbuf);
ErrorLog(msgbuf);
}
void Game::initUtils() {
//user files
FileSystem::MakeDir("replay");
......
......@@ -218,6 +218,7 @@ public:
void ClearChatMsg();
void AddDebugMsg(const char* msgbuf);
void ErrorLog(const char* msgbuf);
void ErrorLog(const wchar_t* msgbuf);
void initUtils();
void ClearTextures();
void CloseGameButtons();
......
......@@ -111,11 +111,15 @@ void SoundManager::PlaySound(wchar_t* sound) {
usingSoundEffectPointer = playingSoundEffect[0];
ma_sound_uninit(usingSoundEffectPointer);
}
wprintf(L"Playing sound: %ls\n", sound);
wchar_t textbuf[1024];
myswprintf(textbuf, L"Playing sound: %ls", sound);
mainGame->ErrorLog(textbuf);
auto res = ma_sound_init_from_file_w(&engineSound, sound, MA_SOUND_FLAG_ASYNC | MA_SOUND_FLAG_STREAM, nullptr, nullptr, usingSoundEffectPointer);
wprintf(L"ma_sound_init_from_file_w result: %d\n", res);
myswprintf(textbuf, L"ma_sound_init_from_file_w result: %d", res);
mainGame->ErrorLog(textbuf);
auto res2 = ma_sound_start(usingSoundEffectPointer);
wprintf(L"ma_sound_start result: %d\n", res2);
myswprintf(textbuf, L"ma_sound_start result: %d", res2);
mainGame->ErrorLog(textbuf);
#endif
#ifdef YGOPRO_USE_IRRKLANG
char csound[1024];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment