Skip to content

Commit 844ad50

Browse files
author
ejaxh
authored
developer pattern update & a few changes (#484)
* developer pattern update & a few changes * Update README.md * developer pattern update * ENABLE_DETOURS * update get_all_matching_codes & get_first_matching_code * update get_first_matching_code * Hooking class update * a few changes * address calculation in scan_first function fixed * Detours enabled * "is_found" function has been updated. * The GenericModal edit has been removed
1 parent 2e3c193 commit 844ad50

16 files changed

+682
-463
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<h4 align="center">A multi-purpose adblocker and skip-bypass for the <strong>Spotify for Windows (64 bit)</strong> </h4>
66
<h5 align="center">Please support Spotify by purchasing premium</h5>
77
<p align="center">
8-
<strong>Last updated:</strong> 6 August 2023<br>
9-
<strong>Last tested version:</strong> 1.2.17.834.g26ee1129
8+
<strong>Last updated:</strong> 17 August 2023<br>
9+
<strong>Last tested version:</strong> 1.2.18.999.g9b38fc27
1010
</p>
1111
</center>
1212

src/BasicUtils/Console.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
#define _CONSOLE_H
33

44
#include <Windows.h>
5+
#pragma warning(disable: 4530)
56
#include <iostream>
7+
#pragma warning(default: 4530)
68
#include <string_view>
79
#include <vector>
810
#include <mutex>
911
//#include <regex>
1012
#include <format>
11-
#include "Utils.h"
1213

1314
namespace Console {
1415
extern std::mutex cout_mutex;
@@ -34,12 +35,20 @@ namespace Console {
3435
#if defined(_DEBUG) || defined(_CONSOLE)
3536
// Converts a value to the appropriate type for std::vformat()
3637
template<typename T>
37-
constexpr auto TypeConvert(const T& arg) {
38+
constexpr auto TypeConvert(const T& arg)
39+
{
3840
if constexpr (std::is_same_v<T, const wchar_t*>) {
3941
return std::wstring_view(arg);
4042
}
4143
else if constexpr (std::is_same_v<T, char*> || std::is_same_v<T, const char*> || std::is_same_v<T, std::string> || std::is_same_v<T, std::string_view>) {
42-
return Utils::ToString(arg);
44+
auto ToString = [&](std::string_view narrow_string) {
45+
int size_needed = MultiByteToWideChar(CP_UTF8, 0, &narrow_string[0], (int)narrow_string.size(), NULL, 0);
46+
std::wstring wstrTo(size_needed, 0);
47+
MultiByteToWideChar(CP_UTF8, 0, &narrow_string[0], (int)narrow_string.size(), &wstrTo[0], size_needed);
48+
return wstrTo;
49+
};
50+
51+
return ToString(arg);
4352
}
4453
else if constexpr (std::is_same_v < T, void*>) {
4554
return reinterpret_cast<std::uintptr_t>(arg);
@@ -69,7 +78,7 @@ namespace Console {
6978
std::wcout << std::vformat(fmt, std::make_wformat_args(TypeConvert(args)...)) << std::endl;
7079
//}
7180
//catch (const std::exception& e) {
72-
// throw std::runtime_error("Failed to format string: " + std::string(e.what()));
81+
// std::wcerr << L"Failed to format string: " << e.what() << std::endl;
7382
//}
7483
#endif
7584
}
@@ -182,4 +191,6 @@ namespace Console {
182191
// }
183192
}
184193

194+
using namespace Console;
195+
185196
#endif // _CONSOLE_H

0 commit comments

Comments
 (0)