Initial community commit

This commit is contained in:
Jef 2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit fc06254474
16440 changed files with 4239995 additions and 2 deletions

View file

@ -0,0 +1,38 @@
#ifndef NULLSOFT_API_H
#define NULLSOFT_API_H
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#include <wtypes.h>
#include <api/service/api_service.h>
extern api_service *serviceManager;
#define WASABI_API_SVC serviceManager
#include <api/application/api_application.h>
#define WASABI_API_APP applicationApi
#include <api/service/waServiceFactory.h>
#include "../Agave/Config/api_config.h"
extern api_config *configApi;
#define AGAVE_API_CONFIG configApi
#include "../Agave/Language/api_language.h"
#include "../Winamp/api_stats.h"
extern api_stats *statsApi;
#define AGAVE_API_STATS statsApi
#include "../playlist/api_playlistmanager.h"
extern api_playlistmanager *playlistManagerApi;
#define AGAVE_API_PLAYLISTMANAGER playlistManagerApi
HRESULT WasabiApi_Initialize(HINSTANCE hInstance, api_service *serviceApi);
HRESULT WasabiApi_LoadDefaults();
ULONG WasabiApi_AddRef(void);
ULONG WasabiApi_Release(void);
#endif

View file

@ -0,0 +1,69 @@
#include "main.h"
#include "../Winamp/wa_ipc.h"
#include "resource.h"
#include "api.h"
#include "../nu/AutoWide.h"
#include "../nu/AutoChar.h"
#include <strsafe.h>
#include "..\..\General\gen_ml\menu.h"
#include "..\..\General\gen_ml\ml_ipc_0313.h"
#define PLUGIN_VERSION L"1.1"
int Init();
void Quit();
UINT_PTR xmlex_treeItem = 0;
api_service *serviceManager = 0;
EXTERN_C winampMediaLibraryPlugin plugin =
{
MLHDR_VER,
"Nullsoft XML Reader",
Init,
Quit,
xmlex_pluginMessageProc,
0,
0,
0,
};
int Init()
{
//starting point for wasabi, where services are shared
WASABI_API_SVC = (api_service *)SendMessage(plugin.hwndWinampParent, WM_WA_IPC, 0, IPC_GET_API_SERVICE);
// waServiceFactory *sf = plugin.service->service_getServiceByGuid(languageApiGUID);
// if (sf) WASABI_API_LNG = reinterpret_cast<api_language*>(sf->getInterface());
// wasabi based services for localisation support
// api_language* WASABI_API_LNG = 0;
// HINSTANCE WASABI_API_LNG_HINST = 0, WASABI_API_ORIG_HINST = 0;
// need to have this initialised before we try to do anything with localisation features
// WASABI_API_START_LANG(plugin.hDllInstance,MlImpexLangGUID);
// static wchar_t szDescription[256];
// StringCchPrintf(szDescription, ARRAYSIZE(szDescription),
// WASABI_API_LNGSTRINGW(IDS_NULLSOFT_XMLEX), PLUGIN_VERSION);
// plugin.description = (char*)szDescription;
//set up tree item, gen_ml will call xmlex_pluginMessageProc if/when the treeview item gets selected
MLTREEITEMW newTree;
newTree.size = sizeof(MLTREEITEMW);
newTree.parentId = 0;
newTree.title = L"XML Example";
newTree.hasChildren = 0;
newTree.id = 0;
SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM) &newTree, ML_IPC_TREEITEM_ADDW);
xmlex_treeItem = newTree.id;
return 0; // 0 for success. returning non-zero will cause gen_ml to abort loading your plugin
}
void Quit()
{
}
extern "C" __declspec(dllexport) winampMediaLibraryPlugin *winampGetMediaLibraryPlugin()
{
return &plugin;
}

View file

@ -0,0 +1,13 @@
#ifndef _XMLEX_MAIN_H_
#define _XMLEX_MAIN_H_
#include <windows.h>
#include <windowsx.h>
#include "../nu/MediaLibraryInterface.h"
#include "..\..\General\gen_ml\ml.h"
#include "..\..\General\gen_ml\config.h"
extern winampMediaLibraryPlugin plugin;
INT_PTR xmlex_pluginMessageProc(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3);
extern UINT_PTR xmlex_treeItem;
#endif

