diff options
Diffstat (limited to 'backends')
28 files changed, 190 insertions, 177 deletions
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp index 8b0a5c2e36..0440acdd0a 100644 --- a/backends/keymapper/remap-dialog.cpp +++ b/backends/keymapper/remap-dialog.cpp @@ -39,17 +39,17 @@ enum { }; RemapDialog::RemapDialog() - : Dialog("KeyRemapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0) { + : Dialog("KeyMapper"), _keymapTable(0), _activeRemapAction(0), _topAction(0), _remapTimeout(0) { _keymapper = g_system->getEventManager()->getKeymapper(); assert(_keymapper); - _kmPopUpDesc = new GUI::StaticTextWidget(this, "KeyRemapper.PopupDesc", "Keymap:"); - _kmPopUp = new GUI::PopUpWidget(this, "KeyRemapper.Popup"); + _kmPopUpDesc = new GUI::StaticTextWidget(this, "KeyMapper.PopupDesc", "Keymap:"); + _kmPopUp = new GUI::PopUpWidget(this, "KeyMapper.Popup"); _scrollBar = new GUI::ScrollBarWidget(this, 0, 0, 0, 0); - new GUI::ButtonWidget(this, "KeyRemapper.Close", "Close", kCloseCmd); + new GUI::ButtonWidget(this, "KeyMapper.Close", "Close", kCloseCmd); } RemapDialog::~RemapDialog() { @@ -138,12 +138,12 @@ void RemapDialog::reflowLayout() { int16 areaX, areaY; uint16 areaW, areaH; - int spacing = g_gui.xmlEval()->getVar("Globals.KeyRemapper.Spacing"); - int labelWidth = g_gui.xmlEval()->getVar("Globals.KeyRemapper.LabelWidth"); - int buttonWidth = g_gui.xmlEval()->getVar("Globals.KeyRemapper.ButtonWidth"); + int spacing = g_gui.xmlEval()->getVar("Globals.KeyMapper.Spacing"); + int labelWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.LabelWidth"); + int buttonWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.ButtonWidth"); int colWidth = labelWidth + buttonWidth + spacing; - g_gui.xmlEval()->getWidgetData((const String&)String("KeyRemapper.KeymapArea"), areaX, areaY, areaW, areaH); + g_gui.xmlEval()->getWidgetData((const String&)String("KeyMapper.KeymapArea"), areaX, areaY, areaW, areaH); _colCount = (areaW - scrollbarWidth) / colWidth; _rowCount = (areaH + spacing) / (buttonHeight + spacing); diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp index 5b7f071fd9..3522975679 100644 --- a/backends/midi/seq.cpp +++ b/backends/midi/seq.cpp @@ -142,7 +142,7 @@ void MidiDriver_SEQ::send(uint32 b) { warning("MidiDriver_SEQ::send: unknown : %08x", (int)b); break; } - write(device, buf, position); + (void)write(device, buf, position); } void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) { @@ -167,7 +167,7 @@ void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) { buf[position++] = _device_num; buf[position++] = 0; - write (device, buf, position); + (void)write(device, buf, position); } diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp index ecb6dd7e8a..c813441724 100644 --- a/backends/midi/timidity.cpp +++ b/backends/midi/timidity.cpp @@ -221,7 +221,7 @@ int MidiDriver_TIMIDITY::open() { * "200 Ready data connection" */ res = timidity_ctl_command(NULL); if (atoi(res) != 200) { - fprintf(stderr, "Can't connect timidity: %s\t(host=%s, port=%d)\n", res, timidity_host, data_port); + warning("Can't connect timidity: %s\t(host=%s, port=%d)", res, timidity_host, data_port); close_all(); return -1; } @@ -334,7 +334,7 @@ char *MidiDriver_TIMIDITY::timidity_ctl_command(const char *fmt, ...) { buff[len++] = '\n'; /* write command to control socket */ - write(_control_fd, buff, len); + (void)write(_control_fd, buff, len); } while (1) { 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/dc/dc.h b/backends/platform/dc/dc.h index 0ccd69593e..f86a2c6065 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -232,5 +232,5 @@ class OSystem_Dreamcast : private DCHardware, public BaseBackend, public Filesys extern int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, byte &shiftFlags, Interactive *inter = NULL); -extern bool selectGame(char *&, char *&, class Icon &); +extern bool selectGame(char *&, char *&, Common::Language &, Common::Platform &, class Icon &); diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 7a0f71ad1a..795504d243 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -234,8 +234,10 @@ int main() int DCLauncherDialog::runModal() { char *base = NULL, *dir = NULL; + Common::Language language = Common::UNK_LANG; + Common::Platform platform = Common::kPlatformUnknown; - if (!selectGame(base, dir, icon)) + if (!selectGame(base, dir, language, platform, icon)) g_system->quit(); // Set the game path. @@ -243,6 +245,14 @@ int DCLauncherDialog::runModal() if (dir != NULL) ConfMan.set("path", dir, base); + // Set the game language. + if (language != Common::UNK_LANG) + ConfMan.set("language", Common::getLanguageCode(language), base); + + // Set the game platform. + if (platform != Common::kPlatformUnknown) + ConfMan.set("platform", Common::getPlatformCode(platform), base); + // Set the target. ConfMan.setActiveDomain(base); diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp index 9465769ea3..e2998234c3 100644 --- a/backends/platform/dc/selector.cpp +++ b/backends/platform/dc/selector.cpp @@ -138,6 +138,8 @@ struct Game char dir[256]; char filename_base[256]; char text[256]; + Common::Language language; + Common::Platform platform; Icon icon; Label label; }; @@ -183,11 +185,15 @@ static void makeDefIcon(Icon &icon) icon.load(scummvm_icon, sizeof(scummvm_icon)); } -static bool uniqueGame(const char *base, const char *dir, Game *games, int cnt) +static bool uniqueGame(const char *base, const char *dir, + Common::Language lang, Common::Platform plf, + Game *games, int cnt) { while (cnt--) if (!strcmp(dir, games->dir) && - !stricmp(base, games->filename_base)) + !stricmp(base, games->filename_base) && + lang == games->language && + plf == games->platform) return false; else games++; @@ -227,14 +233,20 @@ static int findGames(Game *games, int max) if (curr_game < max) { strcpy(games[curr_game].filename_base, ge->gameid().c_str()); strcpy(games[curr_game].dir, dirs[curr_dir-1].name); + games[curr_game].language = ge->language(); + games[curr_game].platform = ge->platform(); if (uniqueGame(games[curr_game].filename_base, - games[curr_game].dir, games, curr_game)) { + games[curr_game].dir, + games[curr_game].language, + games[curr_game].platform, games, curr_game)) { strcpy(games[curr_game].text, ge->description().c_str()); #if 0 - printf("Registered game <%s> in <%s> <%s> because of <%s> <*>\n", - games[curr_game].text, games[curr_game].dir, - games[curr_game].filename_base, + printf("Registered game <%s> (l:%d p:%d) in <%s> <%s> because of <%s> <*>\n", + games[curr_game].text, + (int)games[curr_game].language, + (int)games[curr_game].platform, + games[curr_game].dir, games[curr_game].filename_base, dirs[curr_dir-1].name); #endif curr_game++; @@ -405,7 +417,7 @@ int gameMenu(Game *games, int num_games) } } -bool selectGame(char *&ret, char *&dir_ret, Icon &icon) +bool selectGame(char *&ret, char *&dir_ret, Common::Language &lang_ret, Common::Platform &plf_ret, Icon &icon) { Game *games = new Game[MAX_GAMES]; int selected, num_games; @@ -449,6 +461,8 @@ bool selectGame(char *&ret, char *&dir_ret, Icon &icon) dir_ret = the_game.dir; #endif ret = the_game.filename_base; + lang_ret = the_game.language; + plf_ret = the_game.platform; icon = the_game.icon; return true; } else diff --git a/backends/platform/ds/arm7/source/main.cpp b/backends/platform/ds/arm7/source/main.cpp index 0e8dd9efeb..7029d96405 100644 --- a/backends/platform/ds/arm7/source/main.cpp +++ b/backends/platform/ds/arm7/source/main.cpp @@ -585,7 +585,7 @@ int main(int argc, char ** argv) { //enable sound // powerOn(POWER_SOUND); - REG_SOUNDCNT = SOUND_ENABLE | SOUND_VOL(0x7F); + SOUND_CR = SOUND_ENABLE | SOUND_VOL(0x7F); IPC->soundData = 0; IPC->reset = false; 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/iphone_video.m b/backends/platform/iphone/iphone_video.m index 0392172aa2..61770a16c2 100644 --- a/backends/platform/iphone/iphone_video.m +++ b/backends/platform/iphone/iphone_video.m @@ -36,6 +36,9 @@ static int _textureHeight = 0; NSLock* _lock = nil; static int _needsScreenUpdate = 0; +static UITouch* _firstTouch = NULL; +static UITouch* _secondTouch = NULL; + // static long lastTick = 0; // static int frames = 0; @@ -47,14 +50,14 @@ void iPhone_updateScreen() { } void iPhone_updateScreenRect(unsigned short* screen, int x1, int y1, int x2, int y2) { - [_lock lock]; + //[_lock lock]; int y; for (y = y1; y < y2; ++y) { memcpy(&_textureBuffer[(y * _textureWidth + x1 )* 2], &screen[y * _width + x1], (x2 - x1) * 2); } - [_lock unlock]; + //[_lock unlock]; } @@ -192,12 +195,12 @@ uint getSizeNextPOT(uint size) { glVertexPointer(2, GL_FLOAT, 0, vertices); glTexCoordPointer(2, GL_FLOAT, 0, texCoords); - [_lock lock]; + //[_lock lock]; // Unfortunately we have to update the whole texture every frame, since glTexSubImage2D is actually slower in all cases // due to the iPhone internals having to convert the whole texture back from its internal format when used. // In the future we could use several tiled textures instead. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _textureWidth, _textureHeight, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, _textureBuffer); - [_lock unlock]; + //[_lock unlock]; glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); @@ -280,7 +283,7 @@ uint getSizeNextPOT(uint size) { glBindRenderbufferOES(GL_RENDERBUFFER_OES, _viewRenderbuffer); // The color buffer is triple-buffered, so we clear it multiple times right away to avid doing any glClears later. - int clearCount = 3; + int clearCount = 5; while (clearCount-- > 0) { glClear(GL_COLOR_BUFFER_BIT); [_context presentRenderbuffer:GL_RENDERBUFFER_OES]; @@ -366,7 +369,6 @@ uint getSizeNextPOT(uint size) { ]; } - - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSSet *allTouches = [event allTouches]; @@ -374,11 +376,12 @@ uint getSizeNextPOT(uint size) { switch ([allTouches count]) { case 1: { - UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; + UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; + _firstTouch = touch; [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseDown], @"type", @@ -391,11 +394,12 @@ uint getSizeNextPOT(uint size) { } case 2: { - UITouch *touch = [[allTouches allObjects] objectAtIndex:1]; + UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; + _secondTouch = touch; [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseSecondDown], @"type", @@ -413,14 +417,13 @@ uint getSizeNextPOT(uint size) { { NSSet *allTouches = [event allTouches]; - switch ([allTouches count]) { - case 1: - { - UITouch *touch = [[allTouches allObjects] objectAtIndex:0]; + for (UITouch* touch in touches) { + if (touch == _firstTouch) { + CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseDragged], @"type", @@ -429,15 +432,13 @@ uint getSizeNextPOT(uint size) { nil ] ]; - break; - } - case 2: - { - UITouch *touch = [[allTouches allObjects] objectAtIndex:1]; + + } else if (touch == _secondTouch) { + CGPoint point = [touch locationInView:self]; if (!getLocalMouseCoords(&point)) return; - + [self addEvent: [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt:kInputMouseSecondDragged], @"type", @@ -446,7 +447,7 @@ uint getSizeNextPOT(uint size) { nil ] ]; - break; + } } } diff --git a/backends/platform/iphone/osys_iphone.cpp b/backends/platform/iphone/osys_iphone.cpp index b72e8b65d5..7f30c0caaf 100644 --- a/backends/platform/iphone/osys_iphone.cpp +++ b/backends/platform/iphone/osys_iphone.cpp @@ -813,22 +813,22 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, return false; } + static const int kNeededLength = 100; + static const int kMaxDeviation = 20; + int vecX = (x - _gestureStartX); int vecY = (y - _gestureStartY); - int lengthSq = vecX * vecX + vecY * vecY; - //printf("Lengthsq: %u\n", lengthSq); + + int absX = abs(vecX); + int absY = abs(vecY); + + //printf("(%d, %d)\n", vecX, vecY); - if (lengthSq > 15000) { // Long enough gesture to react upon. + if (absX >= kNeededLength || absY >= kNeededLength) { // Long enough gesture to react upon. _gestureStartX = -1; _gestureStartY = -1; - float vecLength = sqrt(lengthSq); - float vecXNorm = vecX / vecLength; - float vecYNorm = vecY / vecLength; - - //printf("Swipe vector: (%.2f, %.2f)\n", vecXNorm, vecYNorm); - - if (vecXNorm > -0.50 && vecXNorm < 0.50 && vecYNorm > 0.75) { + if (absX < kMaxDeviation && vecY >= kNeededLength) { // Swipe down event.type = Common::EVENT_KEYDOWN; _queuedInputEvent.type = Common::EVENT_KEYUP; @@ -837,7 +837,10 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, event.kbd.keycode = _queuedInputEvent.kbd.keycode = Common::KEYCODE_F5; event.kbd.ascii = _queuedInputEvent.kbd.ascii = Common::ASCII_F5; _needEventRestPeriod = true; - } else if (vecXNorm > -0.50 && vecXNorm < 0.50 && vecYNorm < -0.75) { + return true; + } + + if (absX < kMaxDeviation && -vecY >= kNeededLength) { // Swipe up _mouseClickAndDragEnabled = !_mouseClickAndDragEnabled; const char *dialogMsg; @@ -849,8 +852,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, GUI::TimedMessageDialog dialog(dialogMsg, 1500); dialog.runModal(); return false; - - } else if (vecXNorm > 0.75 && vecYNorm > -0.5 && vecYNorm < 0.5) { + } + + if (absY < kMaxDeviation && vecX >= kNeededLength) { // Swipe right _touchpadModeEnabled = !_touchpadModeEnabled; const char *dialogMsg; @@ -862,7 +866,9 @@ bool OSystem_IPHONE::handleEvent_mouseSecondDragged(Common::Event &event, int x, dialog.runModal(); return false; - } else if (vecXNorm < -0.75 && vecYNorm > -0.5 && vecYNorm < 0.5) { + } + + if (absY < kMaxDeviation && -vecX >= kNeededLength) { // Swipe left return false; } @@ -1106,16 +1112,18 @@ void OSystem_IPHONE::AQBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBuf outQB->mAudioDataByteSize = 4 * s_AudioQueue.frameCount; s_soundCallback(s_soundParam, (byte *)outQB->mAudioData, outQB->mAudioDataByteSize); AudioQueueEnqueueBuffer(inQ, outQB, 0, NULL); - } else + } else { AudioQueueStop(s_AudioQueue.queue, false); + } } void OSystem_IPHONE::mixCallback(void *sys, byte *samples, int len) { OSystem_IPHONE *this_ = (OSystem_IPHONE *)sys; assert(this_); - if (this_->_mixer) + if (this_->_mixer) { this_->_mixer->mixCallback(samples, len); + } } void OSystem_IPHONE::setupMixer() { @@ -1202,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/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 29747c0943..ab27d93574 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -73,7 +73,6 @@ public: virtual void unlockScreen(); virtual void updateScreen(); /* TODO : check */ - virtual void fillScreen(unsigned int i) { printf("fillScreen %d\n", i); }; virtual void displayMessageOnOSD(const char *msg) { printf("displayMessageOnOSD: %s\n", msg); }; /* */ 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..34957b293c 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -140,10 +140,6 @@ public: virtual void quit(); - virtual void setWindowCaption(const char *caption); - - virtual void displayMessageOnOSD(const char *msg); - virtual Common::SeekableReadStream *createConfigReadStream(); virtual Common::WriteStream *createConfigWriteStream(); }; diff --git a/backends/platform/psp/psp.spec b/backends/platform/psp/psp.spec index 223bd58098..807b8f93b7 100644 --- a/backends/platform/psp/psp.spec +++ b/backends/platform/psp/psp.spec @@ -1,3 +1,3 @@ %rename lib old_lib *lib: --lg -lm -lstdc++ -lsupc++ -lg -lpsprtc -lpspaudio -lpspuser -lpsputility -lpspdebug -lc -lpspgum -lpspvfpu -lpspgu -lpspctrl -lpspge -lpspdisplay_driver -lpspdisplay -lpsphprm -lpspge_driver -lpspsdk -lpsppower -lpsppower_driver -lpspgum_vfpu -lpspkernel %(old_lib) +%(old_lib) -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lz -lstdc++ -lc -lpspdisplay -lpspgu -lpspctrl -lpspsdk -lpspnet -lpspnet_inet -lpsputility -lpspsdk -lpspuser diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 343a1ac6f4..52355f60cc 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -397,13 +397,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()); } @@ -489,7 +496,7 @@ void OSystem_SDL::quit() { void OSystem_SDL::setupIcon() { int x, y, w, h, ncols, nbytes, i; unsigned int rgba[256]; - unsigned int *icon; + unsigned int *icon; sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes); if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) { 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/wii/wii.mk b/backends/platform/wii/wii.mk index 030cc997eb..f99288c4a6 100644 --- a/backends/platform/wii/wii.mk +++ b/backends/platform/wii/wii.mk @@ -1,61 +1,25 @@ -WII_ELF=scummvm.elf -WII_DOL=scummvm.dol -WII_DISTPATH=$(srcdir)/dists/wii -all: $(WII_DOL) +WII_EXE := scummvm$(EXEEXT) +WII_EXE_STRIPPED := scummvm_stripped$(EXEEXT) -$(WII_DOL): $(WII_ELF) - $(DEVKITPPC)/bin/elf2dol $< $@ +$(WII_EXE_STRIPPED): $(WII_EXE) + $(STRIP) $< -o $@ clean: wiiclean wiiclean: - $(RM) $(WII_DOL) + $(RM) $(WII_EXE_STRIPPED) -wiiload: $(WII_DOL) - $(DEVKITPPC)/bin/wiiload $(WII_DOL) -d3 +wiiload: $(WII_EXE_STRIPPED) + $(DEVKITPPC)/bin/wiiload $< -geckoupload: $(WII_DOL) - $(DEVKITPPC)/bin/geckoupload $(WII_DOL) +geckoupload: $(WII_EXE_STRIPPED) + $(DEVKITPPC)/bin/geckoupload $< wiigdb: - $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_ELF) + $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_EXE) wiidebug: - $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_ELF) -x $(srcdir)/backends/platform/wii/gdb.txt - -wiidist: - $(MKDIR) dist/scummvm - $(CP) $(WII_DOL) dist/scummvm/boot.dol - $(CP) $(WII_DISTPATH)/meta.xml dist/scummvm/ - $(CP) $(WII_DISTPATH)/icon.png dist/scummvm/ - $(CP) $(WII_DISTPATH)/READMII dist/scummvm/ - $(CP) $(srcdir)/AUTHORS dist/scummvm/ - $(CP) $(srcdir)/COPYING dist/scummvm/ - $(CP) $(srcdir)/COPYING.LGPL dist/scummvm/ - $(CP) $(srcdir)/COPYRIGHT dist/scummvm/ - $(CP) $(srcdir)/NEWS dist/scummvm/ - $(CP) $(srcdir)/README dist/scummvm/ - $(CP) $(srcdir)/dists/pred.dic dist/scummvm/ - $(CP) $(DIST_FILES_THEMES) dist/scummvm/ -ifneq ($(DIST_FILES_ENGINEDATA),) - $(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/ -endif - -gcdist: - $(MKDIR) dist/scummvm - $(CP) $(WII_DOL) dist/scummvm/ - $(CP) $(WII_DISTPATH)/READMII dist/scummvm/ - $(CP) $(srcdir)/AUTHORS dist/scummvm/ - $(CP) $(srcdir)/COPYING dist/scummvm/ - $(CP) $(srcdir)/COPYING.LGPL dist/scummvm/ - $(CP) $(srcdir)/COPYRIGHT dist/scummvm/ - $(CP) $(srcdir)/NEWS dist/scummvm/ - $(CP) $(srcdir)/README dist/scummvm/ - $(CP) $(srcdir)/dists/pred.dic dist/scummvm/ - $(CP) $(DIST_FILES_THEMES) dist/scummvm/ -ifneq ($(DIST_FILES_ENGINEDATA),) - $(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/ -endif - -.PHONY: wiiclean wiiload geckoupload wiigdb wiidebug wiidist gcdist + $(DEVKITPPC)/bin/powerpc-gekko-gdb -n $(WII_EXE) -x $(srcdir)/backends/platform/wii/gdb.txt + +.PHONY: wiiclean wiiload geckoupload wiigdb wiidebug 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/backends/vkeybd/packs/vkeybd_default.zip b/backends/vkeybd/packs/vkeybd_default.zip Binary files differindex c58c26fc5f..9311b2a902 100644 --- a/backends/vkeybd/packs/vkeybd_default.zip +++ b/backends/vkeybd/packs/vkeybd_default.zip diff --git a/backends/vkeybd/packs/vkeybd_default/lowercase320x240.bmp b/backends/vkeybd/packs/vkeybd_default/lowercase320x240.bmp Binary files differindex 27a450f2d2..3270bf21e4 100644 --- a/backends/vkeybd/packs/vkeybd_default/lowercase320x240.bmp +++ b/backends/vkeybd/packs/vkeybd_default/lowercase320x240.bmp diff --git a/backends/vkeybd/packs/vkeybd_default/lowercase640x480.bmp b/backends/vkeybd/packs/vkeybd_default/lowercase640x480.bmp Binary files differindex 3df2a58b83..610f0844d0 100644 --- a/backends/vkeybd/packs/vkeybd_default/lowercase640x480.bmp +++ b/backends/vkeybd/packs/vkeybd_default/lowercase640x480.bmp diff --git a/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml b/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml index aba31b1096..982c4f45ef 100644 --- a/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml +++ b/backends/vkeybd/packs/vkeybd_default/vkeybd_default.xml @@ -76,6 +76,8 @@ <area shape="rect" coords="202,110,219,128" target="," /> <area shape="rect" coords="223,110,241,128" target="." /> <area shape="rect" coords="243,110,261,128" target="/" /> + <area shape="rect" coords="277,133,292,148" target="ok" /> + <area shape="rect" coords="292,133,309,148" target="cancel" /> </map> </layout> <layout resolution="640x480" bitmap="lowercase640x480.bmp" transparent_color="255,0,255"> @@ -151,6 +153,8 @@ <area shape="rect" coords="405,220,440,256" target="," /> <area shape="rect" coords="447,220,483,256" target="." /> <area shape="rect" coords="487,220,524,256" target="/" /> + <area shape="rect" coords="555,266,585,298" target="ok" /> + <area shape="rect" coords="585,266,619,298" target="cancel" /> </map> </layout> <event name="esc" type="key" code="27" ascii="27" modifiers="" /> @@ -223,6 +227,8 @@ <event name="7" type="key" code="55" ascii="55" modifiers="" /> <event name="8" type="key" code="56" ascii="56" modifiers="" /> <event name="9" type="key" code="57" ascii="57" modifiers="" /> + <event name="ok" type="submit" /> + <event name="cancel" type="cancel" /> <event name="quit" type="submit" /> </mode> diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index a95b79d213..4ca4a5f586 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -31,7 +31,6 @@ #include "backends/vkeybd/virtual-keyboard-parser.h" #include "backends/vkeybd/keycode-descriptions.h" #include "common/config-manager.h" -#include "common/fs.h" #include "common/unzip.h" #define KEY_START_CHAR ('[') @@ -77,51 +76,77 @@ void VirtualKeyboard::reset() { _kbdGUI->reset(); } -bool VirtualKeyboard::loadKeyboardPack(String packName) { - _kbdGUI->initSize(_system->getOverlayWidth(), _system->getOverlayHeight()); - - delete _fileArchive; - _fileArchive = 0; - - FSNode vkDir; - if (ConfMan.hasKey("vkeybdpath")) - vkDir = FSNode(ConfMan.get("vkeybdpath")); - else if (ConfMan.hasKey("extrapath")) - vkDir = FSNode(ConfMan.get("extrapath")); - else // use current directory - vkDir = FSNode("."); - - if (vkDir.getChild(packName + ".xml").exists()) { - _fileArchive = new FSDirectory(vkDir, 1); +bool VirtualKeyboard::openPack(const String &packName, const FSNode &node) { + if (node.getChild(packName + ".xml").exists()) { + _fileArchive = new FSDirectory(node, 1); // uncompressed keyboard pack - if (!_parser->loadFile(vkDir.getChild(packName + ".xml"))) + if (!_parser->loadFile(node.getChild(packName + ".xml"))) { + delete _fileArchive; + _fileArchive = 0; return false; + } + + return true; + } - } else if (vkDir.getChild(packName + ".zip").exists()) { - // compressed keyboard pack #ifdef USE_ZLIB - _fileArchive = new ZipArchive(vkDir.getChild(packName + ".zip")); + if (node.getChild(packName + ".zip").exists()) { + // compressed keyboard pack + _fileArchive = new ZipArchive(node.getChild(packName + ".zip")); if (_fileArchive->hasFile(packName + ".xml")) { - if (!_parser->loadStream(_fileArchive->createReadStreamForMember(packName + ".xml"))) + if (!_parser->loadStream(_fileArchive->createReadStreamForMember(packName + ".xml"))) { + delete _fileArchive; + _fileArchive = 0; return false; + } } else { warning("Could not find %s.xml file in %s.zip keyboard pack", packName.c_str(), packName.c_str()); + delete _fileArchive; + _fileArchive = 0; return false; } -#else - return false; + + return true; + } #endif + + return false; +} + +bool VirtualKeyboard::loadKeyboardPack(const String &packName) { + _kbdGUI->initSize(_system->getOverlayWidth(), _system->getOverlayHeight()); + + delete _fileArchive; + _fileArchive = 0; + _loaded = false; + + bool opened = false; + if (ConfMan.hasKey("vkeybdpath")) + opened = openPack(packName, FSNode(ConfMan.get("vkeybdpath"))); + else if (ConfMan.hasKey("extrapath")) + opened = openPack(packName, FSNode(ConfMan.get("extrapath"))); + + // fallback to the current dir + if (!opened) + opened = openPack(packName, FSNode(".")); + + if (opened) { + _parser->setParseMode(VirtualKeyboardParser::kParseFull); + _loaded = _parser->parse(); + + if (_loaded) { + printf("Keyboard pack '%s' loaded successfully!\n", packName.c_str()); + } else { + warning("Error parsing the keyboard pack '%s'", packName.c_str()); + + delete _fileArchive; + _fileArchive = 0; + } } else { warning("Keyboard pack not found"); - return false; } - _parser->setParseMode(VirtualKeyboardParser::kParseFull); - _loaded = _parser->parse(); - if (_loaded) - printf("Keyboard pack '%s' loaded successfully!\n", packName.c_str()); - return _loaded; } diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index e3a9cd3600..2c31afcb35 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -37,6 +37,7 @@ class OSystem; #include "common/keyboard.h" #include "common/list.h" #include "common/str.h" +#include "common/fs.h" #include "backends/vkeybd/image-map.h" #include "graphics/surface.h" @@ -190,7 +191,7 @@ public: * searches for a compressed keyboard pack by looking for packName.zip. * @param packName name of the keyboard pack */ - bool loadKeyboardPack(String packName); + bool loadKeyboardPack(const String &packName); /** * Shows the keyboard, starting an event loop that will intercept all @@ -232,6 +233,7 @@ protected: VirtualKeyboardParser *_parser; void reset(); + bool openPack(const String &packName, const FSNode &node); void deleteEvents(); bool checkModeResolutions(); void switchMode(Mode *newMode); |