mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Change atrac3plus decoder dll name to be neutral. Add basic non-windows support for loading it (not tested yet).
This commit is contained in:
parent
b9251f18f4
commit
169ca97377
@ -1,6 +1,8 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include <string.h>
|
||||
@ -9,6 +11,8 @@ namespace Atrac3plus_Decoder {
|
||||
|
||||
#ifdef _WIN32
|
||||
HMODULE hlib = 0;
|
||||
#else
|
||||
static void *so;
|
||||
#endif // _WIN32
|
||||
|
||||
typedef int (* ATRAC3PLUS_DECODEFRAME)(void* context, void* inbuf, int inbytes, int* channels, void** outbuf);
|
||||
@ -21,7 +25,7 @@ namespace Atrac3plus_Decoder {
|
||||
int initdecoder() {
|
||||
|
||||
#ifdef _WIN32
|
||||
hlib = LoadLibraryA("MaiAT3PlusDecoder.dll");
|
||||
hlib = LoadLibraryA("at3plusdecoder.dll");
|
||||
if (hlib) {
|
||||
frame_decoder = (ATRAC3PLUS_DECODEFRAME)GetProcAddress(hlib, "Atrac3plusDecoder_decodeFrame");
|
||||
open_context = (ATRAC3PLUS_OPENCONTEXT)GetProcAddress(hlib, "Atrac3plusDecoder_openContext");
|
||||
@ -29,6 +33,16 @@ namespace Atrac3plus_Decoder {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
// TODO: from which directory on Android?
|
||||
so = dlopen("at3plusdecoder.so", RTLD_LAZY);
|
||||
if (so) {
|
||||
frame_decoder = (ATRAC3PLUS_DECODEFRAME)dlsym(so, "Atrac3plusDecoder_decodeFrame");
|
||||
open_context = (ATRAC3PLUS_OPENCONTEXT)dlsym(so, "Atrac3plusDecoder_openContext");
|
||||
close_context = (ATRAC3PLUS_CLOSECONTEXT)dlsym(so, "Atrac3plusDecoder_closeContext");
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
return 0;
|
||||
@ -41,6 +55,11 @@ namespace Atrac3plus_Decoder {
|
||||
FreeLibrary(hlib);
|
||||
hlib = 0;
|
||||
}
|
||||
#else
|
||||
if (so) {
|
||||
dlclose(so);
|
||||
so = 0;
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
return 0;
|
||||
|
@ -177,6 +177,7 @@ LOCAL_SRC_FILES := \
|
||||
$(SRC)/Core/ELF/PBPReader.cpp \
|
||||
$(SRC)/Core/ELF/PrxDecrypter.cpp \
|
||||
$(SRC)/Core/ELF/ParamSFO.cpp \
|
||||
$(SRC)/Core/HW/atrac3plus.cpp \
|
||||
$(SRC)/Core/HW/MemoryStick.cpp \
|
||||
$(SRC)/Core/HW/MediaEngine.cpp.arm \
|
||||
$(SRC)/Core/HW/SasAudio.cpp.arm \
|
||||
|
Loading…
Reference in New Issue
Block a user