diff --git a/picodrive-make b/picodrive-make index 0be4925..d1344cd 100644 --- a/picodrive-make +++ b/picodrive-make @@ -180,6 +180,10 @@ ifneq ($(ROMFS),) export _3DSXFLAGS += --romfs=$(APP_ROMFS) endif +ifneq ($(RELEASE),) + CXXFLAGS += -DEMU_RELEASE +endif + #--------------------------------------------------------------------------------- # OS detection to automatically determine the correct makerom variant to use for # CIA creation diff --git a/readme-picodrive.md b/readme-picodrive.md index 699afe4..533754d 100644 --- a/readme-picodrive.md +++ b/readme-picodrive.md @@ -72,6 +72,7 @@ This emulator uses the same user interface as VirtuaNES for 3DS, TemperPCE for 3 ### v0.95c - Fully Simplified Chinese support, big thx to [xxxxst](https://github.com/xxxxst) - Now will sort files by Chinese Pinyin +- UI: Improve line breaks, bug fix for "\n" as line breaks - Implement standard/ssf2 mapper. This fix "Demons Of Asteborg", "Astebros" and etc - Fix config saving - Fix crashing when exit from CIA version diff --git a/readme-temperpce.md b/readme-temperpce.md index 697ad75..ad9c9a7 100644 --- a/readme-temperpce.md +++ b/readme-temperpce.md @@ -60,6 +60,7 @@ This emulator bears the same user interface as VirtuaNES for 3DS and Snes9x for ### v1.03c - Fully Simplified Chinese support, big thx to [xxxxst](https://github.com/xxxxst) - Now will sort files by Chinese Pinyin +- UI: Improve line breaks, bug fix for "\n" as line breaks - Fix config saving - Fix crashing when exit from CIA version diff --git a/readme-virtuanes.md b/readme-virtuanes.md index 2866db8..087152d 100644 --- a/readme-virtuanes.md +++ b/readme-virtuanes.md @@ -55,6 +55,7 @@ It also runs on your New 3DS as well! ### v1.03c - Fully Simplified Chinese support, big thx to [xxxxst](https://github.com/xxxxst) - Now will sort files by Chinese Pinyin +- UI: Improve line breaks, bug fix for "\n" as line breaks - Fix config saving - Fix crashing when exit from CIA version - Add embedded input redirect server to support 2 players, thx [CarlosEFML](https://github.com/CarlosEFML) diff --git a/src/3ds/3dsui.cpp b/src/3ds/3dsui.cpp index d1e1bdf..dd8f9f0 100644 --- a/src/3ds/3dsui.cpp +++ b/src/3ds/3dsui.cpp @@ -537,9 +537,9 @@ void ui3dsDrawStringWithWrapping(int x0, int y0, int x1, int y1, int color, int int slen = strlen(buffer); int curStartPos = 0; - int curEndPos = slen - 1; - int lineWidth = 0; - for (int i = 0; i < slen; ) + int curEndPos = slen + uint16 lineWidth = 0; + for (int i = 0; i <= slen; ) { if (i != curStartPos) { @@ -550,10 +550,32 @@ void ui3dsDrawStringWithWrapping(int x0, int y0, int x1, int y1, int color, int else if (buffer[i] == '\n') // \n as line breaks. { curEndPos = i - 1; - lineWidth = 999999; // force the line break. + lineWidth = 65535; // force the line break. } } - lineWidth += fontWidth[buffer[i]]; + + // check utf8 char is chinese + if((buffer[i] & 0xF0) == 0xE0 && i <= slen - 2) { + uint8 c2 = buffer[i + 1]; + uint8 c3 = buffer[i + 2]; + + uint16 chUtf8 = ((buffer[i] & 0x0F) << 12) + | ((c2 & 0x3F) << 6) + | ((c3 & 0x3F)); + uint16 chGBK = getGbkChar(chUtf8); + + uint8 cg1 = (chGBK & 0xFF00) >> 8; + uint8 cg2 = (chGBK & 0x00FF); + + if(cg1 >= gbkRowStart && cg1 <= gbkRowEnd + && cg2 >= gbkColStart && cg2 <= gbkColEnd) { + lineWidth += 12; + i += 2; + } else + lineWidth += fontWidth[buffer[i]]; + } else + lineWidth += fontWidth[buffer[i]]; + if (lineWidth > maxWidth) { // Break the line here @@ -563,26 +585,22 @@ void ui3dsDrawStringWithWrapping(int x0, int y0, int x1, int y1, int color, int if (strLineCount >= 30) break; - if (lineWidth != 999999) + if (lineWidth != 65535) { i = curEndPos + 1; while (buffer[i] == ' ') i++; - } - else - { + } else i = curEndPos + 2; - } curStartPos = i; - curEndPos = slen - 1; + curEndPos = slen; lineWidth = 0; - } - else + } else i++; } // Output the last line. - curEndPos = slen - 1; + curEndPos = slen; if (curStartPos <= curEndPos) { strLineStart[strLineCount] = curStartPos; diff --git a/temperpce-make b/temperpce-make index 4e07ecf..7c17fc6 100644 --- a/temperpce-make +++ b/temperpce-make @@ -157,6 +157,10 @@ ifneq ($(ROMFS),) export _3DSXFLAGS += --romfs=$(APP_ROMFS) endif +ifneq ($(RELEASE),) + CXXFLAGS += -DEMU_RELEASE +endif + #--------------------------------------------------------------------------------- # OS detection to automatically determine the correct makerom variant to use for # CIA creation diff --git a/virtuanes-make b/virtuanes-make index efbc1e4..50b3359 100644 --- a/virtuanes-make +++ b/virtuanes-make @@ -163,6 +163,10 @@ ifneq ($(ROMFS),) export _3DSXFLAGS += --romfs=$(APP_ROMFS) endif +ifneq ($(RELEASE),) + CXXFLAGS += -DEMU_RELEASE +endif + #--------------------------------------------------------------------------------- # OS detection to automatically determine the correct makerom variant to use for # CIA creation