mirror of
https://github.com/wiiu-env/NotificationModule.git
synced 2026-04-24 15:06:52 -05:00
Compare commits
No commits in common. "main" and "v0.1.2" have entirely different histories.
10
Dockerfile
10
Dockerfile
|
|
@ -1,8 +1,8 @@
|
|||
FROM ghcr.io/wiiu-env/devkitppc:20260225
|
||||
FROM ghcr.io/wiiu-env/devkitppc:20240505
|
||||
|
||||
COPY --from=ghcr.io/wiiu-env/libnotifications:20260404 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/libmappedmemory:20260331 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20260331 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20260418 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/libnotifications:20240426 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/libmappedmemory:20230621 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20240424 /artifacts $DEVKITPRO
|
||||
|
||||
WORKDIR project
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -30,7 +30,7 @@ INCLUDES := src
|
|||
#-------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#-------------------------------------------------------------------------------
|
||||
CFLAGS := -Wall -Wextra -Werror -O2 -ffunction-sections\
|
||||
CFLAGS := -Wall -Wextra -O2 -ffunction-sections\
|
||||
$(MACHDEP)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include <wums.h>
|
||||
|
||||
void ExportCleanUp() {
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
gNotificationList.clear();
|
||||
std::lock_guard overlay_lock(gOverlayFrameMutex);
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ NotificationModuleStatus NMAddDynamicNotificationV2(const char *text,
|
|||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
*outHandle = notification->getHandle();
|
||||
{
|
||||
std::lock_guard overlay_lock(gOverlayFrameMutex);
|
||||
|
|
@ -147,7 +147,7 @@ NotificationModuleStatus NMAddDynamicNotification(const char *text,
|
|||
NotificationModuleStatus NMUpdateDynamicNotificationText(NotificationModuleHandle handle,
|
||||
const char *text) {
|
||||
NotificationModuleStatus res = NOTIFICATION_MODULE_RESULT_INVALID_HANDLE;
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
for (auto &cur : gNotificationList) {
|
||||
if (cur->getHandle() == handle) {
|
||||
cur->updateText(text);
|
||||
|
|
@ -161,7 +161,7 @@ NotificationModuleStatus NMUpdateDynamicNotificationText(NotificationModuleHandl
|
|||
NotificationModuleStatus NMUpdateDynamicNotificationBackgroundColor(NotificationModuleHandle handle,
|
||||
NMColor backgroundColor) {
|
||||
NotificationModuleStatus res = NOTIFICATION_MODULE_RESULT_INVALID_HANDLE;
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
for (auto &cur : gNotificationList) {
|
||||
if (cur->getHandle() == handle) {
|
||||
cur->updateBackgroundColor((GX2Color){backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a});
|
||||
|
|
@ -175,7 +175,7 @@ NotificationModuleStatus NMUpdateDynamicNotificationBackgroundColor(Notification
|
|||
NotificationModuleStatus NMUpdateDynamicNotificationTextColor(NotificationModuleHandle handle,
|
||||
NMColor textColor) {
|
||||
NotificationModuleStatus res = NOTIFICATION_MODULE_RESULT_INVALID_HANDLE;
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
for (auto &cur : gNotificationList) {
|
||||
if (cur->getHandle() == handle) {
|
||||
cur->updateTextColor((GX2Color){textColor.r, textColor.g, textColor.b, textColor.a});
|
||||
|
|
@ -203,7 +203,7 @@ NotificationModuleStatus NMFinishDynamicNotification(NotificationModuleHandle ha
|
|||
}
|
||||
|
||||
NotificationModuleStatus res = NOTIFICATION_MODULE_RESULT_INVALID_HANDLE;
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
for (auto &cur : gNotificationList) {
|
||||
if (cur->getHandle() == handle) {
|
||||
cur->updateStatus(newStatus);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ DECL_FUNCTION(void, GX2SetContextState, GX2ContextState *curContext) {
|
|||
DECL_FUNCTION(void, GX2SetupContextStateEx, GX2ContextState *state, BOOL unk1) {
|
||||
real_GX2SetupContextStateEx(state, unk1);
|
||||
gOriginalContextState = state;
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("gOriginalContextState = %p", state);
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("gOriginalContextState = %08X", state);
|
||||
}
|
||||
|
||||
DECL_FUNCTION(void, GX2SetTVBuffer, void *buffer, uint32_t buffer_size, int32_t tv_render_mode, GX2SurfaceFormat surface_format, GX2BufferingMode buffering_mode) {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ GuiText::GuiText(const char *t, int s, const glm::vec4 &c) {
|
|||
blurGlowColor = glm::vec4(0.0f);
|
||||
|
||||
if (t) {
|
||||
std::lock_guard<std::recursive_mutex> textLock(mTextLock);
|
||||
std::lock_guard<std::mutex> textLock(mTextLock);
|
||||
text = SchriftGX2::charToWideChar(t);
|
||||
if (!text) {
|
||||
return;
|
||||
|
|
@ -81,14 +81,14 @@ GuiText::GuiText(const char *t, int s, const glm::vec4 &c) {
|
|||
* Destructor for the GuiText class.
|
||||
*/
|
||||
GuiText::~GuiText() {
|
||||
std::lock_guard<std::recursive_mutex> textLock(mTextLock);
|
||||
std::lock_guard<std::mutex> textLock(mTextLock);
|
||||
delete[] text;
|
||||
|
||||
text = nullptr;
|
||||
}
|
||||
|
||||
void GuiText::setText(const char *t) {
|
||||
std::lock_guard<std::recursive_mutex> textLock(mTextLock);
|
||||
std::lock_guard<std::mutex> textLock(mTextLock);
|
||||
delete[] text;
|
||||
|
||||
text = nullptr;
|
||||
|
|
@ -115,7 +115,7 @@ void GuiText::setPresetFont(SchriftGX2 *f) {
|
|||
}
|
||||
|
||||
void GuiText::setFontSize(int s) {
|
||||
std::lock_guard<std::recursive_mutex> textLock(mTextLock);
|
||||
std::lock_guard<std::mutex> textLock(mTextLock);
|
||||
size = s;
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ void GuiText::setBlurGlowColor(float blur, const glm::vec4 &c) {
|
|||
* Change font
|
||||
*/
|
||||
bool GuiText::setFont(SchriftGX2 *f) {
|
||||
std::lock_guard<std::recursive_mutex> textLock(mTextLock);
|
||||
std::lock_guard<std::mutex> textLock(mTextLock);
|
||||
if (!f) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ void GuiText::draw(bool SRGBConversion) {
|
|||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::recursive_mutex> textLock(mTextLock);
|
||||
std::lock_guard<std::mutex> textLock(mTextLock);
|
||||
|
||||
color[3] = getAlpha();
|
||||
blurGlowColor[3] = blurAlpha * getAlpha();
|
||||
|
|
|
|||
|
|
@ -100,5 +100,5 @@ protected:
|
|||
float blurAlpha;
|
||||
glm::vec4 blurGlowColor{};
|
||||
|
||||
std::recursive_mutex mTextLock;
|
||||
std::mutex mTextLock;
|
||||
};
|
||||
|
|
@ -6,7 +6,7 @@ void OverlayFrame::addNotification(std::shared_ptr<Notification> status) {
|
|||
status->setAlignment(ALIGN_TOP_LEFT);
|
||||
status->setEffect(EFFECT_FADE, 55, 255);
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
list.push_front(std::move(status));
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ void OverlayFrame::OnShakeFinished(GuiElement *element) {
|
|||
}
|
||||
|
||||
void OverlayFrame::clearElements() {
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
for (auto &element : list) {
|
||||
remove(element.get());
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ void OverlayFrame::clearElements() {
|
|||
void OverlayFrame::process() {
|
||||
GuiFrame::process();
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lock(gNotificationListMutex);
|
||||
std::lock_guard<std::mutex> lock(gNotificationListMutex);
|
||||
|
||||
float offset = -25.0f;
|
||||
for (auto &item : list) {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ char *SchriftGX2::wideCharToUTF8(const wchar_t *strChar) {
|
|||
* This routine clears all members of the font map structure and frees all allocated memory back to the system.
|
||||
*/
|
||||
void SchriftGX2::unloadFont() {
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
for (auto &dataForSize : fontData) {
|
||||
for (auto &cur : dataForSize.second.ftgxCharMap) {
|
||||
if (cur.second.texture) {
|
||||
|
|
@ -182,7 +182,7 @@ void SchriftGX2::unloadFont() {
|
|||
* @return A pointer to the allocated font structure.
|
||||
*/
|
||||
ftgxCharData *SchriftGX2::cacheGlyphData(wchar_t charCode, int16_t pixelSize) {
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
auto itr = fontData.find(pixelSize);
|
||||
if (itr != fontData.end()) {
|
||||
auto itr2 = itr->second.ftgxCharMap.find(charCode);
|
||||
|
|
@ -347,7 +347,7 @@ int16_t SchriftGX2::getStyleOffsetWidth(uint16_t width, uint16_t format) {
|
|||
* @param format Positional format of the string.
|
||||
*/
|
||||
int16_t SchriftGX2::getStyleOffsetHeight(int16_t format, uint16_t pixelSize) {
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
std::map<int16_t, ftGX2Data>::iterator itr = fontData.find(pixelSize);
|
||||
if (itr == fontData.end()) return 0;
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ uint16_t SchriftGX2::drawText(int16_t x, int16_t y, int16_t z, const wchar_t *te
|
|||
return 0;
|
||||
}
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
|
||||
// uint16_t fullTextWidth = (textWidth > 0) ? textWidth : getWidth(text, pixelSize);
|
||||
uint16_t x_pos = x, printed = 0;
|
||||
|
|
@ -445,7 +445,7 @@ uint16_t SchriftGX2::getWidth(const wchar_t *text, int16_t pixelSize) {
|
|||
if (!text) {
|
||||
return 0;
|
||||
}
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
|
||||
uint16_t strWidth = 0;
|
||||
int32_t i = 0;
|
||||
|
|
@ -470,7 +470,7 @@ uint16_t SchriftGX2::getWidth(const wchar_t *text, int16_t pixelSize) {
|
|||
* Single char width
|
||||
*/
|
||||
uint16_t SchriftGX2::getCharWidth(const wchar_t wChar, int16_t pixelSize, const wchar_t prevChar) {
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
uint16_t strWidth = 0;
|
||||
ftgxCharData *glyphData = cacheGlyphData(wChar, pixelSize);
|
||||
|
||||
|
|
@ -496,7 +496,7 @@ uint16_t SchriftGX2::getCharWidth(const wchar_t wChar, int16_t pixelSize, const
|
|||
* @return The height of the text string in pixels.
|
||||
*/
|
||||
uint16_t SchriftGX2::getHeight(const wchar_t *text, int16_t pixelSize) {
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
getOffset(text, pixelSize);
|
||||
return fontData[pixelSize].ftgxAlign.max - fontData[pixelSize].ftgxAlign.min;
|
||||
}
|
||||
|
|
@ -515,7 +515,7 @@ void SchriftGX2::getOffset(const wchar_t *text, int16_t pixelSize, uint16_t widt
|
|||
if (!text) {
|
||||
return;
|
||||
}
|
||||
std::lock_guard<std::recursive_mutex> lock(fontDataMutex);
|
||||
std::lock_guard<std::mutex> lock(fontDataMutex);
|
||||
int16_t strMax = 0, strMin = 9999;
|
||||
uint16_t currWidth = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ private:
|
|||
|
||||
void copyTextureToFramebuffer(GX2Texture *tex, int16_t screenX, int16_t screenY, int16_t screenZ, const glm::vec4 &color, const float &textBlur, const float &colorBlurIntensity, const glm::vec4 &blurColor);
|
||||
|
||||
std::recursive_mutex fontDataMutex;
|
||||
std::mutex fontDataMutex;
|
||||
|
||||
public:
|
||||
SchriftGX2(const uint8_t *fontBuffer, uint32_t bufferSize);
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
class Timer {
|
||||
public:
|
||||
Timer() { clock_gettime(CLOCK_MONOTONIC, &beg_); }
|
||||
Timer() { clock_gettime(CLOCK_REALTIME, &beg_); }
|
||||
|
||||
double elapsed() {
|
||||
clock_gettime(CLOCK_MONOTONIC, &end_);
|
||||
clock_gettime(CLOCK_REALTIME, &end_);
|
||||
return end_.tv_sec - beg_.tv_sec +
|
||||
(end_.tv_nsec - beg_.tv_nsec) / 1000000000.;
|
||||
}
|
||||
|
||||
void reset() { clock_gettime(CLOCK_MONOTONIC, &beg_); }
|
||||
void reset() { clock_gettime(CLOCK_REALTIME, &beg_); }
|
||||
|
||||
private:
|
||||
timespec beg_, end_;
|
||||
|
|
|
|||
|
|
@ -1110,11 +1110,11 @@ simple_outline(SFT_Font *font, uint_fast32_t offset, unsigned int numContours, O
|
|||
goto failure;
|
||||
}
|
||||
|
||||
endPts = calloc(numContours, sizeof(uint_fast16_t));
|
||||
endPts = calloc(sizeof(uint_fast16_t), numContours);
|
||||
if (endPts == NULL) {
|
||||
goto failure;
|
||||
}
|
||||
flags = calloc(numPts, sizeof(uint8_t));
|
||||
flags = calloc(sizeof(uint8_t), numPts);
|
||||
if (flags == NULL) {
|
||||
goto failure;
|
||||
}
|
||||
|
|
@ -1435,7 +1435,7 @@ render_outline(Outline *outl, double transform[6], SFT_Image image) {
|
|||
|
||||
numPixels = (unsigned int) image.width * (unsigned int) image.height;
|
||||
|
||||
cells = calloc(numPixels, sizeof(Cell));
|
||||
cells = calloc(sizeof(Cell), numPixels);
|
||||
if (!cells) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
WUMS_MODULE_EXPORT_NAME("homebrew_notifications");
|
||||
|
||||
#define VERSION "v0.1.4"
|
||||
#define VERSION "v0.1.2"
|
||||
|
||||
WUMS_DEPENDS_ON(homebrew_memorymapping);
|
||||
WUMS_DEPENDS_ON(homebrew_functionpatcher);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ GX2SurfaceFormat gTVSurfaceFormat = GX2_SURF
|
|||
GX2SurfaceFormat gDRCSurfaceFormat = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
|
||||
GX2ContextState *gContextState = nullptr;
|
||||
GX2ContextState *gOriginalContextState = nullptr;
|
||||
std::recursive_mutex gOverlayFrameMutex = {};
|
||||
std::mutex gOverlayFrameMutex = {};
|
||||
std::vector<std::shared_ptr<Notification>> gOverlayQueueDuringStartup = {};
|
||||
OverlayFrame *gOverlayFrame = nullptr;
|
||||
SchriftGX2 *gFontSystem = nullptr;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,12 @@
|
|||
#include "gui/OverlayFrame.h"
|
||||
#include "gui/SchriftGX2.h"
|
||||
#include <gx2/context.h>
|
||||
#include <mutex>
|
||||
|
||||
extern GX2SurfaceFormat gTVSurfaceFormat;
|
||||
extern GX2SurfaceFormat gDRCSurfaceFormat;
|
||||
extern GX2ContextState *gContextState;
|
||||
extern GX2ContextState *gOriginalContextState;
|
||||
extern std::recursive_mutex gOverlayFrameMutex;
|
||||
extern std::mutex gOverlayFrameMutex;
|
||||
extern std::vector<std::shared_ptr<Notification>> gOverlayQueueDuringStartup;
|
||||
extern OverlayFrame *gOverlayFrame;
|
||||
extern SchriftGX2 *gFontSystem;
|
||||
|
|
|
|||
|
|
@ -14,18 +14,13 @@ extern "C" {
|
|||
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
|
||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__)
|
||||
|
||||
#define LOG(LOG_FUNC, FMT, ARGS...) LOG_EX_DEFAULT(LOG_FUNC, "", "", "", FMT, ##ARGS)
|
||||
#define LOG(LOG_FUNC, FMT, ARGS...) LOG_EX_DEFAULT(LOG_FUNC, "", "", FMT, ##ARGS)
|
||||
|
||||
#define CONSOLE_COLOR_RED "\033[31m"
|
||||
#define CONSOLE_COLOR_YELLOW "\033[33m"
|
||||
#define CONSOLE_COLOR_CYAN "\033[36m"
|
||||
#define CONSOLE_COLOR_RESET "\033[0m"
|
||||
#define LOG_EX_DEFAULT(LOG_FUNC, LOG_LEVEL, LINE_END, FMT, ARGS...) LOG_EX(__FILENAME__, __FUNCTION__, __LINE__, LOG_FUNC, LOG_LEVEL, LINE_END, FMT, ##ARGS)
|
||||
|
||||
#define LOG_EX_DEFAULT(LOG_FUNC, LOG_COLOR, LOG_LEVEL, LINE_END, FMT, ARGS...) LOG_EX(__FILENAME__, __FUNCTION__, __LINE__, LOG_FUNC, LOG_COLOR, LOG_LEVEL, LINE_END, FMT, ##ARGS)
|
||||
|
||||
#define LOG_EX(FILENAME, FUNCTION, LINE, LOG_FUNC, LOG_COLOR, LOG_LEVEL, LINE_END, FMT, ARGS...) \
|
||||
#define LOG_EX(FILENAME, FUNCTION, LINE, LOG_FUNC, LOG_LEVEL, LINE_END, FMT, ARGS...) \
|
||||
do { \
|
||||
LOG_FUNC(LOG_COLOR "[(%s)%18s][%23s]%30s@L%04d: " LOG_LEVEL "" FMT "" LINE_END, LOG_APP_TYPE, LOG_APP_NAME, FILENAME, FUNCTION, LINE, ##ARGS); \
|
||||
LOG_FUNC("[(%s)%18s][%23s]%30s@L%04d: " LOG_LEVEL "" FMT "" LINE_END, LOG_APP_TYPE, LOG_APP_NAME, FILENAME, FUNCTION, LINE, ##ARGS); \
|
||||
} while (0)
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
@ -42,11 +37,11 @@ extern "C" {
|
|||
|
||||
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) LOG(WHBLogWritef, FMT, ##ARGS)
|
||||
|
||||
#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, CONSOLE_COLOR_RED, "## ERROR## ", CONSOLE_COLOR_RESET, FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, CONSOLE_COLOR_YELLOW, "##WARN ## ", CONSOLE_COLOR_RESET, FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_INFO(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, CONSOLE_COLOR_CYAN, "##INFO ## ", CONSOLE_COLOR_RESET, FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "##ERROR## ", "", FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "##WARN ## ", "", FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_INFO(FMT, ARGS...) LOG_EX_DEFAULT(WHBLogPrintf, "##INFO ## ", "", FMT, ##ARGS)
|
||||
|
||||
#define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, WHBLogPrintf, CONSOLE_COLOR_RED, "##ERROR## ", CONSOLE_COLOR_RESET, FMT, ##ARGS);
|
||||
#define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, WHBLogPrintf, "##ERROR## ", "", FMT, ##ARGS);
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -58,11 +53,11 @@ extern "C" {
|
|||
|
||||
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) while (0)
|
||||
|
||||
#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, CONSOLE_COLOR_RED, "##ERROR## ", CONSOLE_COLOR_RESET "\n", FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, CONSOLE_COLOR_YELLOW, "##WARN ## ", CONSOLE_COLOR_RESET "\n", FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_INFO(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, CONSOLE_COLOR_CYAN, "##INFO ## ", CONSOLE_COLOR_RESET "\n", FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "##ERROR## ", "\n", FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_WARN(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "##WARN ## ", "\n", FMT, ##ARGS)
|
||||
#define DEBUG_FUNCTION_LINE_INFO(FMT, ARGS...) LOG_EX_DEFAULT(OSReport, "##INFO ## ", "\n", FMT, ##ARGS)
|
||||
|
||||
#define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, OSReport, CONSOLE_COLOR_RED, "##ERROR## ", CONSOLE_COLOR_RESET "\n", FMT, ##ARGS);
|
||||
#define DEBUG_FUNCTION_LINE_ERR_LAMBDA(FILENAME, FUNCTION, LINE, FMT, ARGS...) LOG_EX(FILENAME, FUNCTION, LINE, OSReport, "##ERROR## ", "\n", FMT, ##ARGS);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ void dumpHex(const void *data, size_t size) {
|
|||
char ascii[17];
|
||||
size_t i, j;
|
||||
ascii[16] = '\0';
|
||||
DEBUG_FUNCTION_LINE("0x%p (0x0000): ", data);
|
||||
DEBUG_FUNCTION_LINE("0x%08X (0x0000): ", data);
|
||||
for (i = 0; i < size; ++i) {
|
||||
WHBLogWritef("%02X ", ((unsigned char *) data)[i]);
|
||||
if (((unsigned char *) data)[i] >= ' ' && ((unsigned char *) data)[i] <= '~') {
|
||||
|
|
@ -74,5 +74,5 @@ uint8_t SRGBComponentToRGBTable[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0
|
|||
0xBE, 0xC0, 0xC1, 0xC3, 0xC5, 0xC7, 0xC9, 0xCB, 0xCD, 0xCF, 0xD1, 0xD3, 0xD5, 0xD7, 0xDA, 0xDC,
|
||||
0xDE, 0xE0, 0xE2, 0xE4, 0xE6, 0xE8, 0xEB, 0xED, 0xEF, 0xF1, 0xF3, 0xF5, 0xF8, 0xFA, 0xFC, 0xFF};
|
||||
|
||||
std::recursive_mutex gNotificationListMutex;
|
||||
std::mutex gNotificationListMutex;
|
||||
std::forward_list<std::shared_ptr<Notification>> gNotificationList;
|
||||
|
|
@ -17,8 +17,8 @@ std::shared_ptr<T> make_shared_nothrow(Args &&...args) noexcept(noexcept(T(std::
|
|||
}
|
||||
|
||||
template<typename T, class Allocator, class Predicate>
|
||||
bool remove_locked_first_if(std::recursive_mutex &mutex, std::forward_list<T, Allocator> &list, Predicate pred) {
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
bool remove_locked_first_if(std::mutex &mutex, std::forward_list<T, Allocator> &list, Predicate pred) {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
auto oit = list.before_begin(), it = std::next(oit);
|
||||
while (it != list.end()) {
|
||||
if (pred(*it)) {
|
||||
|
|
@ -45,5 +45,5 @@ inline uint8_t RGBComponentToSRGB(uint8_t ci) {
|
|||
return RGBComponentToSRGBTable[ci];
|
||||
}
|
||||
|
||||
extern std::recursive_mutex gNotificationListMutex;
|
||||
extern std::mutex gNotificationListMutex;
|
||||
extern std::forward_list<std::shared_ptr<Notification>> gNotificationList;
|
||||
Loading…
Reference in New Issue
Block a user