Skip to content

Commit edc8863

Browse files
committed
add sync/non sync log APIs
1 parent aaa27ad commit edc8863

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

include/gw2al_api.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ typedef void(*gw2al_api_event_handler)(void* data);
4949
#define GW2AL_CORE_FUNN_QUERY_EVENT 11
5050
#define GW2AL_CORE_FUNN_TRIGGER_EVENT 12
5151
#define GW2AL_CORE_FUNN_CLIENT_UNLOAD 13
52-
#define GW2AL_CORE_FUNN_LOG_TEXT 14
53-
#define GW2AL_CORE_FUNN_D3DCREATE_HOOK 15
54-
#define GW2AL_CORE_FUNN_D3D11CREATE_HOOK 16
52+
#define GW2AL_CORE_FUNN_LOG_TEXT_SYNC 14
53+
#define GW2AL_CORE_FUNN_LOG_TEXT 15
54+
#define GW2AL_CORE_FUNN_D3DCREATE_HOOK 16
55+
#define GW2AL_CORE_FUNN_D3D11CREATE_HOOK 17
5556

5657
typedef enum gw2al_log_level {
5758
LL_INFO = 0,
@@ -96,6 +97,7 @@ typedef struct gw2al_core_vtable {
9697

9798
//simple logging function
9899

100+
void (*log_text_sync)(gw2al_log_level level, const wchar_t* source, const wchar_t* text);
99101
void (*log_text)(gw2al_log_level level, const wchar_t* source, const wchar_t* text);
100102

101103
} gw2al_core_vtable;

loader_core/gw2al_api_addon_registry.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ void gw2al_core__init_addon_registry()
3030
GW2AL_CORE_FUNN_QUERY_EVENT,
3131
GW2AL_CORE_FUNN_TRIGGER_EVENT,
3232
GW2AL_CORE_FUNN_CLIENT_UNLOAD,
33+
GW2AL_CORE_FUNN_LOG_TEXT_SYNC,
3334
GW2AL_CORE_FUNN_LOG_TEXT,
3435
0
3536
};

loader_core/gw2al_api_func_registry.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ void gw2al_core__init_func_registry()
1717
gw2al_core__register_function(gw2al_core__query_event, GW2AL_CORE_FUNN_QUERY_EVENT);
1818
gw2al_core__register_function(gw2al_core__trigger_event, GW2AL_CORE_FUNN_TRIGGER_EVENT);
1919
gw2al_core__register_function(gw2al_core__client_unload, GW2AL_CORE_FUNN_CLIENT_UNLOAD);
20+
gw2al_core__register_function(gw2al_core__log_text, GW2AL_CORE_FUNN_LOG_TEXT_SYNC);
2021
gw2al_core__register_function(gw2al_core__log_text, GW2AL_CORE_FUNN_LOG_TEXT);
2122
}
2223

loader_core/gw2al_api_impl.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ void gw2al_core__client_unload()
6060
}
6161
}
6262

63+
void gw2al_core__log_text_sync(gw2al_log_level level, const wchar_t* source, const wchar_t* text)
64+
{
65+
gw2al_core__log_text(level, source, text);
66+
67+
fflush(logFile);
68+
}
69+
6370

6471
void gw2al_core__log_text(gw2al_log_level level, const wchar_t* source, const wchar_t* text)
6572
{

loader_core/gw2al_api_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,5 @@ unsigned int gw2al_core__trigger_event(gw2al_event_id id, void* data);
5959

6060
void gw2al_core__client_unload();
6161

62+
void gw2al_core__log_text_sync(gw2al_log_level level, const wchar_t* source, const wchar_t* text);
6263
void gw2al_core__log_text(gw2al_log_level level, const wchar_t* source, const wchar_t* text);

0 commit comments

Comments
 (0)