View file

@ -0,0 +1,108 @@
// 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
#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
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_VIEW_XMLEX DIALOGEX 0, 0, 215, 120
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_TABSTOP,0,0,
214,103
CONTROL "Load XML File",IDC_LOAD,"Button",BS_OWNERDRAW |
WS_TABSTOP,0,106,50,11
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_VIEW_XMLEX, DIALOG
BEGIN
RIGHTMARGIN, 214
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_NULLSOFT_XMLEX "Nullsoft XML Reader"
65535 "{1A710E67-5180-49ac-8102-105856ED0A2F}"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "version.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32802.440
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ml_xmlex", "ml_xmlex.vcxproj", "{BB556FAF-21F5-418E-9BDE-1F9EFF4AA042}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BB556FAF-21F5-418E-9BDE-1F9EFF4AA042}.Debug|x86.ActiveCfg = Debug|Win32
{BB556FAF-21F5-418E-9BDE-1F9EFF4AA042}.Debug|x86.Build.0 = Debug|Win32
{BB556FAF-21F5-418E-9BDE-1F9EFF4AA042}.Release|x86.ActiveCfg = Release|Win32
{BB556FAF-21F5-418E-9BDE-1F9EFF4AA042}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BE4BA4B4-72CA-4EA3-A44E-C3B01B5DE34F}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BB556FAF-21F5-418E-9BDE-1F9EFF4AA042}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>16.0.32629.160</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<OutDir>$(PlatformShortName)_$(Configuration)\</OutDir>
<IntDir>$(PlatformShortName)_$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnabled>false</VcpkgEnabled>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<VcpkgConfiguration>Debug</VcpkgConfiguration>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..;..\..\..\wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..;..\..\..\wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\..;..\..\..\wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\..;..\..\..\wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>true</BufferSecurityCheck>
<FunctionLevelLinking>true</FunctionLevelLinking>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>None</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="xmlview.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="api.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ml_xmlex.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Wasabi\Wasabi.vcxproj">
<Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="xmlview.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="api.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ml_xmlex.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,13 @@
ml_xmlex.dll - Readme
This is an example of implementation of Winamp's built in XML parser. Please make note that Winamp's XML service will parse all syntactically correct xml.
XML file form for this plugin is exemplified in xmltest.xml, which is provided with the source for this plugin.
XML files should be in the format of
<Library>
<Song Filename="" Artist="" Title="" /> (or)
<Song Filename="" Artist"" Title=""></Song>
</Library>
with the extension .xml for this plugin to read it correctly.

View file

@ -0,0 +1,22 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ml_xmlex.rc
//
#define IDS_NULLSOFT_XMLEX_OLD 0
#define IDD_VIEW_XMLEX 101
#define IDC_LIST 1001
#define IDC_BUTTON1 1002
#define IDC_LOAD 1003
#define IDS_NULLSOFT_XMLEX 65534
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View file

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#include "..\..\..\Winamp\buildType.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
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 Media Library Plug-in"
VALUE "FileVersion", "1,0,0,1"
VALUE "InternalName", "Nullsoft XML Playlist Loader"
VALUE "LegalCopyright", "Copyright © 2003-2023 Winamp SA"
VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA"
VALUE "OriginalFilename", "ml_xmlex.dll"
VALUE "ProductName", "Winamp"
VALUE "ProductVersion", STR_WINAMP_PRODUCTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View file

@ -0,0 +1,8 @@
<!-- all valid versions of this in xml will work, however, filename, artist, and title must all be attributes of Song -->
<Library>
<Song Filename="C:\Music\artist - title.mp3" Artist="artist1" Title="title1"/>
<Song Filename="C:\Music\artist2 - title2.wma" Artist="artist2" Title="title2"></Song>
<Song Title="title3" Filename="C:\Music\artist3 - title3.mp3" Artist="artist3"/>
<Song Filename="C:\Music\artist4 - title4.ogg" Title="title4" Artist="artist4"/>
<Song Filename="C:\Music\artist5 - title5.aac" Artist="artist5" Title="title5"/>
</Library>

