From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Wasabi2/Wasabi1.cpp | 63 ++++++++ Src/Wasabi2/Wasabi2.rc | 76 +++++++++ Src/Wasabi2/Wasabi2.sln | 105 ++++++++++++ Src/Wasabi2/Wasabi2.vcxproj | 290 ++++++++++++++++++++++++++++++++++ Src/Wasabi2/Wasabi2.vcxproj.filters | 80 ++++++++++ Src/Wasabi2/Winamp5ArtworkManager.cpp | 48 ++++++ Src/Wasabi2/Winamp5ArtworkManager.h | 17 ++ Src/Wasabi2/api__wasabi2.cpp | 45 ++++++ Src/Wasabi2/api__wasabi2.h | 29 ++++ Src/Wasabi2/application.cpp | 94 +++++++++++ Src/Wasabi2/application.h | 33 ++++ Src/Wasabi2/main.cpp | 77 +++++++++ Src/Wasabi2/main.h | 5 + Src/Wasabi2/resource.h | 14 ++ Src/Wasabi2/utilities.cpp | 19 +++ Src/Wasabi2/version.rc2 | 39 +++++ Src/Wasabi2/wasabi1_factory.cpp | 62 ++++++++ Src/Wasabi2/wasabi1_factory.h | 21 +++ 18 files changed, 1117 insertions(+) create mode 100644 Src/Wasabi2/Wasabi1.cpp create mode 100644 Src/Wasabi2/Wasabi2.rc create mode 100644 Src/Wasabi2/Wasabi2.sln create mode 100644 Src/Wasabi2/Wasabi2.vcxproj create mode 100644 Src/Wasabi2/Wasabi2.vcxproj.filters create mode 100644 Src/Wasabi2/Winamp5ArtworkManager.cpp create mode 100644 Src/Wasabi2/Winamp5ArtworkManager.h create mode 100644 Src/Wasabi2/api__wasabi2.cpp create mode 100644 Src/Wasabi2/api__wasabi2.h create mode 100644 Src/Wasabi2/application.cpp create mode 100644 Src/Wasabi2/application.h create mode 100644 Src/Wasabi2/main.cpp create mode 100644 Src/Wasabi2/main.h create mode 100644 Src/Wasabi2/resource.h create mode 100644 Src/Wasabi2/utilities.cpp create mode 100644 Src/Wasabi2/version.rc2 create mode 100644 Src/Wasabi2/wasabi1_factory.cpp create mode 100644 Src/Wasabi2/wasabi1_factory.h (limited to 'Src/Wasabi2') diff --git a/Src/Wasabi2/Wasabi1.cpp b/Src/Wasabi2/Wasabi1.cpp new file mode 100644 index 00000000..8a6bceb1 --- /dev/null +++ b/Src/Wasabi2/Wasabi1.cpp @@ -0,0 +1,63 @@ +#include "api__wasabi2.h" +#include "../Winamp/wa_ipc.h" + +namespace Wasabi { +#include +#include "../nu/ServiceWatcher.h" +} + +Wasabi::ServiceWatcher serviceWatcher; + +template +static void ServiceBuild(api_T *&api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC) + { + Wasabi::waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + api_t = reinterpret_cast( factory->getInterface() ); + } +} + +template +static void ServiceRelease(api_T *api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC && api_t) + { + Wasabi::waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + factory->releaseInterface(api_t); + } + api_t = NULL; +} + +Wasabi::api_service *WASABI_API_SVC=0; +Wasabi::api_application *WASABI_API_APP=0; +Wasabi::api_memmgr *WASABI_API_MEMMGR=0; +Wasabi::api_albumart *AGAVE_API_ALBUMART=0; + + +void Wasabi1_Initialize(Wasabi::api_service *svc_api) +{ + WASABI_API_SVC = svc_api; + ServiceBuild(WASABI_API_APP, Wasabi::applicationApiServiceGuid); + ServiceBuild(AGAVE_API_ALBUMART, Wasabi::albumArtGUID); + ServiceBuild(WASABI_API_MEMMGR, Wasabi::memMgrApiServiceGuid); + + serviceWatcher.WatchWith(WASABI_API_SVC); + serviceWatcher.WatchFor(&AGAVE_API_ALBUMART, Wasabi::albumArtGUID); +} + +void Wasabi1_Quit() +{ + serviceWatcher.StopWatching(); + serviceWatcher.Clear(); + + ServiceRelease(WASABI_API_APP, Wasabi::applicationApiServiceGuid); + ServiceRelease(AGAVE_API_ALBUMART, Wasabi::albumArtGUID); + ServiceRelease(WASABI_API_MEMMGR, Wasabi::memMgrApiServiceGuid); +} + +namespace Wasabi { +#include "../nu/ServiceWatcher.cpp" +} \ No newline at end of file diff --git a/Src/Wasabi2/Wasabi2.rc b/Src/Wasabi2/Wasabi2.rc new file mode 100644 index 00000000..fcff7711 --- /dev/null +++ b/Src/Wasabi2/Wasabi2.rc @@ -0,0 +1,76 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Wasabi2/Wasabi2.sln b/Src/Wasabi2/Wasabi2.sln new file mode 100644 index 00000000..7b7c789d --- /dev/null +++ b/Src/Wasabi2/Wasabi2.sln @@ -0,0 +1,105 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29509.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wasabi2", "Wasabi2.vcxproj", "{4A907402-5983-4D6B-8D85-0F61C348319A}" + ProjectSection(ProjectDependencies) = postProject + {57C90706-B25D-4ACA-9B33-95CDB2427C27} = {57C90706-B25D-4ACA-9B33-95CDB2427C27} + {4F34CA12-9F74-4A96-A917-8DEEA4961B31} = {4F34CA12-9F74-4A96-A917-8DEEA4961B31} + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915} = {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915} + {E105A0A2-7391-47C5-86AC-718003524C3D} = {E105A0A2-7391-47C5-86AC-718003524C3D} + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956} = {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956} + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A} = {0F9730E4-45DA-4BD2-A50A-403A4BC9751A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "metadata", "..\replicant\replicant\metadata\metadata.vcxproj", "{E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wasabi-replicant", "..\replicant\Wasabi\Wasabi-replicant.vcxproj", "{4F34CA12-9F74-4A96-A917-8DEEA4961B31}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nu", "..\replicant\nu\nu.vcxproj", "{F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nx", "..\replicant\nx\nx.vcxproj", "{57C90706-B25D-4ACA-9B33-95CDB2427C27}" + ProjectSection(ProjectDependencies) = postProject + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A} = {0F9730E4-45DA-4BD2-A50A-403A4BC9751A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jnetlib", "..\replicant\jnetlib\jnetlib.vcxproj", "{E105A0A2-7391-47C5-86AC-718003524C3D}" + ProjectSection(ProjectDependencies) = postProject + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A} = {0F9730E4-45DA-4BD2-A50A-403A4BC9751A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\replicant\zlib\zlib.vcxproj", "{0F9730E4-45DA-4BD2-A50A-403A4BC9751A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4A907402-5983-4D6B-8D85-0F61C348319A}.Debug|Win32.ActiveCfg = Debug|Win32 + {4A907402-5983-4D6B-8D85-0F61C348319A}.Debug|Win32.Build.0 = Debug|Win32 + {4A907402-5983-4D6B-8D85-0F61C348319A}.Debug|x64.ActiveCfg = Debug|x64 + {4A907402-5983-4D6B-8D85-0F61C348319A}.Debug|x64.Build.0 = Debug|x64 + {4A907402-5983-4D6B-8D85-0F61C348319A}.Release|Win32.ActiveCfg = Release|Win32 + {4A907402-5983-4D6B-8D85-0F61C348319A}.Release|Win32.Build.0 = Release|Win32 + {4A907402-5983-4D6B-8D85-0F61C348319A}.Release|x64.ActiveCfg = Release|x64 + {4A907402-5983-4D6B-8D85-0F61C348319A}.Release|x64.Build.0 = Release|x64 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Debug|Win32.ActiveCfg = Debug|Win32 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Debug|Win32.Build.0 = Debug|Win32 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Debug|x64.ActiveCfg = Debug|x64 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Debug|x64.Build.0 = Debug|x64 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Release|Win32.ActiveCfg = Release|Win32 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Release|Win32.Build.0 = Release|Win32 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Release|x64.ActiveCfg = Release|x64 + {E2FD86D4-1A1C-49EB-BAB8-B63D594CC956}.Release|x64.Build.0 = Release|x64 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Debug|Win32.ActiveCfg = Debug|Win32 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Debug|Win32.Build.0 = Debug|Win32 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Debug|x64.ActiveCfg = Debug|x64 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Debug|x64.Build.0 = Debug|x64 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Release|Win32.ActiveCfg = Release|Win32 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Release|Win32.Build.0 = Release|Win32 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Release|x64.ActiveCfg = Release|x64 + {4F34CA12-9F74-4A96-A917-8DEEA4961B31}.Release|x64.Build.0 = Release|x64 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Debug|Win32.ActiveCfg = Debug|Win32 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Debug|Win32.Build.0 = Debug|Win32 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Debug|x64.ActiveCfg = Debug|x64 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Debug|x64.Build.0 = Debug|x64 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Release|Win32.ActiveCfg = Release|Win32 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Release|Win32.Build.0 = Release|Win32 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Release|x64.ActiveCfg = Release|x64 + {F1F5CD60-0D5B-4CEA-9EEB-2F87FF9AA915}.Release|x64.Build.0 = Release|x64 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Debug|Win32.ActiveCfg = Debug|Win32 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Debug|Win32.Build.0 = Debug|Win32 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Debug|x64.ActiveCfg = Debug|x64 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Debug|x64.Build.0 = Debug|x64 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Release|Win32.ActiveCfg = Release|Win32 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Release|Win32.Build.0 = Release|Win32 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Release|x64.ActiveCfg = Release|x64 + {57C90706-B25D-4ACA-9B33-95CDB2427C27}.Release|x64.Build.0 = Release|x64 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Debug|Win32.ActiveCfg = Debug|Win32 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Debug|Win32.Build.0 = Debug|Win32 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Debug|x64.ActiveCfg = Debug|x64 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Debug|x64.Build.0 = Debug|x64 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Release|Win32.ActiveCfg = Release|Win32 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Release|Win32.Build.0 = Release|Win32 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Release|x64.ActiveCfg = Release|x64 + {E105A0A2-7391-47C5-86AC-718003524C3D}.Release|x64.Build.0 = Release|x64 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Debug|Win32.ActiveCfg = Debug|Win32 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Debug|Win32.Build.0 = Debug|Win32 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Debug|x64.ActiveCfg = Debug|x64 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Debug|x64.Build.0 = Debug|x64 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Release|Win32.ActiveCfg = Release|Win32 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Release|Win32.Build.0 = Release|Win32 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Release|x64.ActiveCfg = Release|x64 + {0F9730E4-45DA-4BD2-A50A-403A4BC9751A}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C4E799C1-027B-487B-8E1A-31F2D26A1AFE} + EndGlobalSection +EndGlobal diff --git a/Src/Wasabi2/Wasabi2.vcxproj b/Src/Wasabi2/Wasabi2.vcxproj new file mode 100644 index 00000000..54e9c486 --- /dev/null +++ b/Src/Wasabi2/Wasabi2.vcxproj @@ -0,0 +1,290 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {4A907402-5983-4D6B-8D85-0F61C348319A} + replicantbridge + 10.0.19041.0 + + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + + + + + + + + + + + + + + + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + wasabi2 + .w5s + $(IncludePath) + $(LibraryPath) + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + wasabi2 + .w5s + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + wasabi2 + .w5s + $(IncludePath) + $(LibraryPath) + + + false + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + wasabi2 + .w5s + + + false + + + + + false + Debug + x86-windows-static-md + + + + + false + x86-windows-static-md + + + + + false + x86-windows-static-md + Debug + + + + + false + x86-windows-static-md + + + + Disabled + ../Wasabi;../replicant;%(AdditionalIncludeDirectories) + _UNICODE;UNICODE;WIN32;_DEBUG;_WINDOWS;_USRDLL;REPLICANTBRIDGE_EXPORTS;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + $(IntDir)$(TargetName).pdb + + + shlwapi.lib;nx.lib;nu.lib;metadata.lib;Wasabi-replicant.lib;%(AdditionalDependencies) + ..\replicant\replicant\metadata\$(PlatformShortName)_$(Configuration);..\replicant\Wasabi\$(PlatformShortName)_$(Configuration);..\replicant\nu\$(PlatformShortName)_$(Configuration);..\replicant\nx\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories) + $(OutDir)$(TargetName)$(TargetExt) + true + $(IntDir)$(TargetName).pdb + Windows + $(ProjectDir)x86_Debug\$(ProjectName).lib + MachineX86 + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + Disabled + ../Wasabi;../replicant;%(AdditionalIncludeDirectories) + _UNICODE;UNICODE;WIN64;_DEBUG;_WINDOWS;_USRDLL;REPLICANTBRIDGE_EXPORTS;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + false + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + ProgramDatabase + 4996;%(DisableSpecificWarnings) + $(IntDir)$(TargetName).pdb + + + shlwapi.lib;nx.lib;nu.lib;metadata.lib;Wasabi-replicant.lib;%(AdditionalDependencies) + ..\replicant\replicant\metadata\$(PlatformShortName)_$(Configuration);..\replicant\Wasabi\$(PlatformShortName)_$(Configuration);..\replicant\nu\$(PlatformShortName)_$(Configuration);..\replicant\nx\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories) + $(OutDir)$(TargetName)$(TargetExt) + true + $(IntDir)$(TargetName).pdb + Windows + $(ProjectDir)x64_Debug\$(ProjectName).lib + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + MinSpace + true + Size + ../Wasabi;../replicant;%(AdditionalIncludeDirectories) + _UNICODE;UNICODE;WIN32;NDEBUG;_WINDOWS;_USRDLL;REPLICANTBRIDGE_EXPORTS;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + None + 4996;%(DisableSpecificWarnings) + $(IntDir)$(TargetName).pdb + + + shlwapi.lib;nx.lib;nu.lib;metadata.lib;Wasabi-replicant.lib;%(AdditionalDependencies) + ..\replicant\replicant\metadata\$(PlatformShortName)_$(Configuration);..\replicant\Wasabi\$(PlatformShortName)_$(Configuration);..\replicant\nu\$(PlatformShortName)_$(Configuration);..\replicant\nx\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories) + $(OutDir)$(TargetName)$(TargetExt) + false + $(IntDir)$(TargetName).pdb + Windows + true + true + $(ProjectDir)x86_Release\$(ProjectName).lib + MachineX86 + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + MinSpace + true + Size + ../Wasabi;../replicant;%(AdditionalIncludeDirectories) + _UNICODE;UNICODE;WIN64;NDEBUG;_WINDOWS;_USRDLL;REPLICANTBRIDGE_EXPORTS;WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x601;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + Level3 + None + 4996;%(DisableSpecificWarnings) + $(IntDir)$(TargetName).pdb + + + shlwapi.lib;nx.lib;nu.lib;metadata.lib;Wasabi-replicant.lib;%(AdditionalDependencies) + ..\replicant\replicant\metadata\$(PlatformShortName)_$(Configuration);..\replicant\Wasabi\$(PlatformShortName)_$(Configuration);..\replicant\nu\$(PlatformShortName)_$(Configuration);..\replicant\nx\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories) + $(OutDir)$(TargetName)$(TargetExt) + false + $(IntDir)$(TargetName).pdb + Windows + true + true + $(ProjectDir)x64_Release\$(ProjectName).lib + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {f1f5cd60-0d5b-4cea-9eeb-2f87ff9aa915} + + + {57c90706-b25d-4aca-9b33-95cdb2427c27} + + + {3e0bfa8a-b86a-42e9-a33f-ec294f823f7f} + + + + + + \ No newline at end of file diff --git a/Src/Wasabi2/Wasabi2.vcxproj.filters b/Src/Wasabi2/Wasabi2.vcxproj.filters new file mode 100644 index 00000000..f89c6e32 --- /dev/null +++ b/Src/Wasabi2/Wasabi2.vcxproj.filters @@ -0,0 +1,80 @@ + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + {af591226-498a-4166-81a2-08747d2202aa} + + + {ed5c9f6a-50a2-4b6c-a6fc-450730ae8f29} + + + {1cd937f7-d0f2-448c-b53f-70843c5b8fda} + + + + + Ressource Files + + + \ No newline at end of file diff --git a/Src/Wasabi2/Winamp5ArtworkManager.cpp b/Src/Wasabi2/Winamp5ArtworkManager.cpp new file mode 100644 index 00000000..d0738af7 --- /dev/null +++ b/Src/Wasabi2/Winamp5ArtworkManager.cpp @@ -0,0 +1,48 @@ +#include "Winamp5ArtworkManager.h" +#include "api__wasabi2.h" +#include "metadata/MetadataKeys.h" +#include "nswasabi/ReferenceCounted.h" + +int Winamp5ArtworkManager::Artwork_GetArtwork(nx_uri_t filename, unsigned int field, artwork_t *artwork, data_flags_t flags, nx_time_unix_64_t *filename_modified) +{ + if (!AGAVE_API_ALBUMART) + return NErr_FailedCreate; + + if (field != MetadataKeys::ALBUM) + return NErr_Unknown; + + + if (filename_modified) + { + struct __stat64 buffer; + if (_wstat64(filename->string, &buffer) == 0) + { + *filename_modified = buffer.st_atime; + } + else + { + *filename_modified = 0; + } + } + + wchar_t *mime_type; + void *bits; + size_t len; + int ret = AGAVE_API_ALBUMART->GetAlbumArtData(filename->string, L"cover", &bits, &len, &mime_type); + if (ret != 0) + return NErr_Empty; + + NXDataCreate(&artwork->data, bits, len); + WASABI_API_MEMMGR->sysFree(bits); + + if (mime_type) + { + ReferenceCountedNXString mime_type_nx; + NXStringCreateWithUTF16(&mime_type_nx, mime_type); + NXDataSetMIME(artwork->data, mime_type_nx); + WASABI_API_MEMMGR->sysFree(mime_type); + } + artwork->height = 0; + artwork->width = 0; + return NErr_Success; +} diff --git a/Src/Wasabi2/Winamp5ArtworkManager.h b/Src/Wasabi2/Winamp5ArtworkManager.h new file mode 100644 index 00000000..9eed71f8 --- /dev/null +++ b/Src/Wasabi2/Winamp5ArtworkManager.h @@ -0,0 +1,17 @@ +#pragma once +#include "metadata/api_artwork.h" + +#include "nswasabi/ServiceName.h" +#include "nx/nx.h" + +class Winamp5ArtworkManager : public api_artwork +{ +public: + WASABI_SERVICE_NAME("Winamp5 Artwork Manager API"); + +private: + /* returns the data for the first piece of artwork found + pass NULL for any of the values that you don't care about */ + int WASABICALL Artwork_GetArtwork(nx_uri_t filename, unsigned int field, artwork_t *artwork, data_flags_t flags, nx_time_unix_64_t *filename_modified); + +}; diff --git a/Src/Wasabi2/api__wasabi2.cpp b/Src/Wasabi2/api__wasabi2.cpp new file mode 100644 index 00000000..c2f3a7e9 --- /dev/null +++ b/Src/Wasabi2/api__wasabi2.cpp @@ -0,0 +1,45 @@ +#include "Winamp5ArtworkManager.h" +#include "main.h" +#include "api__wasabi2.h" +#include "application.h" +#include +#include +#include +#include +#include + + +Application application; +static ComponentManager component_manager; + +static SingletonServiceFactory application_factory; +static SingletonService artwork_factory; + +static void AddComponents(const wchar_t *directory) +{ + nx_uri_t uri_directory; + if (NXURICreateWithUTF16(&uri_directory, directory) == NErr_Success) + { + component_manager.AddDirectory(uri_directory); + NXURIRelease(uri_directory); + } +} + +void Replicant_Initialize() +{ + application.Init(); + if (Wasabi_Init() == NErr_Success) + { + application_factory.Register(WASABI2_API_SVC, WASABI2_API_APP); + artwork_factory.Register(WASABI2_API_SVC); + component_manager.SetServiceAPI(WASABI2_API_SVC); + Replicant_Metadata_Initialize(WASABI2_API_SVC); + + wchar_t PROG_DIR[MAX_PATH] = {0}; + GetModuleFileName(0, PROG_DIR, MAX_PATH); + PathRemoveFileSpec(PROG_DIR); + PathAppend(PROG_DIR, L"Components"); + AddComponents(PROG_DIR); + component_manager.Load(); + } +} \ No newline at end of file diff --git a/Src/Wasabi2/api__wasabi2.h b/Src/Wasabi2/api__wasabi2.h new file mode 100644 index 00000000..1a174a51 --- /dev/null +++ b/Src/Wasabi2/api__wasabi2.h @@ -0,0 +1,29 @@ +#pragma once +#include + +#include "application.h" +extern Application application; +#define WASABI2_API_APP (&application) + +/* Wasabi 1 */ +namespace Wasabi { +#include +} +extern Wasabi::api_service *wasabi1_service_api; +#define WASABI_API_SVC wasabi1_service_api + +#include +namespace Wasabi { +#include +#include "../Agave/AlbumArt/api_albumart.h" + +#include +} +extern Wasabi::api_application *wasabi1_application_api; +#define WASABI_API_APP wasabi1_application_api + +extern Wasabi::api_albumart *wasabi1_albumart_api; +#define AGAVE_API_ALBUMART wasabi1_albumart_api + +extern Wasabi::api_memmgr *wasabi1_memmgr_api; +#define WASABI_API_MEMMGR wasabi1_memmgr_api \ No newline at end of file diff --git a/Src/Wasabi2/application.cpp b/Src/Wasabi2/application.cpp new file mode 100644 index 00000000..c33b2e7b --- /dev/null +++ b/Src/Wasabi2/application.cpp @@ -0,0 +1,94 @@ +#include +#include "main.h" +#include "api__wasabi2.h" +#include "application.h" +#include + +#include +#include +#include +#include +#include + + +Application::Application() +{ +// string_heap = 0; + user_agent[0]=0; + version_string=0; + build_number=0; +} + +Application::~Application() +{ + NXStringRelease(version_string); +} + +int Application::Init() +{ + int ret = ApplicationBase::Initialize(); + if (ret != NErr_Success) + return ret; +#if 0 + string_heap = HeapCreate(0, 0, 0); + if (!string_heap) + return INIT_ERROR_STRING_HEAP; + + ULONG argh = 2; + HeapSetInformation(string_heap, HeapCompatibilityInformation, &argh, sizeof(ULONG)); + + NXStringSetHeap(string_heap); + + +#endif +/* set the device id */ + GUID winamp_id; + WASABI_API_APP->GetUserID(&winamp_id); + ReferenceCountedNXString device_id; + NXStringCreateWithFormatting(&device_id, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + (int)winamp_id.Data1, (int)winamp_id.Data2, (int)winamp_id.Data3, (int)winamp_id.Data4[0], + (int)winamp_id.Data4[1], (int)winamp_id.Data4[2], (int)winamp_id.Data4[3], + (int)winamp_id.Data4[4], (int)winamp_id.Data4[5], (int)winamp_id.Data4[6], (int)winamp_id.Data4[7]); + + ApplicationBase::SetDeviceID(device_id); + + /* set the data path */ + const wchar_t *settings = WASABI_API_APP->path_getUserSettingsPath(); + ReferenceCountedNXURI settings_uri; + NXURICreateWithUTF16(&settings_uri, settings); + ApplicationBase::SetDataPath(settings_uri); + + build_number = WASABI_API_APP->main_getBuildNumber(); + const wchar_t *version_number_string = WASABI_API_APP->main_getVersionNumString(); + NXStringCreateWithUTF16(&version_string, version_number_string); + + OSVERSIONINFO info; + info.dwOSVersionInfoSize=sizeof(info); + GetVersionExW(&info); + StringCbPrintfA(user_agent, sizeof(user_agent), "Winamp/%S (Windows NT %u.%u) Replicant/%s", WASABI_API_APP->main_getVersionNumString(), info.dwMajorVersion, info.dwMinorVersion, replicant_version); + ApplicationBase::EnableAllPermissions(); + return NErr_Success; +} + + + +const char *Application::Application_GetUserAgent() +{ + return user_agent; +} + +unsigned int Application::Application_GetBuildNumber() +{ + return build_number; +} + +int Application::Application_GetVersionString(nx_string_t *version) +{ + *version = NXStringRetain(version_string); + return NErr_Success; +} + +int Application::Application_GetProductShortName(nx_string_t *name) +{ + return NXStringCreateWithUTF8(name, "Winamp"); +} \ No newline at end of file diff --git a/Src/Wasabi2/application.h b/Src/Wasabi2/application.h new file mode 100644 index 00000000..61a9d90b --- /dev/null +++ b/Src/Wasabi2/application.h @@ -0,0 +1,33 @@ +#pragma once +#include +#include +#include +#include +class Application : public ApplicationBase +{ +public: + enum + { + INIT_ERROR_STRING_HEAP=1, + }; + WASABI_SERVICE_NAME("Replicant/Winamp5 Application API"); + + Application(); + ~Application(); + int Init(); + + /* api_application implementation */ + //HANDLE WASABICALL Application_GetStringHeap(); + const char * Application_GetUserAgent(); + unsigned int Application_GetBuildNumber(); + int Application_GetVersionString(nx_string_t *version); + int Application_GetProductShortName(nx_string_t *name); + +private: + //HANDLE string_heap; + char user_agent[256]; + nx_string_t version_string; + unsigned int build_number; +}; + +extern Application application; \ No newline at end of file diff --git a/Src/Wasabi2/main.cpp b/Src/Wasabi2/main.cpp new file mode 100644 index 00000000..f9a8396e --- /dev/null +++ b/Src/Wasabi2/main.cpp @@ -0,0 +1,77 @@ +#include "api__wasabi2.h" +#include "wasabi1_factory.h" +namespace Wasabi { +#include "../Agave/Component/ifc_wa5component.h" +} + +static Wasabi2ServiceFactory wasabi2_service_factory; // we're going to sneak the Wasabi 2 Service Manager into the Wasabi 1 Service Manager + +void Replicant_Initialize(); +void Wasabi1_Initialize(Wasabi::api_service *svc_api); +void Wasabi1_Quit(); + +class ReplicantComponent : public Wasabi::ifc_wa5component +{ +public: + void RegisterServices(Wasabi::api_service *service); + int RegisterServicesSafeModeOk(); + void DeregisterServices(Wasabi::api_service *service); +protected: + RECVS_DISPATCH; +}; + +template +void ServiceBuild(api_T *&api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC) + { + waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + api_t = reinterpret_cast( factory->getInterface() ); + } +} + +template +void ServiceRelease(api_T *api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC &7 api_t) + { + waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + factory->releaseInterface(api_t); + } + api_t = NULL; +} + +void ReplicantComponent::RegisterServices(Wasabi::api_service *service) +{ + Wasabi1_Initialize(service); + Replicant_Initialize(); + WASABI_API_SVC->service_register(&wasabi2_service_factory); +} + +int ReplicantComponent::RegisterServicesSafeModeOk() +{ + return 1; +} + +void ReplicantComponent::DeregisterServices(Wasabi::api_service *service) +{ + WASABI_API_SVC->service_deregister(&wasabi2_service_factory); + Wasabi1_Quit(); +} + +static ReplicantComponent component; + +extern "C" __declspec(dllexport) Wasabi::ifc_wa5component *GetWinamp5SystemComponent() +{ + return &component; +} + +#define CBCLASS ReplicantComponent +START_DISPATCH; +VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices) +CB(15, RegisterServicesSafeModeOk) +VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices) +END_DISPATCH; +#undef CBCLASS \ No newline at end of file diff --git a/Src/Wasabi2/main.h b/Src/Wasabi2/main.h new file mode 100644 index 00000000..d10200f2 --- /dev/null +++ b/Src/Wasabi2/main.h @@ -0,0 +1,5 @@ +#pragma once +#include "nx/nxuri.h" +#include "foundation/error.h" + +int NXURICreateWithUTF16(nx_uri_t *out, const wchar_t *utf16); diff --git a/Src/Wasabi2/resource.h b/Src/Wasabi2/resource.h new file mode 100644 index 00000000..468dc1a6 --- /dev/null +++ b/Src/Wasabi2/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Wasabi2.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Wasabi2/utilities.cpp b/Src/Wasabi2/utilities.cpp new file mode 100644 index 00000000..c40662b9 --- /dev/null +++ b/Src/Wasabi2/utilities.cpp @@ -0,0 +1,19 @@ +#include "main.h" + +int NXURICreateWithUTF16(nx_uri_t *out, const wchar_t *utf16) +{ + nx_string_t nx_filename = 0; + nx_uri_t uri_filename = 0; + + int ret = NXStringCreateWithUTF16(&nx_filename, utf16); + if (ret != NErr_Success) + return ret; + + ret = NXURICreateWithNXString(&uri_filename, nx_filename); + NXStringRelease(nx_filename); + if (ret != NErr_Success) + return ret; + + *out = uri_filename; + return NErr_Success; +} \ No newline at end of file diff --git a/Src/Wasabi2/version.rc2 b/Src/Wasabi2/version.rc2 new file mode 100644 index 00000000..f6b6766a --- /dev/null +++ b/Src/Wasabi2/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION WINAMP_PRODUCTVER + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp 5.x System Component" + VALUE "FileVersion", STR_WINAMP_PRODUCTVER + VALUE "InternalName", "wasabi2.w5s" + VALUE "LegalCopyright", "Copyright © 2012-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "wasabi2.w5s" + VALUE "ProductName", "Winamp Wasabi v2 Services Loader" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Src/Wasabi2/wasabi1_factory.cpp b/Src/Wasabi2/wasabi1_factory.cpp new file mode 100644 index 00000000..6d9149e8 --- /dev/null +++ b/Src/Wasabi2/wasabi1_factory.cpp @@ -0,0 +1,62 @@ +#include "api__wasabi2.h" +#include "wasabi1_factory.h" + + +static const char serviceName[] = "Wasabi 2 Service API"; + +FOURCC Wasabi2ServiceFactory::GetServiceType() +{ + return Wasabi::WaSvc::UNIQUE; +} + +const char *Wasabi2ServiceFactory::GetServiceName() +{ + return serviceName; +} + +GUID Wasabi2ServiceFactory::GetGUID() +{ + return api_service::GetServiceGUID(); +} + +void *Wasabi2ServiceFactory::GetInterface(int global_lock) +{ + return (api_service *)WASABI2_API_SVC; + +} + +int Wasabi2ServiceFactory::SupportNonLockingInterface() +{ + return 1; +} + +int Wasabi2ServiceFactory::ReleaseInterface(void *ifc) +{ + return 1; +} + +const char *Wasabi2ServiceFactory::GetTestString() +{ + return NULL; +} + +int Wasabi2ServiceFactory::ServiceNotify(int msg, int param1, int param2) +{ + return 1; +} + +#ifdef CBCLASS +#undef CBCLASS +#endif + +#define CBCLASS Wasabi2ServiceFactory +START_DISPATCH; +CB(WASERVICEFACTORY_GETSERVICETYPE, GetServiceType) +CB(WASERVICEFACTORY_GETSERVICENAME, GetServiceName) +CB(WASERVICEFACTORY_GETGUID, GetGUID) +CB(WASERVICEFACTORY_GETINTERFACE, GetInterface) +CB(WASERVICEFACTORY_SUPPORTNONLOCKINGGETINTERFACE, SupportNonLockingInterface) +CB(WASERVICEFACTORY_RELEASEINTERFACE, ReleaseInterface) +CB(WASERVICEFACTORY_GETTESTSTRING, GetTestString) +CB(WASERVICEFACTORY_SERVICENOTIFY, ServiceNotify) +END_DISPATCH; diff --git a/Src/Wasabi2/wasabi1_factory.h b/Src/Wasabi2/wasabi1_factory.h new file mode 100644 index 00000000..5cbe4e2d --- /dev/null +++ b/Src/Wasabi2/wasabi1_factory.h @@ -0,0 +1,21 @@ +#pragma once +namespace Wasabi { +#include +#include +} + +class Wasabi2ServiceFactory : public Wasabi::waServiceFactory +{ +public: + FOURCC GetServiceType(); + const char *GetServiceName(); + GUID GetGUID(); + void *GetInterface(int global_lock); + int SupportNonLockingInterface(); + int ReleaseInterface(void *ifc); + const char *GetTestString(); + int ServiceNotify(int msg, int param1, int param2); + +protected: + RECVS_DISPATCH; +}; -- cgit