mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-01 11:18:23 +03:00
Added CRT stuff to printfs
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "print.hpp"
|
||||
|
||||
void printf_divagl(const char* fmt, ...) {
|
||||
void printf_divagl(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
char buf[0x1000];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
@@ -14,7 +14,7 @@ void printf_divagl(const char* fmt, ...) {
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void printf_proxy(const char* fmt, ...) {
|
||||
void printf_proxy(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
|
||||
#include "../KKdLib/default.hpp"
|
||||
|
||||
extern void printf_divagl(const char* fmt, ...);
|
||||
extern void printf_proxy(const char* fmt, ...);
|
||||
extern void printf_divagl(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
extern void printf_proxy(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
|
||||
@@ -428,7 +428,7 @@ std::string string_to_upper(const std::string& str) {
|
||||
return _str;
|
||||
}
|
||||
|
||||
std::string sprintf_s_string(const char* fmt, ...) {
|
||||
std::string sprintf_s_string(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
std::string buf = vsprintf_s_string(fmt, args);
|
||||
@@ -436,7 +436,7 @@ std::string sprintf_s_string(const char* fmt, ...) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::wstring swprintf_s_string(const wchar_t* fmt, ...) {
|
||||
std::wstring swprintf_s_string(_In_z_ _Printf_format_string_ const wchar_t* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
std::wstring buf = vswprintf_s_string(fmt, args);
|
||||
@@ -444,7 +444,7 @@ std::wstring swprintf_s_string(const wchar_t* fmt, ...) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::string vsprintf_s_string(const char* fmt, va_list args) {
|
||||
std::string vsprintf_s_string(_In_z_ _Printf_format_string_ const char* const fmt, va_list args) {
|
||||
char _buf[0x100];
|
||||
int32_t len = vsprintf_s(_buf, sizeof(_buf), fmt, args);
|
||||
if (len < 0)
|
||||
@@ -458,7 +458,7 @@ std::string vsprintf_s_string(const char* fmt, va_list args) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::wstring vswprintf_s_string(const wchar_t* fmt, va_list args) {
|
||||
std::wstring vswprintf_s_string(_In_z_ _Printf_format_string_ const wchar_t* const fmt, va_list args) {
|
||||
wchar_t _buf[0x100];
|
||||
int32_t len = vswprintf_s(_buf, sizeof(_buf) / sizeof(wchar_t), fmt, args);
|
||||
if (len < 0)
|
||||
|
||||
@@ -548,7 +548,7 @@ extern std::string utf16_to_utf8(const std::wstring& s);
|
||||
extern std::string string_to_lower(const std::string& str);
|
||||
extern std::string string_to_upper(const std::string& str);
|
||||
|
||||
extern std::string sprintf_s_string(const char* fmt, ...);
|
||||
extern std::wstring swprintf_s_string(const wchar_t* fmt, ...);
|
||||
extern std::string vsprintf_s_string(const char* fmt, va_list args);
|
||||
extern std::wstring vswprintf_s_string(const wchar_t* fmt, va_list args);
|
||||
extern std::string sprintf_s_string(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
extern std::wstring swprintf_s_string(_In_z_ _Printf_format_string_ const wchar_t* const fmt, ...);
|
||||
extern std::string vsprintf_s_string(_In_z_ _Printf_format_string_ const char* const fmt, va_list args);
|
||||
extern std::wstring vswprintf_s_string(_In_z_ _Printf_format_string_ const wchar_t* const fmt, va_list args);
|
||||
|
||||
@@ -227,7 +227,7 @@ bool key_val::open_scope_fmt(uint32_t i) {
|
||||
return open_scope(buf);
|
||||
}
|
||||
|
||||
bool key_val::open_scope_fmt(const char* fmt, ...) {
|
||||
bool key_val::open_scope_fmt(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
char buf[0x200];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
@@ -46,7 +46,7 @@ struct key_val {
|
||||
bool open_scope(std::string& str);
|
||||
bool open_scope_fmt(int32_t i);
|
||||
bool open_scope_fmt(uint32_t i);
|
||||
bool open_scope_fmt(const char* fmt, ...);
|
||||
bool open_scope_fmt(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
void parse(const void* data, size_t size);
|
||||
bool read(bool& value);
|
||||
bool read(float_t& value);
|
||||
|
||||
+1
-1
@@ -320,7 +320,7 @@ inline void mat4_mul_scale(const mat4* in_m1, float_t s, mat4* out_m) {
|
||||
mat4_mul_scale(in_m1, s, s, s, s, out_m);
|
||||
}
|
||||
|
||||
inline void mat4_mul_scale(const mat4* in_m1, vec4* s, mat4* out_m) {
|
||||
inline void mat4_mul_scale(const mat4* in_m1, const vec4* s, mat4* out_m) {
|
||||
mat4_mul_scale(in_m1, s->x, s->y, s->z, s->w, out_m);
|
||||
}
|
||||
|
||||
|
||||
@@ -1901,28 +1901,26 @@ namespace ImGui {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TextCentered(const char* fmt, ...) {
|
||||
void TextCentered(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsprintf_s(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args);
|
||||
std::string tex_buf = vsprintf_s_string(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
std::string tex_buf(g.TempBuffer.Data, g.TempBuffer.Size);
|
||||
ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize(tex_buf.c_str()).x) * 0.5f);
|
||||
ImGui::Text("%s", tex_buf.c_str());
|
||||
}
|
||||
|
||||
void TextRight(const char* fmt, ...) {
|
||||
void TextRight(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsprintf_s(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args);
|
||||
std::string tex_buf = vsprintf_s_string(fmt, args);
|
||||
va_end(args);
|
||||
|
||||
std::string tex_buf(g.TempBuffer.Data, g.TempBuffer.Size);
|
||||
ImGui::SetCursorPosX(ImGui::GetWindowWidth() - ImGui::CalcTextSize(tex_buf.c_str()).x);
|
||||
ImGui::Text("%s", tex_buf.c_str());
|
||||
}
|
||||
|
||||
@@ -237,6 +237,6 @@ namespace ImGui {
|
||||
extern bool ColumnSliderVec4I(const char* label, vec4i* val,
|
||||
int32_t min, int32_t max, const char* format, ImGuiSliderFlags flags, int32_t bit_flag);
|
||||
|
||||
extern void TextCentered(const char* fmt, ...);
|
||||
extern void TextRight(const char* fmt, ...);
|
||||
extern void TextCentered(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
extern void TextRight(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ struct c_buff_data {
|
||||
|
||||
void init(char* data, size_t size, size_t position);
|
||||
void move(int32_t size);
|
||||
void printf(const char* fmt, ...);
|
||||
void vprintf(const char* fmt, va_list args);
|
||||
void printf(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
void vprintf(_In_z_ _Printf_format_string_ const char* const fmt, va_list args);
|
||||
};
|
||||
|
||||
struct c_buff {
|
||||
@@ -83,14 +83,16 @@ void dw_console_init() {
|
||||
dw_console->Disp();
|
||||
}
|
||||
|
||||
void dw_console_printf(dw_console_index index, const char* fmt, ...) {
|
||||
void dw_console_printf(dw_console_index index,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
dw_console_vprintf(index, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void dw_console_vprintf(dw_console_index index, const char* fmt, va_list args) {
|
||||
void dw_console_vprintf(dw_console_index index,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, va_list args) {
|
||||
/*if (!main_thread_id_check())
|
||||
return;*/
|
||||
|
||||
@@ -244,14 +246,14 @@ void c_buff_data::move(int32_t size) {
|
||||
this->position -= v5 - buf;
|
||||
}
|
||||
|
||||
void c_buff_data::printf(const char* fmt, ...) {
|
||||
void c_buff_data::printf(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void c_buff_data::vprintf(const char* fmt, va_list args) {
|
||||
void c_buff_data::vprintf(_In_z_ _Printf_format_string_ const char* const fmt, va_list args) {
|
||||
char* pos = &position[vsprintf_s(position, buf_end - position, fmt, args)];
|
||||
position = min_def(pos, buf_end);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,10 @@ enum dw_console_index {
|
||||
};
|
||||
|
||||
extern void dw_console_init();
|
||||
extern void dw_console_printf(dw_console_index index, const char* fmt, ...);
|
||||
extern void dw_console_vprintf(dw_console_index index, const char* fmt, va_list args);
|
||||
extern void dw_console_printf(dw_console_index index,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
extern void dw_console_vprintf(dw_console_index index,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, va_list args);
|
||||
|
||||
extern void dw_console_c_buff_array_init();
|
||||
extern void dw_console_c_buff_array_free();
|
||||
|
||||
@@ -428,40 +428,44 @@ void PrintWork::set_text_position(float_t column, float_t line) {
|
||||
text_current_loc = line_origin_loc;
|
||||
}
|
||||
|
||||
void PrintWork::printf(app::text_flags flags, const char* fmt, ...) {
|
||||
void PrintWork::printf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(flags, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void PrintWork::printf_align_left(const char* fmt, ...) {
|
||||
void PrintWork::printf_align_left(_In_z_ _Printf_format_string_ const char* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vprintf(app::TEXT_FLAG_ALIGN_FLAG_LEFT, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void PrintWork::wprintf(app::text_flags flags, const wchar_t* fmt, ...) {
|
||||
void PrintWork::wprintf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const wchar_t* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vwprintf(flags, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void PrintWork::wprintf_align_left(const wchar_t* fmt, ...) {
|
||||
void PrintWork::wprintf_align_left(_In_z_ _Printf_format_string_ const wchar_t* const fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vwprintf(app::TEXT_FLAG_ALIGN_FLAG_LEFT, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void PrintWork::vprintf(app::text_flags flags, const char* fmt, va_list args) {
|
||||
void PrintWork::vprintf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, va_list args) {
|
||||
std::string buf = vsprintf_s_string(fmt, args);
|
||||
PrintText(flags, buf.data(), buf.size());
|
||||
}
|
||||
|
||||
void PrintWork::vwprintf(app::text_flags flags, const wchar_t* fmt, va_list args) {
|
||||
void PrintWork::vwprintf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const wchar_t* const fmt, va_list args) {
|
||||
std::wstring buf = vswprintf_s_string(fmt, args);
|
||||
PrintText(flags, buf.data(), buf.data() + buf.size());
|
||||
}
|
||||
|
||||
@@ -88,12 +88,16 @@ struct PrintWork {
|
||||
void SetResolutionMode(::resolution_mode value);
|
||||
void set_text_position(float_t column, float_t line);
|
||||
|
||||
void printf(app::text_flags flags, const char* fmt, ...);
|
||||
void printf_align_left(const char* fmt, ...);
|
||||
void wprintf(app::text_flags flags, const wchar_t* fmt, ...);
|
||||
void wprintf_align_left(const wchar_t* fmt, ...);
|
||||
void vprintf(app::text_flags flags, const char* fmt, va_list args);
|
||||
void vwprintf(app::text_flags flags, const wchar_t* fmt, va_list args);
|
||||
void printf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
void printf_align_left(_In_z_ _Printf_format_string_ const char* const fmt, ...);
|
||||
void wprintf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const wchar_t* const fmt, ...);
|
||||
void wprintf_align_left(_In_z_ _Printf_format_string_ const wchar_t* const fmt, ...);
|
||||
void vprintf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const char* const fmt, va_list args);
|
||||
void vwprintf(app::text_flags flags,
|
||||
_In_z_ _Printf_format_string_ const wchar_t* const fmt, va_list args);
|
||||
|
||||
static void ClampPosToClipBox(float_t pos_min, float_t pos_max,
|
||||
float_t clip_box_min, float_t clip_box_max, float_t& clip_pos_min, float_t& clip_pos_max);
|
||||
|
||||
Reference in New Issue
Block a user