Make the i18n T function use std::string_view

Buildfixes, crashfixes

One more

Android buildfix

Buildfix Qt
This commit is contained in:
Henrik Rydgård committed 2024-02-12 18:44:39 +01:00
1 parent 9322b4c6dc
commit c5791764d8
135 files changed
+436 -486

No files matched your search

+7 -7
View File
@@ -151,7 +151,7 @@ void PSPMsgDialog::FormatErrorCode(uint32_t code) {
switch (code) {
case SCE_UTILITY_SAVEDATA_ERROR_LOAD_DATA_BROKEN:
snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataDataBroken", "Save data was corrupt."), code);
snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataDataBroken", "Save data was corrupt."), code);
break;
case SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_MS:
@@ -159,23 +159,23 @@ void PSPMsgDialog::FormatErrorCode(uint32_t code) {
case SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_MS:
case SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_MS:
case SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_MS:
snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataNoMS", "Memory stick not inserted."), code);
snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataNoMS", "Memory stick not inserted."), code);
break;
case SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA:
case SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA:
case SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA:
case SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA:
snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataNoData", "Warning: no save data was found."), code);
snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataNoData", "Warning: no save data was found."), code);
break;
case SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_FULL:
case SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE:
snprintf(msgText, 512, "%s (%08x)", err->T("MsgErrorSavedataMSFull", "Memory stick full. Check your storage space."), code);
snprintf(msgText, 512, "%s (%08x)", err->T_cstr("MsgErrorSavedataMSFull", "Memory stick full. Check your storage space."), code);
break;
default:
snprintf(msgText, 512, "%s %08x", err->T("MsgErrorCode", "Error code:"), code);
snprintf(msgText, 512, "%s %08x", err->T_cstr("MsgErrorCode", "Error code:"), code);
}
}
@@ -187,7 +187,7 @@ void PSPMsgDialog::DisplayMessage(const std::string &text, bool hasYesNo, bool h
// Without the scrollbar, we have 390 total pixels.
float WRAP_WIDTH = 340.0f;
if ((size_t)UTF8StringNonASCIICount(text.c_str()) >= text.size() / 4) {
if ((size_t)UTF8StringNonASCIICount(text) >= text.size() / 4) {
WRAP_WIDTH = 376.0f;
if (text.size() > 12) {
messageStyle.scale = 0.6f;
@@ -195,7 +195,7 @@ void PSPMsgDialog::DisplayMessage(const std::string &text, bool hasYesNo, bool h
}
float totalHeight = 0.0f;
PPGeMeasureText(nullptr, &totalHeight, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH);
PPGeMeasureText(nullptr, &totalHeight, text, FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH);
// The PSP normally only shows about 8 lines at a time.
// For improved UX, we intentionally show part of the next line.
float visibleHeight = std::min(totalHeight, 175.0f);