View file

@ -0,0 +1,7 @@
<Library>
<Song Filename="C:\Music\artist1 - title1.mp3" Artist="artist" Title="title"/>
<Song Filename="C:\Music\artist2 - title2.wma" Artist="artist2" Title="title2"/>
<Song Filename="C:\Music\artist3 - title3.mp3" Artist="artist3" Title="title3"/>
<Song Filename="C:\Music\artist4 - title4.ogg" Artist="artist4" Title="title4"/>
<Song Filename="C:\Music\artist5 - title5.aac" Artist="artist5" Title="title5"/>
</Library>

View file

@ -0,0 +1,301 @@
#include "main.h"
#include <bfc/dispatch.h>
#include <windowsx.h>
#include "shlobj.h"
#include "..\..\General\gen_ml\ml_ipc_0313.h"
#include "..\..\General\gen_ml\childwnd.h"
#include "../Winamp/wa_dlg.h"
#include "../xml/ifc_xmlreadercallback.h"
#include "../xml/obj_xml.h"
#include <api/service/waServiceFactory.h>
#include "resource.h"
#include "api.h"
typedef void (*ChildResizeFunc)(HWND, ChildWndResizeItem*, int);
static ChildResizeFunc ml_childresize_init=0, ml_childresize_resize=0;
typedef int (*HookDialogFunc)(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
static HookDialogFunc ml_hook_dialog_msg = 0;
typedef void (*DrawFunc)(HWND hwndDlg, int *tab, int tabsize);
static DrawFunc ml_draw = 0;
LRESULT CALLBACK view_xmlexDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam);
static HWND m_hwnd;
static ChildWndResizeItem xmlwnd_rlist[]={
{IDC_LIST,0x0011},
{IDC_LOAD,0x0101},
};
//--------------------------
class ListXMLLoader : public ifc_xmlreadercallback
{
public:
ListXMLLoader(HWND _hwndList) : hwndList(_hwndList), index(0) {}
void loadSongFromXml(const wchar_t* filename, const wchar_t* artist, const wchar_t* title)
{
LVITEM lvi = {0, };
lvi.mask = LVIF_TEXT;
lvi.iItem = index;
lvi.pszText = (LPTSTR)filename;
lvi.cchTextMax = lstrlenW(filename);
SendMessage(hwndList, LVM_INSERTITEMW, 0, (LPARAM)&lvi);
lvi.iSubItem = 1;
lvi.pszText = (LPTSTR)artist;
lvi.cchTextMax = lstrlenW(artist);
SendMessageW(hwndList, LVM_SETITEMW, 0, (LPARAM)&lvi);
lvi.iSubItem = 2;
lvi.pszText = (LPTSTR)title;
lvi.cchTextMax = lstrlenW(title);
SendMessageW(hwndList, LVM_SETITEMW, 0, (LPARAM)&lvi);
index++;
}
void reset()
{
ListView_DeleteAllItems(hwndList);
index = 0;
}
void loadXML(wchar_t []);
/* XML loader callback */
void StartTag(const wchar_t *xmlpath, const wchar_t *xmltag, ifc_xmlreaderparams *params)
{
//read subtags of LIBRARY
if(!wcsicmp(xmlpath, L"LIBRARY\fSONG"))
{
//getItemValue() will return the value for an attribute
loadSongFromXml(params->getItemValue(L"FILENAME"), params->getItemValue(L"ARTIST"),params->getItemValue(L"TITLE"));
}
}
private:
HWND hwndList;
int index;
protected: // this is a Wasabi object, so we need to declare a dispatch table
RECVS_DISPATCH;
};
/* Dispatch table for a Wasabi object */
#define CBCLASS ListXMLLoader
START_DISPATCH;
VCB(ONSTARTELEMENT, StartTag)
END_DISPATCH;
#undef CBCLASS
/* helper function for ListXMLLoader::loadXML */
static bool LoadFile(obj_xml *parser, const wchar_t *filename)
{
HANDLE file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
if (file == INVALID_HANDLE_VALUE)
return false;
char data[1024];
DWORD bytesRead;
while (true)
{
if (ReadFile(file, data, 1024, &bytesRead, NULL) && bytesRead)
{
parser->xmlreader_feed(data, bytesRead);
}
else
break;
}
CloseHandle(file);
parser->xmlreader_feed(0, 0);
return true;
}
void ListXMLLoader::loadXML(wchar_t xmlfile[MAX_PATH] = L"xmltest.xml")
{
// reset the listview state
reset();
// get an XML parser object from the service manager
obj_xml *parser=0;
waServiceFactory *parserFactory = WASABI_API_SVC->service_getServiceByGuid(obj_xmlGUID);
if (parserFactory)
parser = (obj_xml *)parserFactory->getInterface();
if (parser)
{
//set up a tag that we can read
//within StartTag(), we can read all subtags of this tag
parser->xmlreader_registerCallback(L"LIBRARY\f*", this);
parser->xmlreader_open();
LoadFile(parser, xmlfile);
parser->xmlreader_unregisterCallback(this);
parser->xmlreader_close();
parserFactory->releaseInterface(parser);
}
}
//--------------------------
/* This function gets called directly from gen_ml when it wants our plugin to do something
we're only handling dialog creation, but there are lots of other messages a full-featured
plugin would deal with */
INT_PTR xmlex_pluginMessageProc(int message_type, INT_PTR param1, INT_PTR param2, INT_PTR param3)
{
if (message_type == ML_MSG_TREE_ONCREATEVIEW && param1 == xmlex_treeItem)
{
return (INT_PTR)CreateDialog(plugin.hDllInstance, MAKEINTRESOURCE(IDD_VIEW_XMLEX), (HWND)(LONG_PTR)param2, (DLGPROC)view_xmlexDialogProc);
}
return 0;
}
static BOOL xmlex_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
/* gen_ml has some helper functions to deal with skinned dialogs,
we're going to grab their function pointers.
for definition of magic numbers, see gen_ml/ml.h */
if (!ml_childresize_init)
{
/* skinning helper functions */
ml_hook_dialog_msg = (HookDialogFunc)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM)2, ML_IPC_SKIN_WADLG_GETFUNC);
ml_draw = (DrawFunc)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM)3, ML_IPC_SKIN_WADLG_GETFUNC);
/* resizing helper functions */
ml_childresize_init = (ChildResizeFunc)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM)32, ML_IPC_SKIN_WADLG_GETFUNC);
ml_childresize_resize = (ChildResizeFunc)SendMessage(plugin.hwndLibraryParent, WM_ML_IPC, (WPARAM)33, ML_IPC_SKIN_WADLG_GETFUNC);
}
m_hwnd=hwnd;
HWND listWnd = GetDlgItem(hwnd,IDC_LIST);
/* add listview columns */
LVCOLUMN lvc = {0, };
lvc.mask = LVCF_TEXT | LVCF_WIDTH;
lvc.pszText = (LPTSTR)L"Filename";
lvc.cx = 250;
SendMessageW(listWnd, LVM_INSERTCOLUMNW, (WPARAM)0, (LPARAM)&lvc);
lvc.pszText = (LPTSTR)L"Artist";
lvc.cx = 150;
SendMessageW(listWnd, LVM_INSERTCOLUMNW, (WPARAM)1, (LPARAM)&lvc);
lvc.pszText = (LPTSTR)L"Title";
lvc.cx = 150;
SendMessageW(listWnd, LVM_INSERTCOLUMNW, (WPARAM)2, (LPARAM)&lvc);
/* skin dialog */
MLSKINWINDOW sw;
sw.skinType = SKINNEDWND_TYPE_DIALOG;
sw.style = SWS_USESKINCOLORS | SWS_USESKINCURSORS | SWS_USESKINFONT;
sw.hwndToSkin = hwnd;
MLSkinWindow(plugin.hwndLibraryParent, &sw);
/* skin listview */
sw.hwndToSkin = listWnd;
sw.skinType = SKINNEDWND_TYPE_LISTVIEW;
sw.style = SWLVS_FULLROWSELECT | SWLVS_DOUBLEBUFFER | SWS_USESKINFONT | SWS_USESKINCOLORS | SWS_USESKINCURSORS;
MLSkinWindow(plugin.hwndLibraryParent, &sw);
/* skin button */
sw.skinType = SKINNEDWND_TYPE_BUTTON;
sw.style = SWS_USESKINCOLORS | SWS_USESKINCURSORS | SWS_USESKINFONT;
sw.hwndToSkin = GetDlgItem(hwnd, IDC_LOAD);
MLSkinWindow(plugin.hwndLibraryParent, &sw);
ml_childresize_init(hwnd, xmlwnd_rlist, sizeof(xmlwnd_rlist) / sizeof(xmlwnd_rlist[0]));
//all other initialization is done. lets wait 20ms before we actually do anything with this plugin
//this way other (more important) things finish before this does
SetTimer(hwnd,101,20,NULL);
return FALSE;
}
static BOOL xmlex_OnSize(HWND hwnd, UINT state, int cx, int cy)
{
if (state != SIZE_MINIMIZED)
ml_childresize_resize(hwnd, xmlwnd_rlist, sizeof(xmlwnd_rlist) / sizeof(xmlwnd_rlist[0]));
return FALSE;
}
static BOOL xmlex_OnDestroy(HWND hwnd)
{
m_hwnd=0;
return FALSE;
}
static void xmlex_OnTimer(HWND hwnd, UINT id)
{
if (id == 101)
{
KillTimer(hwnd,101);
// populate list with default local file, no pre-loaded xml file if not in working dir (really will only pre-load something in debug mode)
ListXMLLoader loader(GetDlgItem(hwnd, IDC_LIST));
loader.loadXML();
}
}
static BOOL xmlex_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
switch(id) {
case IDC_LOAD:
{
wchar_t filename[256] = L"";
//browse box supported in windows 2000+
//if this doesnt work for you (old versions of windows) just know that the file name is set in ofn.lpstrFile which is then moved to filename variable
OPENFILENAME ofn = {0};
ofn.lStructSize = sizeof (OPENFILENAME);
ofn.hwndOwner=hwnd;
ofn.lpstrFilter=L"XML Files (*.xml)\0*.XML\0\0";
ofn.lpstrCustomFilter=NULL;
ofn.nFilterIndex=1;
ofn.lpstrFile=filename; //contains file name after user has selected it
ofn.nMaxFile=MAX_PATH;
ofn.lpstrFileTitle=NULL;
ofn.lpstrInitialDir=NULL;
ofn.Flags=OFN_PATHMUSTEXIST;
GetOpenFileName(&ofn);
if(*filename) //do not load on browse -> cancel
{
ListXMLLoader loader(GetDlgItem(hwnd, IDC_LIST));
loader.loadXML(filename);
}
}
break;
}
return 0;
}
LRESULT CALLBACK view_xmlexDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam)
{
/* first, ask the dialog skinning system if it wants to do anything with the message
the function pointer gets set during WM_INITDIALOG so might be NULL for the first few messages
in theory we could grab it right here if we don't have it, but it's not necessary
and I wanted to put all the function pointer gathering code in the same place for this example */
if (ml_hook_dialog_msg)
{
INT_PTR a = ml_hook_dialog_msg(hwndDlg, uMsg, wParam, lParam);
if (a)
return a;
}
switch(uMsg) {
HANDLE_MSG(hwndDlg, WM_INITDIALOG, xmlex_OnInitDialog);
HANDLE_MSG(hwndDlg, WM_TIMER, xmlex_OnTimer);
HANDLE_MSG(hwndDlg, WM_COMMAND, xmlex_OnCommand);
HANDLE_MSG(hwndDlg, WM_SIZE, xmlex_OnSize);
case WM_PAINT:
{
int tab[] = { IDC_LIST|DCW_SUNKENBORDER};
ml_draw(hwndDlg, tab, sizeof(tab) / sizeof(tab[0]));
}
return 0;
HANDLE_MSG(hwndDlg, WM_DESTROY, xmlex_OnDestroy);
}
return FALSE;
}