summaryrefslogtreecommitdiff
path: root/src/music/win32_m.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-03-15 21:12:08 +0000
committerglx <glx@openttd.org>2008-03-15 21:12:08 +0000
commit1abd2bd700872098e10fedd65bde994d517789d6 (patch)
treeeb63053cf20868fdf6a8e3209dcd5a803089c724 /src/music/win32_m.cpp
parent756e0d9b6e003abe0d60fa0554ce446a2985cc09 (diff)
downloadopenttd-1abd2bd700872098e10fedd65bde994d517789d6.tar.xz
(svn r12372) -Fix: win32 music driver fails if path contains non-latin chars
Diffstat (limited to 'src/music/win32_m.cpp')
-rw-r--r--src/music/win32_m.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp
index 356d33c76..8ec6756c4 100644
--- a/src/music/win32_m.cpp
+++ b/src/music/win32_m.cpp
@@ -46,28 +46,29 @@ void MusicDriver_Win32::SetVolume(byte vol)
SetEvent(_midi.wait_obj);
}
-static MCIERROR CDECL MidiSendCommand(const char* cmd, ...)
+static MCIERROR CDECL MidiSendCommand(const TCHAR* cmd, ...)
{
va_list va;
- char buf[512];
+ TCHAR buf[512];
va_start(va, cmd);
- vsnprintf(buf, lengthof(buf), cmd, va);
+ _vsntprintf(buf, lengthof(buf), cmd, va);
va_end(va);
- return mciSendStringA(buf, NULL, 0, 0);
+ return mciSendString(buf, NULL, 0, 0);
}
static bool MidiIntPlaySong(const char *filename)
{
- MidiSendCommand("close all");
- if (MidiSendCommand("open \"%s\" type sequencer alias song", filename) != 0) return false;
+ MidiSendCommand(_T("close all"));
- return MidiSendCommand("play song from 0") == 0;
+ if (MidiSendCommand(_T("open \"%s\" type sequencer alias song"), OTTD2FS(filename)) != 0) return false;
+
+ return MidiSendCommand(_T("play song from 0")) == 0;
}
static void MidiIntStopSong()
{
- MidiSendCommand("close all");
+ MidiSendCommand(_T("close all"));
}
static void MidiIntSetVolume(int vol)