mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
Use u8string for imgui
This commit is contained in:
parent
481c3d0640
commit
4fd41bfb39
@ -29,15 +29,12 @@ struct UTF {
|
|||||||
data = T{(const char*)&view.front(), (const char*)&view.back()};
|
data = T{(const char*)&view.front(), (const char*)&view.back()};
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit UTF(const std::u8string& str)
|
explicit UTF(const std::u8string& str) : UTF(std::u8string_view{str}) {}
|
||||||
: UTF(std::u8string_view{str}) {
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
} // namespace fmt
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct fmt::formatter<fmt::UTF<std::string_view>, char>
|
struct fmt::formatter<fmt::UTF<std::string_view>, char> : formatter<std::string_view> {
|
||||||
: formatter<std::string_view> {
|
|
||||||
template <typename FormatContext>
|
template <typename FormatContext>
|
||||||
auto format(const UTF<std::string_view>& wrapper, FormatContext& ctx) const {
|
auto format(const UTF<std::string_view>& wrapper, FormatContext& ctx) const {
|
||||||
return formatter<std::string_view>::format(wrapper.data, ctx);
|
return formatter<std::string_view>::format(wrapper.data, ctx);
|
||||||
|
@ -52,13 +52,15 @@ void Initialize(const ::Vulkan::Instance& instance, const Frontend::WindowSDL& w
|
|||||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
io.DisplaySize = ImVec2((float)window.getWidth(), (float)window.getHeight());
|
io.DisplaySize = ImVec2((float)window.getWidth(), (float)window.getHeight());
|
||||||
|
|
||||||
using native_char = std::filesystem::path::value_type;
|
auto path = config_path.u8string();
|
||||||
io.IniFilename = new char[config_path.native().size() * sizeof(native_char)];
|
char* config_file_buf = new char[path.size() + 1]();
|
||||||
io.LogFilename = new char[log_path.native().size() * sizeof(native_char)];
|
std::memcpy(config_file_buf, path.c_str(), path.size());
|
||||||
std::memcpy((void*)io.IniFilename, config_path.native().c_str(),
|
io.IniFilename = config_file_buf;
|
||||||
config_path.native().size() * sizeof(native_char));
|
|
||||||
std::memcpy((void*)io.LogFilename, log_path.native().c_str(),
|
path = log_path.u8string();
|
||||||
log_path.native().size() * sizeof(native_char));
|
char* log_file_buf = new char[path.size() + 1]();
|
||||||
|
std::memcpy(log_file_buf, path.c_str(), path.size());
|
||||||
|
io.LogFilename = log_file_buf;
|
||||||
|
|
||||||
ImFontGlyphRangesBuilder rb{};
|
ImFontGlyphRangesBuilder rb{};
|
||||||
rb.AddRanges(io.Fonts->GetGlyphRangesDefault());
|
rb.AddRanges(io.Fonts->GetGlyphRangesDefault());
|
||||||
@ -116,8 +118,8 @@ void Shutdown(const vk::Device& device) {
|
|||||||
Sdl::Shutdown();
|
Sdl::Shutdown();
|
||||||
DestroyContext();
|
DestroyContext();
|
||||||
|
|
||||||
SDL_free(ini_filename);
|
delete[] (char*)ini_filename;
|
||||||
SDL_free(log_filename);
|
delete[] (char*)log_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProcessEvent(SDL_Event* event) {
|
bool ProcessEvent(SDL_Event* event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user