diff options
-rw-r--r-- | backends/platform/PalmOS/Src/be_os5.cpp | 4 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.cpp | 6 | ||||
-rw-r--r-- | backends/platform/ds/arm9/source/osystem_ds.h | 4 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.cpp | 3 | ||||
-rw-r--r-- | backends/platform/iphone/osys_iphone.h | 2 | ||||
-rw-r--r-- | backends/platform/null/null.cpp | 5 | ||||
-rw-r--r-- | backends/platform/psp/osys_psp.cpp | 6 | ||||
-rw-r--r-- | backends/platform/psp/osys_psp.h | 2 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 19 | ||||
-rw-r--r-- | backends/platform/symbian/src/SymbianOS.cpp | 1 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.cpp | 2 | ||||
-rw-r--r-- | common/system.h | 12 |
12 files changed, 26 insertions, 40 deletions
diff --git a/backends/platform/PalmOS/Src/be_os5.cpp b/backends/platform/PalmOS/Src/be_os5.cpp index aa578dad9c..91e9818c02 100644 --- a/backends/platform/PalmOS/Src/be_os5.cpp +++ b/backends/platform/PalmOS/Src/be_os5.cpp @@ -115,6 +115,10 @@ void OSystem_PalmOS5::setFeatureState(Feature f, bool enable) { } void OSystem_PalmOS5::setWindowCaption(const char *caption) { +FIXME/TODO: Convert caption from ISO Latin 1 to "right" encoding ? +If the output encoding is unclear or conversion impossible, +then one could just skip over any chars > 0x7F and display the rest + Err e; Char buf[64]; Coord w, y, h = FntLineHeight() + 2; diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index e35e5edea0..954a33b61d 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -642,12 +642,6 @@ void OSystem_DS::quit() { swiSoftReset();*/ } -void OSystem_DS::setWindowCaption(const char *caption) { -} - -void OSystem_DS::displayMessageOnOSD(const char *msg) { -} - Common::SaveFileManager* OSystem_DS::getSavefileManager() { bool forceSram; diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 5a26a25c8b..3db23a5687 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -134,10 +134,6 @@ public: virtual void quit(); - virtual void setWindowCaption(const char *caption); - - virtual void displayMessageOnOSD(const char *msg); - virtual Common::SaveFileManager *getSavefileManager(); void addEvent(Common::Event& e); diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index 4b5201d560..7f30c0caaf 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -1210,9 +1210,6 @@ void OSystem_IPHONE::getTimeAndDate(struct tm &t) const { t = *localtime(&curTime); } -void OSystem_IPHONE::setWindowCaption(const char *caption) { -} - Common::SaveFileManager *OSystem_IPHONE::getSavefileManager() { assert(_savefile); return _savefile; diff --git a/backends/platform/iphone/osys_iphone.h b/backends/platform/iphone/osys_iphone.h index ceb2102a5f..705f89319a 100644 --- a/backends/platform/iphone/osys_iphone.h +++ b/backends/platform/iphone/osys_iphone.h @@ -171,8 +171,6 @@ public: virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); virtual void getTimeAndDate(struct tm &t) const; - virtual void setWindowCaption(const char *caption); - virtual Common::SaveFileManager *getSavefileManager(); virtual Audio::Mixer *getMixer(); virtual Common::TimerManager *getTimerManager(); diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp index 304b7e80eb..ca4eda9158 100644 --- a/backends/platform/null/null.cpp +++ b/backends/platform/null/null.cpp @@ -113,8 +113,6 @@ public: virtual void quit(); - virtual void setWindowCaption(const char *caption); - virtual Common::SaveFileManager *getSavefileManager(); virtual Audio::Mixer *getMixer(); virtual void getTimeAndDate(struct tm &t) const; @@ -308,9 +306,6 @@ bool OSystem_NULL::setSoundCallback(SoundProc proc, void *param) { void OSystem_NULL::quit() { } -void OSystem_NULL::setWindowCaption(const char *caption) { -} - Common::SaveFileManager *OSystem_NULL::getSavefileManager() { assert(_savefile); return _savefile; diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 63ea5bc0dc..45be0a0cd3 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -635,12 +635,6 @@ void OSystem_PSP::getTimeAndDate(struct tm &t) const { t = *localtime(&curTime); } -void OSystem_PSP::setWindowCaption(const char *caption) { -} - -void OSystem_PSP::displayMessageOnOSD(const char *msg) { -} - #define PSP_CONFIG_FILE "ms0:/scummvm.ini" Common::SeekableReadStream *OSystem_PSP::createConfigReadStream() { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index 7abba332df..bdbc43495c 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -140,8 +140,6 @@ public: virtual void quit(); - virtual void setWindowCaption(const char *caption); - virtual void displayMessageOnOSD(const char *msg); virtual Common::SeekableReadStream *createConfigReadStream(); diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index c11c97c041..af6d350688 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -391,13 +391,20 @@ Common::WriteStream *OSystem_SDL::createConfigWriteStream() { } void OSystem_SDL::setWindowCaption(const char *caption) { - Common::String cap(caption); + Common::String cap; + byte c; + + // The string caption is supposed to be in LATIN-1 encoding. + // SDL expects UTF-8. So we perform the conversion here. + while ((c = *(const byte *)caption++)) { + if (c < 0x80) + cap += c; + else { + cap += 0xc0 | (c >> 6); + cap += 0x80 | (c & 0x3F); + } + } - // Filter out any non-ASCII characters, replacing them by question marks. - // At some point, we may wish to allow LATIN 1 or UTF-8. - for (uint i = 0; i < cap.size(); ++i) - if ((byte)cap[i] > 0x7F) - cap.setChar('?', i); SDL_WM_SetCaption(cap.c_str(), cap.c_str()); } diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 452f730110..6a8a46df07 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -472,6 +472,7 @@ bool OSystem_SDL_Symbian::remapKey(SDL_Event &ev, Common::Event &event) { void OSystem_SDL_Symbian::setWindowCaption(const char *caption) { OSystem_SDL::setWindowCaption(caption); check_mappings(); +FIXME: move check_mappings() call to engineInit() & engineDone() } void OSystem_SDL_Symbian::check_mappings() { diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 344edd7143..b8261d029e 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -916,6 +916,8 @@ void OSystem_WINCE3::setWindowCaption(const char *caption) { compute_sample_rate(); setupMixer(); +FIXME: move check_mappings() etc. calls to engineInit() & engineDone() + // handle the actual event OSystem_SDL::setWindowCaption(caption); } diff --git a/common/system.h b/common/system.h index bfec20e319..a8f3b1c903 100644 --- a/common/system.h +++ b/common/system.h @@ -886,13 +886,11 @@ public: /** * Set a window caption or any other comparable status display to the - * given value. The caption must be a pure ASCII string. Passing a - * non-ASCII string may lead to unexpected behavior, even crashes. + * given value. The caption must be a pure ISO LATIN 1 string. Passing a + * string with a different encoding may lead to unexpected behavior, + * even crashes. * - * In a future revision of this API, this may be changed to allowing - * UTF-8 or UTF-16 encoded data, or maybe ISO LATIN 1. - * - * @param caption the window caption to use, as an ASCII string + * @param caption the window caption to use, as an ISO LATIN 1 string */ virtual void setWindowCaption(const char *caption) {} @@ -902,6 +900,8 @@ public: * rectangle over the regular screen content; or in a message box beneath * it; etc.). * + * Currently, only pure ASCII messages can be expected to show correctly. + * * @note There is a default implementation which uses a TimedMessageDialog * to display the message. Hence implementing this is optional. * |