Skip to content

Commit

Permalink
Fix build error (Part 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Jan 16, 2024
1 parent 540d4e6 commit ada7249
Show file tree
Hide file tree
Showing 17 changed files with 182 additions and 92 deletions.
2 changes: 1 addition & 1 deletion crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_id_env: BOOTSTRAP_CROWDIN_ID
project_id: 452474
api_token_env: CROWDIN_TOKEN
preserve_hierarchy: true

Expand Down
9 changes: 6 additions & 3 deletions retail/arm9/source/conf_sd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ void getIgmStrings(configuration* conf, bool b4ds) {
extendedFont = IgmFont::arabic;
extendedFontPath = "nitro:/fonts/arabic.lz77";
igmText->rtl = true;
} else if (strncmp(conf->guiLanguage, "zh", 2) == 0) {
extendedFont = IgmFont::chinese;
extendedFontPath = "nitro:/fonts/chinese.lz77";
} else if (strcmp(conf->guiLanguage, "ru") == 0 || strcmp(conf->guiLanguage, "uk") == 0) {
extendedFont = IgmFont::cyrillic;
extendedFontPath = "nitro:/fonts/cyrillic.lz77";
Expand All @@ -354,9 +357,9 @@ void getIgmStrings(configuration* conf, bool b4ds) {
} else if (strcmp(conf->guiLanguage, "ja") == 0 || strcmp(conf->guiLanguage, "ry") == 0) {
extendedFont = IgmFont::japanese;
extendedFontPath = "nitro:/fonts/japanese.lz77";
} else if (strncmp(conf->guiLanguage, "zh", 2) == 0) {
extendedFont = IgmFont::chinese;
extendedFontPath = "nitro:/fonts/chinese.lz77";
} else if (strncmp(conf->guiLanguage, "vi", 2) == 0) {
extendedFont = IgmFont::vietnamese;
extendedFontPath = "nitro:/fonts/vietnamese.lz77";
}

FILE *font = fopen("nitro:/fonts/ascii.lz77", "rb");
Expand Down
66 changes: 45 additions & 21 deletions retail/arm9/source/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

IgmFont extendedFont = IgmFont::extendedLatin;

constexpr char16_t mapAscii[] =
u"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
u"ẲẴẪỶỸỴ\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
u" !\"#$%&'()*+,-./"
u"0123456789:;<=>?"
u"@ABCDEFGHIJKLMNO"
u"PQRSTUVWXYZ[\\]^_"
u"`abcdefghijklmno"
u"pqrstuvwxyz{|}~\x7F";

constexpr char16_t mapArabic[] =
u"ءآأؤإئابةتثجحخدذ"
u"رزسشصضطظعغـفقكلم"
Expand All @@ -16,6 +26,13 @@ constexpr char16_t mapArabic[] =
u"ﻔﻖﻗﻘﻚﻛﻜﻞﻟﻠﻢﻣﻤﻦﻧﻨ"
u"ﻪﻫﻬﻮﻰﻲﻳﻴ،؟ﻻﻼ";

constexpr char16_t mapChinese[] =
u"主书亮位儲出到动動区器回图圖地址"
u"块存定屏幕底度式戏截戲择擇数數时"
u"明显時書查模檢游率界畫目看移端置"
u"自至螢視計設說说跳轉转返退选遊選"
u"部重量鐘钟開離面音頂頻顶项频 ";

constexpr char16_t mapCyrillic[] =
u"ЂЃ ѓ Љ ЊЌЋЏ"
u"ђ љ њќћџ"
Expand Down Expand Up @@ -68,22 +85,27 @@ constexpr char16_t mapJapanese[] =
u"上下主了動定度戻択数明書画終自設"
u"説速選量面音";

constexpr char16_t mapChinese[] =
u"主书亮位儲出到动動区器回图圖地址"
u"块存定屏幕底度式戏截戲择擇数數时"
u"明显時書查模檢游率界畫目看移端置"
u"自至螢視計設說说跳轉转返退选遊選"
u"部重量鐘钟開離面音頂頻顶项频 ";
constexpr char16_t mapVietnamese[] =
u"ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐ"
u"ỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲ"
u"Õắằặấầẩậẽẹếềểễệố"
u"ồổỗỠƠộờởịỰỨỪỬơớƯ"
u"ÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳ"
u"ĐứÒÓÔạỷừửÙÚỹỵÝỡư"
u"àáâãảăữẫèéêẻìíĩỉ"
u"đựòóôõỏọụùúũủýợỮ";


constexpr const char16_t *extendedMaps[] = {
mapArabic,
mapChinese,
mapCyrillic,
mapExtendedLatin,
mapGreek,
mapHangul,
mapHebrew,
mapJapanese,
mapChinese
mapVietnamese
};

std::map<char16_t, std::array<char16_t, 3>> arabicPresentationForms = {
Expand Down Expand Up @@ -135,13 +157,15 @@ std::map<char16_t, std::array<char16_t, 3>> arabicPresentationForms = {

// Can't do a binary search as the maps aren't fully sorted
constexpr char getIndex(char16_t c) {
if(c < 0x80) { // ASCII is left as is
return c;
} else {
for(uint i = 0; i < 0x80; i++) {
if(c == extendedMaps[u8(extendedFont)][i]) {
return 0x80 + i;
}
for(uint i = 0; i < 0x80; i++) {
if(c == mapAscii[i]) {
return i;
}
}

for(uint i = 0; i < 0x80; i++) {
if(c == extendedMaps[u8(extendedFont)][i]) {
return 0x80 + i;
}
}

Expand Down Expand Up @@ -208,7 +232,7 @@ void processRTL(unsigned char *begin, unsigned char *end) {
}
}

char16_t c = *p < 0x80 ? *p : extendedMaps[u8(extendedFont)][(*p) - 0x80];
char16_t c = *p < 0x80 ? mapAscii[*p] : extendedMaps[u8(extendedFont)][(*p) - 0x80];
nocashMessage(("a" + std::to_string(c)).c_str());

// If at the end of an LTR section within RTL, jump back to the RTL
Expand All @@ -217,7 +241,7 @@ void processRTL(unsigned char *begin, unsigned char *end) {
break;

p = ltrBegin;
c = *p < 0x80 ? *p : extendedMaps[u8(extendedFont)][(*p) - 0x80];
c = *p < 0x80 ? mapAscii[*p] : extendedMaps[u8(extendedFont)][(*p) - 0x80];
ltrBegin = end;
rtl = true;
// If in RTL and hit a non-RTL character that's not punctuation, switch to LTR
Expand All @@ -233,7 +257,7 @@ void processRTL(unsigned char *begin, unsigned char *end) {
if(allNumbers && !isNumber(c) && !isWeak(c))
allNumbers = false;
p--;
c = *p < 0x80 ? *p : extendedMaps[u8(extendedFont)][(*p) - 0x80];
c = *p < 0x80 ? mapAscii[*p] : extendedMaps[u8(extendedFont)][(*p) - 0x80];
}

// Save where we are to return to after printing the LTR section
Expand All @@ -242,7 +266,7 @@ void processRTL(unsigned char *begin, unsigned char *end) {
// If on an RTL char right now, add one
if(isStrongRTL(c)) {
p++;
c = *p < 0x80 ? *p : extendedMaps[u8(extendedFont)][(*p) - 0x80];
c = *p < 0x80 ? mapAscii[*p] : extendedMaps[u8(extendedFont)][(*p) - 0x80];
}

// Remove all punctuation and, if the section isn't only numbers,
Expand All @@ -252,14 +276,14 @@ void processRTL(unsigned char *begin, unsigned char *end) {
if(p != begin)
ltrBegin++;
p++;
c = *p < 0x80 ? *p : extendedMaps[u8(extendedFont)][(*p) - 0x80];
c = *p < 0x80 ? mapAscii[*p] : extendedMaps[u8(extendedFont)][(*p) - 0x80];
}
} else {
while(isWeak(c)) {
if(p != begin)
ltrBegin++;
p++;
c = *p < 0x80 ? *p : extendedMaps[u8(extendedFont)][(*p) - 0x80];
c = *p < 0x80 ? mapAscii[*p] : extendedMaps[u8(extendedFont)][(*p) - 0x80];
}
}

Expand All @@ -269,7 +293,7 @@ void processRTL(unsigned char *begin, unsigned char *end) {
ltrBegin--;
p--;
}
c = *p < 0x80 ? *p : extendedMaps[u8(extendedFont)][(*p) - 0x80];
c = *p < 0x80 ? mapAscii[*p] : extendedMaps[u8(extendedFont)][(*p) - 0x80];

rtl = false;
}
Expand Down
15 changes: 8 additions & 7 deletions retail/common/include/igm_text.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ static_assert(sizeof(IgmText) == 0xA0C, "IgmText is too big! Allocate more space

enum class IgmFont : u8 {
arabic = 0,
cyrillic = 1,
extendedLatin = 2,
greek = 3,
hangul = 4,
hebrew = 5,
japanese = 6,
chinese = 7
chinese = 1,
cyrillic = 2,
extendedLatin = 3,
greek = 4,
hangul = 5,
hebrew = 6,
japanese = 7,
vietnamese = 8
};
#endif

Expand Down
Binary file modified retail/nitrofiles/fonts/ascii.lz77
Binary file not shown.
Binary file added retail/nitrofiles/fonts/vietnamese.lz77
Binary file not shown.
8 changes: 4 additions & 4 deletions retail/nitrofiles/languages/ar/in_game_menu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ COUNT=عدد:
RETURN_TO_GAME=العودة الى اللعبة
RESET_GAME=إعادة تعيين اللعبة
SCREENSHOT=لقطة شاشة...
MANUAL=Manual...
DUMP_RAM=Dump RAM
MANUAL=دليل...
DUMP_RAM=إيداع RAM
OPTIONS=خيارات...
RAM_VIEWER=عارض RAM...
QUIT_GAME=إنهاء اللعبة

[OPTIONS]
MAIN_SCREEN=الشاشة الرئيسية
BRIGHTNESS=Brightness
VOLUME=Volume
BRIGHTNESS=إضاءة
VOLUME=الصوت
CLOCK_SPEED=معدل ساعة
VRAM_MODE=وضع VRAM

Expand Down
31 changes: 31 additions & 0 deletions retail/nitrofiles/languages/cs/in_game_menu.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[TITLES]
RAM_VIEWER=Prohlížeč RAM
JUMP_ADDRESS=Skok na Adresu
SELECT_BANK=Výběr Banky VRAM
COUNT=Počet:

[MENU]
RETURN_TO_GAME=Zpět do Hry
RESET_GAME=Obnovení Hry
SCREENSHOT=Snímek...
MANUAL=Malá Příručka...
DUMP_RAM=Výpis RAM
OPTIONS=Způsoby...
RAM_VIEWER=Prohlížeč RAM...
QUIT_GAME=Přerušit Hru

[OPTIONS]
MAIN_SCREEN=Brinský Výběr
BRIGHTNESS=Jasnost
VOLUME=Pracujte
CLOCK_SPEED=Rychlost Hodin
VRAM_MODE=Režim VRAM

AUTO=Autom
BOTTOM=Pozemek
TOP=Primární
67_MHZ=67 MHz
133_MHZ=133 MHz
DS_MODE=Režim DS
DSI_MODE=Režim DSi

6 changes: 3 additions & 3 deletions retail/nitrofiles/languages/da/in_game_menu.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ COUNT=Antal:
RETURN_TO_GAME=Tilbage til spil
RESET_GAME=Nulstil spil
SCREENSHOT=Skærmbillede...
MANUAL=Manual...
MANUAL=Vejledning...
DUMP_RAM=Dump RAM
OPTIONS=Indstillinger...
RAM_VIEWER=RAM-fremviser...
QUIT_GAME=Afslut spil

[OPTIONS]
MAIN_SCREEN=Primær skærm
BRIGHTNESS=Brightness
VOLUME=Volume
BRIGHTNESS=Belysning
VOLUME=Styrke
CLOCK_SPEED=CPU-hastighed
VRAM_MODE=VRAM-tilstand

Expand Down
28 changes: 14 additions & 14 deletions retail/nitrofiles/languages/el/in_game_menu.ini
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
[TITLES]
RAM_VIEWER=RAM Viewer
JUMP_ADDRESS=Jump to Address
SELECT_BANK=Select VRAM Bank
COUNT=Count:
RAM_VIEWER=Παρατηρητής RAM
JUMP_ADDRESS=Εμπόδιο σε Δ/νση
SELECT_BANK=Επιλέξτε Τράπ. VRAM
COUNT=Υπολογισμός:

[MENU]
RETURN_TO_GAME=Πίσω στο παιχνίδι
RESET_GAME=Reset Game
RESET_GAME=Παιχνίδι Επαν.
SCREENSHOT=Στιγμιότυπο...
MANUAL=Manual...
DUMP_RAM=Dump RAM
MANUAL=Οδηγός...
DUMP_RAM=Ξεφορτώστε τη RAM
OPTIONS=Επιλογές...
RAM_VIEWER=RAM Viewer...
QUIT_GAME=Quit Game
RAM_VIEWER=Παρατηρητής RAM...
QUIT_GAME=Παύση Παιχνιδιού

[OPTIONS]
MAIN_SCREEN=Main Screen
BRIGHTNESS=Brightness
VOLUME=Volume
MAIN_SCREEN=Κύρια Οθόνη
BRIGHTNESS=Φωτισμός
VOLUME=Ισχύς
CLOCK_SPEED=Ταχύτητα Ρολογιού
VRAM_MODE=Λειτ. VRAM

AUTO=Αυτόματο
BOTTOM=Bottom
TOP=Top
BOTTOM=Έδαφος
TOP=Επικεφαλής
67_MHZ=67 MHz
133_MHZ=133 MHz
DS_MODE=Λειτουργία DS
Expand Down
31 changes: 31 additions & 0 deletions retail/nitrofiles/languages/fi/in_game_menu.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[TITLES]
RAM_VIEWER=RAM-valvoja
JUMP_ADDRESS=Hyppää Osoitteeseen
SELECT_BANK=Päätä VRAM-pankki
COUNT=Tiemaksu:

[MENU]
RETURN_TO_GAME=Tule Peliin
RESET_GAME=Aloita Peli
SCREENSHOT=Näytön Kaappaus...
MANUAL=Opas...
DUMP_RAM=Talletus RAM
OPTIONS=Valintoja...
RAM_VIEWER=RAM-valvoja...
QUIT_GAME=Jätä Peli

[OPTIONS]
MAIN_SCREEN=Tärkein Näyttö
BRIGHTNESS=Loistokkuus
VOLUME=Äänitaso
CLOCK_SPEED=Kellon Vauhti
VRAM_MODE=Lähestymistapa VRAM

AUTO=Mekaaninen
BOTTOM=Alhaisin
TOP=Korkein
67_MHZ=67 MHz
133_MHZ=133 MHz
DS_MODE=Lähestymistapa DS
DSI_MODE=Lähestymistapa DSi

16 changes: 8 additions & 8 deletions retail/nitrofiles/languages/nl/in_game_menu.ini
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[TITLES]
RAM_VIEWER=RAM Bekijken
JUMP_ADDRESS=Ga naar adres
RAM_VIEWER=RAM-viewer
JUMP_ADDRESS=Ga naar Adres
SELECT_BANK=Kies VRAM Bank
COUNT=Aantal:

[MENU]
RETURN_TO_GAME=Terug naar het Spel
RESET_GAME=Reset spel
RESET_GAME=Reset Spel
SCREENSHOT=Screenshot...
MANUAL=Handleiding...
DUMP_RAM=Dump RAM
OPTIONS=Opties...
RAM_VIEWER=RAM Bekijken...
QUIT_GAME=Spel afsluiten
RAM_VIEWER=RAM-viewer...
QUIT_GAME=Spel Afsluiten

[OPTIONS]
MAIN_SCREEN=Hoofdscherm
BRIGHTNESS=Helderheid
VOLUME=Volume
CLOCK_SPEED=Kloksnelheid
VRAM_MODE=VRAM Modus
VRAM_MODE=VRAM-modus

AUTO=Auto
BOTTOM=Onder
TOP=Boven
67_MHZ=67 MHz
133_MHZ=133 MHz
DS_MODE=DS modus
DSI_MODE=DSi modus
DS_MODE=DS-modus
DSI_MODE=DSi-modus

Loading

0 comments on commit ada7249

Please sign in to comment.