latest SDK
This commit is contained in:
123
foobar2000/foobar2000_component_client/component_client.cpp
Normal file
123
foobar2000/foobar2000_component_client/component_client.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
#include "../SDK/foobar2000.h"
|
||||
#include "../SDK/component.h"
|
||||
|
||||
static HINSTANCE g_hIns;
|
||||
|
||||
static pfc::string_simple g_name,g_full_path;
|
||||
|
||||
static bool g_services_available = false, g_initialized = false;
|
||||
|
||||
|
||||
|
||||
namespace core_api
|
||||
{
|
||||
|
||||
HINSTANCE get_my_instance()
|
||||
{
|
||||
return g_hIns;
|
||||
}
|
||||
|
||||
HWND get_main_window()
|
||||
{
|
||||
PFC_ASSERT( g_foobar2000_api != NULL );
|
||||
return g_foobar2000_api->get_main_window();
|
||||
}
|
||||
const char* get_my_file_name()
|
||||
{
|
||||
return g_name;
|
||||
}
|
||||
|
||||
const char* get_my_full_path()
|
||||
{
|
||||
return g_full_path;
|
||||
}
|
||||
|
||||
bool are_services_available()
|
||||
{
|
||||
return g_services_available;
|
||||
}
|
||||
bool assert_main_thread()
|
||||
{
|
||||
return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->assert_main_thread() : true;
|
||||
}
|
||||
|
||||
void ensure_main_thread() {
|
||||
if (!is_main_thread()) uBugCheck();
|
||||
}
|
||||
|
||||
bool is_main_thread()
|
||||
{
|
||||
return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_main_thread() : true;
|
||||
}
|
||||
const char* get_profile_path()
|
||||
{
|
||||
PFC_ASSERT( g_foobar2000_api != NULL );
|
||||
return g_foobar2000_api->get_profile_path();
|
||||
}
|
||||
|
||||
bool is_shutting_down()
|
||||
{
|
||||
return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_shutting_down() : g_initialized;
|
||||
}
|
||||
bool is_initializing()
|
||||
{
|
||||
return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_initializing() : !g_initialized;
|
||||
}
|
||||
bool is_portable_mode_enabled() {
|
||||
PFC_ASSERT( g_foobar2000_api != NULL );
|
||||
return g_foobar2000_api->is_portable_mode_enabled();
|
||||
}
|
||||
|
||||
bool is_quiet_mode_enabled() {
|
||||
PFC_ASSERT( g_foobar2000_api != NULL );
|
||||
return g_foobar2000_api->is_quiet_mode_enabled();
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
class foobar2000_client_impl : public foobar2000_client, private foobar2000_component_globals
|
||||
{
|
||||
public:
|
||||
t_uint32 get_version() {return FOOBAR2000_CLIENT_VERSION;}
|
||||
pservice_factory_base get_service_list() {return service_factory_base::__internal__list;}
|
||||
|
||||
void get_config(stream_writer * p_stream,abort_callback & p_abort) {
|
||||
cfg_var::config_write_file(p_stream,p_abort);
|
||||
}
|
||||
|
||||
void set_config(stream_reader * p_stream,abort_callback & p_abort) {
|
||||
cfg_var::config_read_file(p_stream,p_abort);
|
||||
}
|
||||
|
||||
void set_library_path(const char * path,const char * name) {
|
||||
g_full_path = path;
|
||||
g_name = name;
|
||||
}
|
||||
|
||||
void services_init(bool val) {
|
||||
if (val) g_initialized = true;
|
||||
g_services_available = val;
|
||||
}
|
||||
|
||||
bool is_debug() {
|
||||
#ifdef _DEBUG
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static foobar2000_client_impl g_client;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
__declspec(dllexport) foobar2000_client * _cdecl foobar2000_get_interface(foobar2000_api * p_api,HINSTANCE hIns)
|
||||
{
|
||||
g_hIns = hIns;
|
||||
g_foobar2000_api = p_api;
|
||||
|
||||
return &g_client;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?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="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{71AD2674-065B-48F5-B8B0-E1F9D3892081}</ProjectGuid>
|
||||
<RootNamespace>foobar2000_component_client</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</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)'=='Debug|Win32'" 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>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<TreatSpecificWarningsAsErrors>4715</TreatSpecificWarningsAsErrors>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<StringPooling>true</StringPooling>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<AdditionalOptions>/d2notypeopt %(AdditionalOptions)</AdditionalOptions>
|
||||
<TreatSpecificWarningsAsErrors>4715</TreatSpecificWarningsAsErrors>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="component_client.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user