summaryrefslogtreecommitdiffstats
path: root/src/audio/oal/stream.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-05-11 04:55:57 +0200
committereray orçunus <erayorcunus@gmail.com>2020-05-11 20:00:55 +0200
commit8a4fa58cd42b7cca4a86fe2d9913b839b554bf10 (patch)
tree294e44de2168e1b581ba847775d827924c07bf2e /src/audio/oal/stream.cpp
parentMerge pull request #509 from Fire-Head/master (diff)
downloadre3-8a4fa58cd42b7cca4a86fe2d9913b839b554bf10.tar
re3-8a4fa58cd42b7cca4a86fe2d9913b839b554bf10.tar.gz
re3-8a4fa58cd42b7cca4a86fe2d9913b839b554bf10.tar.bz2
re3-8a4fa58cd42b7cca4a86fe2d9913b839b554bf10.tar.lz
re3-8a4fa58cd42b7cca4a86fe2d9913b839b554bf10.tar.xz
re3-8a4fa58cd42b7cca4a86fe2d9913b839b554bf10.tar.zst
re3-8a4fa58cd42b7cca4a86fe2d9913b839b554bf10.zip
Diffstat (limited to '')
-rw-r--r--src/audio/oal/stream.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 9bca0546..5a9c7d7d 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -4,13 +4,15 @@
#include "common.h"
#include "sampman.h"
-typedef long ssize_t;
-
#include <sndfile.h>
#include <mpg123.h>
-
+#ifdef _WIN32
+typedef long ssize_t;
#pragma comment( lib, "libsndfile-1.lib" )
#pragma comment( lib, "libmpg123.lib" )
+#else
+#include "crossplatform.h"
+#endif
class CSndFile : public IDecoder
{
@@ -192,7 +194,22 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
m_nPosBeforeReset(0)
{
- strcpy(m_aFilename, filename);
+// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
+#if !defined(_WIN32)
+ FILE *test = fopen(filename, "r");
+ if (!test) {
+ char *r = (char*)alloca(strlen(filename) + 2);
+ if (casepath(filename, r))
+ {
+ strcpy(m_aFilename, r);
+ }
+ } else {
+ fclose(test);
+#else
+ {
+#endif
+ strcpy(m_aFilename, filename);
+ }
DEV("Stream %s\n", m_aFilename);
@@ -517,4 +534,4 @@ void CStream::ProviderTerm()
ClearBuffers();
}
-#endif \ No newline at end of file
+#endif