diff --git a/Common/Data/Encoding/Utf8.cpp b/Common/Data/Encoding/Utf8.cpp index 0e2b934a22..8f839b8882 100644 --- a/Common/Data/Encoding/Utf8.cpp +++ b/Common/Data/Encoding/Utf8.cpp @@ -531,17 +531,17 @@ size_t encode_utf8_modified(uint32_t code_point, unsigned char* output) { return 0; } -// A function to convert regular UTF-8 to Java Modified UTF-8 +// A function to convert regular UTF-8 to Java Modified UTF-8. Only used on Android. // Written by ChatGPT and corrected and modified. void ConvertUTF8ToJavaModifiedUTF8(std::string *output, std::string_view input) { output->resize(input.size() * 6); // worst case: every character is encoded as 6 bytes size_t out_idx = 0; for (size_t i = 0; i < input.length(); ) { unsigned char c = input[i]; - if (c == 0x00) { + if (c == 0) { // Encode null character as 0xC0 0x80. TODO: We probably don't need to support this? - output[out_idx++] = 0xC0; - output[out_idx++] = 0x80; + output[out_idx++] = (char)0xC0; + output[out_idx++] = (char)0x80; i++; } else if ((c & 0xF0) == 0xF0) { // 4-byte sequence (U+10000 to U+10FFFF) // Decode the Unicode code point from the UTF-8 sequence @@ -562,9 +562,11 @@ void ConvertUTF8ToJavaModifiedUTF8(std::string *output, std::string_view input) } else { // Copy the other UTF-8 sequences (1-3 bytes) size_t utf8_len = 1; - if ((c & 0xE0) == 0xC0) utf8_len = 2; // 2-byte sequence - else if ((c & 0xF0) == 0xE0) utf8_len = 3; // 3-byte sequence - + if ((c & 0xE0) == 0xC0) { + utf8_len = 2; // 2-byte sequence + } else if ((c & 0xF0) == 0xE0) { + utf8_len = 3; // 3-byte sequence + } memcpy(output->data() + out_idx, input.data() + i, utf8_len); out_idx += utf8_len; i += utf8_len; diff --git a/Common/Render/Text/draw_text_android.cpp b/Common/Render/Text/draw_text_android.cpp index f7df51552e..5c8f8765bb 100644 --- a/Common/Render/Text/draw_text_android.cpp +++ b/Common/Render/Text/draw_text_android.cpp @@ -91,8 +91,8 @@ void TextDrawerAndroid::MeasureStringInternal(std::string_view str, float *w, fl uint32_t size = env->CallStaticIntMethod(cls_textRenderer, method_measureText, jstr, scaledSize); env->DeleteLocalRef(jstr); - *w = size >> 16; - *h = size & 0xFFFF; + *w = (float)(size >> 16); + *h = (float)(size & 0xFFFF); WARN_LOG(Log::G3D, "Measure Modified: '%.*s' size: %fx%f", (int)text.length(), text.data(), *w, *h); } @@ -103,8 +103,7 @@ bool TextDrawerAndroid::DrawStringBitmap(std::vector &bitmapData, TextS return false; } - - double size = 0.0; + float size = 0.0f; auto iter = fontMap_.find(fontHash_); if (iter != fontMap_.end()) { size = iter->second.size; diff --git a/Common/Render/Text/draw_text_android.h b/Common/Render/Text/draw_text_android.h index 3d14e31f9f..24360b23f1 100644 --- a/Common/Render/Text/draw_text_android.h +++ b/Common/Render/Text/draw_text_android.h @@ -10,7 +10,7 @@ #include struct AndroidFontEntry { - double size; + float size; }; class TextDrawerAndroid : public TextDrawer { diff --git a/Windows/CaptureDevice.cpp b/Windows/CaptureDevice.cpp index 93376078c8..c002fce593 100644 --- a/Windows/CaptureDevice.cpp +++ b/Windows/CaptureDevice.cpp @@ -202,9 +202,9 @@ HRESULT ReaderCallback::OnReadSample( // Mirror the image in-place if needed. if (g_Config.bCameraMirrorHorizontal) { - for (int y = 0; y < dstH; y++) { + for (int y = 0; y < (int)dstH; y++) { uint8_t *line = device->imageRGB + y * device->imgRGBLineSizes[0]; - for (int x = 0; x < dstW / 2; x++) { + for (int x = 0; x < (int)dstW / 2; x++) { const int invX = dstW - 1 - x; const uint8_t r = line[x * 3 + 0]; const uint8_t g = line[x * 3 + 1]; diff --git a/assets/compat.ini b/assets/compat.ini index beabb9aa6b..c86e513f86 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -473,6 +473,9 @@ ULES00703 = true ULJM05940 = true NPJH50794 = true +# Cave Story (homebrew) +CAVE00992 = true + # TODO: There are many more. [RequireBlockTransfer]