- fixes for the new spotify version 🎉

Co-authored-by: Arsenii es3n1n <40367813+es3n1n@users.noreply.github.com>
Reviewed-on: #2
This commit is contained in:
es3n1n 2023-03-30 21:05:19 +00:00
parent 5243685a90
commit 506e1b7c87
4 changed files with 23 additions and 14 deletions

@ -2,22 +2,23 @@
#include <Windows.h> #include <Windows.h>
#include <cstdint> #include <cstdint>
#include <functional> #include <functional>
#include <mutex>
#include <stdio.h> #include <stdio.h>
#define L_ERROR(...) util::logger::error(__FUNCTION__ "(): " __VA_ARGS__); #define L_ERROR(...) util::logger::error(__FUNCTION__ "(): " __VA_ARGS__);
#define TRACE_FN util::logger::debug("%s()", __FUNCTION__); #define TRACE_FN util::logger::debug("%s()", __FUNCTION__);
#define LOGGER_PARSE_FMT \ #define LOGGER_PARSE_FMT \
char buf[2048]; \ char buf[2048]; \
va_list va; \ va_list va; \
va_start(va, fmt); \ va_start(va, fmt); \
_vsnprintf_s(buf, 1024, fmt, va); \ _vsnprintf_s(buf, 1024, fmt, va); \
va_end(va); va_end(va);
#define CREATE_LOGGER_METHOD(n) \ #define CREATE_LOGGER_METHOD(n) \
inline void n(const char* fmt, ...) { \ inline void n(const char* fmt, ...) { \
LOGGER_PARSE_FMT; \ LOGGER_PARSE_FMT; \
log(#n, e_level_color::level_color_##n, buf); \ log(#n, e_level_color::level_color_##n, buf); \
} }
namespace util { namespace util {
@ -45,7 +46,9 @@ namespace util {
SetConsoleTextAttribute(m_console_handle, clr); SetConsoleTextAttribute(m_console_handle, clr);
} }
inline void reset() { apply(static_cast<uint32_t>(e_level_color::level_color_none)); } inline void reset() {
apply(static_cast<uint32_t>(e_level_color::level_color_none));
}
inline void colorify(uint32_t clr, std::function<void()> cb) { inline void colorify(uint32_t clr, std::function<void()> cb) {
apply(clr); apply(clr);
@ -54,7 +57,13 @@ namespace util {
} }
} // namespace _colors } // namespace _colors
namespace {
inline std::mutex _mtx;
}
inline void log(const char* prefix, e_level_color level, const char* message) { inline void log(const char* prefix, e_level_color level, const char* message) {
std::lock_guard<std::mutex> _lock(_mtx);
_colors::colorify(static_cast<uint32_t>(level), [prefix]() -> void { printf("%s >> ", prefix); }); _colors::colorify(static_cast<uint32_t>(level), [prefix]() -> void { printf("%s >> ", prefix); });
printf("%s\n", message); printf("%s\n", message);

@ -2,8 +2,8 @@
// autoupdates // autoupdates
// @note: es3n1n: v1.1.0 = 110 // @note: es3n1n: v1.1.1 = 111
#define UNSPOTIFY_VERSION 110 #define UNSPOTIFY_VERSION 111
#define AUTOUPDATER_DOMAIN "es3n.in" #define AUTOUPDATER_DOMAIN "es3n.in"
#define AUTOUPDATER_URL "unspotify.json" #define AUTOUPDATER_URL "unspotify.json"

@ -45,7 +45,7 @@ namespace spotify {
ASSERT_PATTERN_STEP(sig); ASSERT_PATTERN_STEP(sig);
do { do {
sig = sig.walk_back_until(0xC2 /* retn */); sig = sig.walk_back_until(0xC2 /* retn */);
} while (sig.offset(-5).read<uint8_t>() != 0xE8 && sig.offset(-8).read<uint8_t>() != 0xE8); } while (sig.offset(-5).read<uint8_t>() != 0xE8 && sig.offset(-8).read<uint8_t>() != 0xE8 && sig.offset(-9).read<uint8_t>() != 0xE8);
addr::get_ad = sig.add(1).read<uint8_t>() == 0x68 /* push */ ? sig.add(1) : sig.walk_until(0x68 /* push 0D4h */); addr::get_ad = sig.add(1).read<uint8_t>() == 0x68 /* push */ ? sig.add(1) : sig.walk_until(0x68 /* push 0D4h */);
util::logger::debug("addr::get_ad = 0x%p", addr::get_ad); util::logger::debug("addr::get_ad = 0x%p", addr::get_ad);
ASSERT_PATTERN(get_ad); ASSERT_PATTERN(get_ad);

@ -12,7 +12,7 @@ namespace spotify {
struct player_track_meta_t { struct player_track_meta_t {
private: private:
char __pad[0x98]; char __pad[0xB0];
public: public:
const char* m_track_uri; const char* m_track_uri;
}; };