Skip to content

Commit

Permalink
UNICODE, libcef emulate function
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpond committed Jan 23, 2023
1 parent 54f6717 commit c73981d
Show file tree
Hide file tree
Showing 20 changed files with 11,996 additions and 255 deletions.
72 changes: 8 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,18 @@
[![Build status](https://ci.appveyor.com/api/projects/status/31l6ynm0a1fhr2vs/branch/master?svg=true)](https://ci.appveyor.com/project/mrpond/blockthespot/branch/master) [![Discord](https://discord.com/api/guilds/807273906872123412/widget.png)](https://discord.gg/p43cusgUPm)

<center>
<h2 align="center"> IMPORTANT ANNOUNCEMENT </h2>
<p align="center">BlockTheSpot is reaching its end of life. Meaning that when the next major Spotify update breaks this patch, it wont be supported anymore. After this day, this repository will be a public archive. <strong>But it's not the end.</strong> We are moving to <a href="https://github.com/spotx-cli">SpotX</a>. For more info, join our Discord.</p>
</center>

<center>
<h1 align="center">BlockTheSpot</h1>
<h4 align="center">A multi-purpose adblocker and skip-bypass for the <strong>Windows</strong> Spotify desktop application.</h4>
<h5 align="center">Please support Spotify by purchasing premium</h5>
<p align="center">
<strong>Last updated:</strong> 3 December 2022 <br>
<strong>Last tested version:</strong> 1.1.99.878.g1e4ccc6e
</p>
</center>
## IMPORTANT ANNOUNCEMENT

#### Just run simple.bat if you lazy to read things.
BlockTheSpot is no longer support.

#### Important checks before installing:
Next major Spotify update may breaks this, Since I don't had time.

0. Update Windows, update Spotify and update BlockTheSpot
1. Go to "Windows Security" -> "Virus & Threat Protection"
2. Click "Allowed threats" -> "Remove all allowed threats"
3. Autoinstaller requirements can be found [here](https://github.com/amd64fox/SpotX#system-requirements)
Considered check alternative https://github.com/spotx-cli

### Features:
BlockTheSpot

- Blocks all banner/video/audio ads within the app
- Retains friend, vertical video and radio functionality
- Unlocks the skip function for any track
- Addtional features unlocked by [SpotX](https://github.com/amd64fox/SpotX#features)
A multi-purpose adblocker and skip-bypass for the Windows Spotify desktop application

:warning: This mod is for the [**Desktop Application**](https://www.spotify.com/download/windows/) of Spotify on Windows only and **not the Microsoft Store version**.
Please support Spotify by purchasing premium

### Installation/Update:

- Just download and run [SpotX](https://raw.githack.com/mrpond/BlockTheSpot/master/SpotXBasic.bat)

or

#### Fully automated installation via PowerShell

- Run The following command in PowerShell:

```ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex "& { $((iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content) } -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_on -cache_off -block_update_off -exp_standart -hide_col_icon_off -start_spoti"
```

- Checkout [SpotX Repo](https://github.com/amd64fox/SpotX) for more options and features.

#### Manual installation

1. Browse to your Spotify installation folder `%APPDATA%\Spotify`
2. Download `chrome_elf.zip` from [releases](https://github.com/mrpond/BlockTheSpot/releases)
3. Unzip `dpapi.dll` and `config.ini` to Spotify directory.

### Uninstall:

- Just run [uninstall.bat](https://raw.githack.com/mrpond/BlockTheSpot/master/Uninstall.bat)
or
- Reinstall Spotify

### Additional Notes:

- "dpapi.dll" may gets removed by the Spotify installer each time it updates, hence why you'll probably need to apply the patch again when it happens
- [Spicetify](https://github.com/khanhas/spicetify-cli) users will need to reapply BlockTheSpot after applying a Spicetify themes/patches.
- If the automatic install/uninstall scripts do not work, open issue at [SpotX](https://github.com/amd64fox/SpotX) or contact [Amd64Fox](https://github.com/amd64fox) or [Nuzair46](https://github.com/Nuzair46).
- For more support and discussions, join our [Discord server](https://discord.gg/p43cusgUPm).

### DISCLAIMER

- Autoinstaller is maintaned at [SpotX](https://github.com/amd64fox/SpotX). Any issue related to it should be opened in the said repo.
- Ad blocking is the main concern of this repo. Any other feature provided by SpotX or consequence of using those features will be the sole repsonsiblity of the user and not either BlockTheSpot or SpotX team will be responsible.
#### Just copy dpapi.dll into spotify installation folder.
6 changes: 0 additions & 6 deletions SpotXBasic.bat

This file was deleted.

80 changes: 0 additions & 80 deletions Uninstall.bat

This file was deleted.

2 changes: 1 addition & 1 deletion src/BlockTheSpot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void __stdcall LoadAPI (LPVOID* destination, const char* apiName)
if (*destination)
return;

static std::string_view path{ "dpapi.dll" };
static std::wstring_view path{ L"dpapi.dll" };
static HMODULE hModule = GetModuleHandle (path.data ());
static std::map<std::string,FARPROC> function_map;
if (!hModule && !(hModule = LoadLibrary (path.data ())))
Expand Down
26 changes: 22 additions & 4 deletions src/BlockTheSpot.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand All @@ -41,7 +41,7 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<LinkIncremental>false</LinkIncremental>
<TargetName>dpapi</TargetName>
<OutDir>$(ProjectDir)..\</OutDir>
</PropertyGroup>
Expand All @@ -54,22 +54,28 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;BLOCKTHESPOT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>./cef_binary_109.1.13+g18f6895+chromium-109.0.5414.87_windows32_minimal</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<ModuleDefinitionFile>dpapi.def</ModuleDefinitionFile>
<AdditionalLibraryDirectories>./cef_binary_109.1.13+g18f6895+chromium-109.0.5414.87_windows32_minimal/release</AdditionalLibraryDirectories>
<AdditionalDependencies>libcef.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;BLOCKTHESPOT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
Expand All @@ -78,15 +84,26 @@
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>./cef_binary_109.1.13+g18f6895+chromium-109.0.5414.87_windows32_minimal/release</AdditionalLibraryDirectories>
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="disasm-lib\cpu.h" />
<ClInclude Include="disasm-lib\disasm.h" />
<ClInclude Include="disasm-lib\disasm_x86.h" />
<ClInclude Include="disasm-lib\disasm_x86_tables.h" />
<ClInclude Include="disasm-lib\misc.h" />
<ClInclude Include="Logger.h" />
<ClInclude Include="mhook-lib\mhook.h" />
<ClInclude Include="Modify.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="disasm-lib\cpu.c" />
<ClCompile Include="disasm-lib\disasm.c" />
<ClCompile Include="disasm-lib\disasm_x86.c" />
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand All @@ -96,6 +113,7 @@
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="BlockTheSpot.cpp" />
<ClCompile Include="mhook-lib\mhook.cpp" />
<ClCompile Include="Modify.cpp" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
Expand Down
38 changes: 38 additions & 0 deletions src/BlockTheSpot.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,52 @@
<ClCompile Include="stdafx.cpp" />
<ClCompile Include="Modify.cpp" />
<ClCompile Include="BlockTheSpot.cpp" />
<ClCompile Include="disasm-lib\cpu.c">
<Filter>disasm-lib</Filter>
</ClCompile>
<ClCompile Include="disasm-lib\disasm.c">
<Filter>disasm-lib</Filter>
</ClCompile>
<ClCompile Include="disasm-lib\disasm_x86.c">
<Filter>disasm-lib</Filter>
</ClCompile>
<ClCompile Include="mhook-lib\mhook.cpp">
<Filter>mhook-lib</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Modify.h" />
<ClInclude Include="Logger.h" />
<ClInclude Include="disasm-lib\cpu.h">
<Filter>disasm-lib</Filter>
</ClInclude>
<ClInclude Include="disasm-lib\disasm.h">
<Filter>disasm-lib</Filter>
</ClInclude>
<ClInclude Include="disasm-lib\disasm_x86.h">
<Filter>disasm-lib</Filter>
</ClInclude>
<ClInclude Include="disasm-lib\disasm_x86_tables.h">
<Filter>disasm-lib</Filter>
</ClInclude>
<ClInclude Include="disasm-lib\misc.h">
<Filter>disasm-lib</Filter>
</ClInclude>
<ClInclude Include="mhook-lib\mhook.h">
<Filter>mhook-lib</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\README.md" />
</ItemGroup>
<ItemGroup>
<Filter Include="disasm-lib">
<UniqueIdentifier>{3162897c-8c49-439a-bea3-bd980758f058}</UniqueIdentifier>
</Filter>
<Filter Include="mhook-lib">
<UniqueIdentifier>{3fe47c7b-0eca-4f27-b472-57049590c4de}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
31 changes: 16 additions & 15 deletions src/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class Logger {
static __time64_t long_time;
_time64 (&long_time);
localtime_s (&newtime, &long_time);
return std::put_time (&newtime, "%d-%b-%Y %H:%M:%S");
return newtime;
}

std::ofstream log_stream;
const bool read (std::string_view app, std::string_view key,const int def_value = 0) {
if (1 == GetPrivateProfileInt (app.data (), key.data (), def_value, "./config.ini")) {
std::wofstream log_wstream;
const bool read (std::wstring_view app, std::wstring_view key,const int def_value = 0) {
if (1 == GetPrivateProfileInt (app.data (), key.data (), def_value, L"./config.ini")) {
return true;
}
return false;
Expand All @@ -23,24 +23,25 @@ class Logger {

public:
Logger () {
if (read ("Config", "Log")) {
log_stream.open ("blockthespot_log.txt", std::ios::out | std::ios::app);
if (read (L"Config", L"Log")) {
log_wstream.open (L"blockthespot_log.txt", std::ios::out | std::ios::app);
//m_log << "BlockTheSpot - Build date: " << __TIMESTAMP__ << std::endl;
}
}

~Logger () {
if (log_stream.is_open()) {
log_stream.flush ();
log_stream.close ();
if (log_wstream.is_open()) {
log_wstream.flush ();
log_wstream.close ();
}
}

void Log (std::string_view log) {
if (log_stream.is_open ()) {
std::stringstream message;
message << "LOG | " << current_datetime () << " - " << log;
log_stream << message.str() << std::endl;
void Log (std::wstring_view log) {
if (log_wstream.is_open ()) {
std::wstringstream message;
auto time = current_datetime();
message << L"LOG | " << std::put_time(&time, L"%d-%b-%Y %H:%M:%S") << L" - " << log;
log_wstream << message.str() << std::endl;
}

}
Expand Down
Loading

0 comments on commit c73981d

Please sign in to comment.