diff options
author | Alyssa Milburn | 2011-07-07 09:24:10 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-07-07 09:24:10 +0200 |
commit | 66e81d633f987310f12038147ae01b8ce4f640f7 (patch) | |
tree | 6035a7124789c3e6cdff5f603e9933529b7efdc7 /backends | |
parent | affaa1f4d6cf5f27f654029133b1aec7b9eca4b5 (diff) | |
parent | 72da8ef5adf82d8a65da299207f30af5058ca8a9 (diff) | |
download | scummvm-rg350-66e81d633f987310f12038147ae01b8ce4f640f7.tar.gz scummvm-rg350-66e81d633f987310f12038147ae01b8ce4f640f7.tar.bz2 scummvm-rg350-66e81d633f987310f12038147ae01b8ce4f640f7.zip |
Merge remote-tracking branch 'origin/master' into soltys_wip2
Diffstat (limited to 'backends')
-rw-r--r-- | backends/fs/ds/ds-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/ps2/ps2-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/psp/psp-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/wii/wii-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 6 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 4 | ||||
-rw-r--r-- | backends/platform/psp/display_manager.cpp | 2 | ||||
-rw-r--r-- | backends/platform/psp/powerman.cpp | 2 | ||||
-rw-r--r-- | backends/platform/psp/rtc.cpp | 2 | ||||
-rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 60 | ||||
-rw-r--r-- | backends/platform/sdl/win32/win32.h | 1 | ||||
-rw-r--r-- | backends/platform/wince/README-WinCE.txt | 20 | ||||
-rw-r--r-- | backends/plugins/elf/memory-manager.cpp | 2 | ||||
-rw-r--r-- | backends/plugins/elf/shorts-segment-manager.cpp | 2 | ||||
-rw-r--r-- | backends/taskbar/win32/win32-taskbar.cpp | 122 | ||||
-rw-r--r-- | backends/taskbar/win32/win32-taskbar.h | 5 |
16 files changed, 192 insertions, 44 deletions
diff --git a/backends/fs/ds/ds-fs-factory.cpp b/backends/fs/ds/ds-fs-factory.cpp index 3fd97d07eb..4e09c3446b 100644 --- a/backends/fs/ds/ds-fs-factory.cpp +++ b/backends/fs/ds/ds-fs-factory.cpp @@ -27,7 +27,9 @@ #include "backends/fs/ds/ds-fs.h" #include "dsmain.h" //for the isGBAMPAvailable() function +namespace Common { DECLARE_SINGLETON(DSFilesystemFactory); +} AbstractFSNode *DSFilesystemFactory::makeRootFileNode() const { if (DS::isGBAMPAvailable()) { diff --git a/backends/fs/ps2/ps2-fs-factory.cpp b/backends/fs/ps2/ps2-fs-factory.cpp index cad92b5dec..ef7b2013a3 100644 --- a/backends/fs/ps2/ps2-fs-factory.cpp +++ b/backends/fs/ps2/ps2-fs-factory.cpp @@ -27,7 +27,9 @@ #include "backends/fs/ps2/ps2-fs-factory.h" #include "backends/fs/ps2/ps2-fs.h" +namespace Common { DECLARE_SINGLETON(Ps2FilesystemFactory); +} AbstractFSNode *Ps2FilesystemFactory::makeRootFileNode() const { return new Ps2FilesystemNode(); diff --git a/backends/fs/psp/psp-fs-factory.cpp b/backends/fs/psp/psp-fs-factory.cpp index ef1df246ba..bb3aca8ee6 100644 --- a/backends/fs/psp/psp-fs-factory.cpp +++ b/backends/fs/psp/psp-fs-factory.cpp @@ -43,7 +43,9 @@ #include <unistd.h> +namespace Common { DECLARE_SINGLETON(PSPFilesystemFactory); +} AbstractFSNode *PSPFilesystemFactory::makeRootFileNode() const { return new PSPFilesystemNode(); diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 34cde8ef46..fbc9ef1da8 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -40,7 +40,9 @@ #include <smb.h> #endif +namespace Common { DECLARE_SINGLETON(WiiFilesystemFactory); +} WiiFilesystemFactory::WiiFilesystemFactory() : _dvdMounted(false), diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 66207b6808..2d41ecead4 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -752,6 +752,12 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() { error("allocating _screen failed"); #endif + // SDL 1.2 palettes default to all black, + // SDL 1.3 palettes default to all white, + // Thus set our own default palette to all black. + // SDL_SetColors does nothing for non indexed surfaces. + SDL_SetColors(_screen, _currentPalette, 0, 256); + // // Create the surface that contains the scaled graphics in 16 bit mode // diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index d3acd06089..c75d7493a2 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -66,7 +66,7 @@ #include "engines/engine.h" -#include "graphics/font.h" +#include "graphics/fonts/bdf.h" #include "graphics/surface.h" #include "icon.h" @@ -96,7 +96,7 @@ OSystem_PS2 *g_systemPs2; #define FOREVER 2147483647 namespace Graphics { - extern const NewFont g_sysfont; + extern const BdfFont g_sysfont; }; PS2Device detectBootPath(const char *elfPath, char *bootPath); diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index e945dca4a8..422805714f 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -62,7 +62,9 @@ const OSystem::GraphicsMode DisplayManager::_supportedModes[] = { // Class VramAllocator ----------------------------------- +namespace Common { DECLARE_SINGLETON(VramAllocator); +} //#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */ //#define __PSP_DEBUG_PRINT__ diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp index fe9dcfa673..b72d05809d 100644 --- a/backends/platform/psp/powerman.cpp +++ b/backends/platform/psp/powerman.cpp @@ -30,7 +30,9 @@ //#define __PSP_DEBUG_PRINT__ #include "backends/platform/psp/trace.h" +namespace Common { DECLARE_SINGLETON(PowerManager); +} // Function to debug the Power Manager (we have no output to screen) inline void PowerManager::debugPM() { diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp index 3d6d4295a6..6c8e919986 100644 --- a/backends/platform/psp/rtc.cpp +++ b/backends/platform/psp/rtc.cpp @@ -34,7 +34,9 @@ // Class PspRtc --------------------------------------------------------------- +namespace Common { DECLARE_SINGLETON(PspRtc); +} void PspRtc::init() { // init our starting ticks uint32 ticks[2]; diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index 420ed2465b..c1b6c853e4 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -24,6 +24,7 @@ #define FORBIDDEN_SYMBOL_ALLOW_ALL #include "common/scummsys.h" +#include "common/config-manager.h" #include "common/error.h" #include "common/textconsole.h" @@ -44,46 +45,7 @@ #define DEFAULT_CONFIG_FILE "scummvm.ini" -//#define HIDE_CONSOLE - -#ifdef HIDE_CONSOLE -struct SdlConsoleHidingWin32 { - DWORD myPid; - DWORD myTid; - HWND consoleHandle; -}; - -// console hiding for win32 -static BOOL CALLBACK initBackendFindConsoleWin32Proc(HWND hWnd, LPARAM lParam) { - DWORD pid, tid; - SdlConsoleHidingWin32 *variables = (SdlConsoleHidingWin32 *)lParam; - tid = GetWindowThreadProcessId(hWnd, &pid); - if ((tid == variables->myTid) && (pid == variables->myPid)) { - variables->consoleHandle = hWnd; - return FALSE; - } - return TRUE; -} - -#endif - void OSystem_Win32::init() { -#ifdef HIDE_CONSOLE - // console hiding for win32 - SdlConsoleHidingWin32 consoleHidingWin32; - consoleHidingWin32.consoleHandle = 0; - consoleHidingWin32.myPid = GetCurrentProcessId(); - consoleHidingWin32.myTid = GetCurrentThreadId(); - EnumWindows (initBackendFindConsoleWin32Proc, (LPARAM)&consoleHidingWin32); - - if (!ConfMan.getBool("show_console")) { - if (consoleHidingWin32.consoleHandle) { - // We won't find a window with our TID/PID in case we were started from command-line - ShowWindow(consoleHidingWin32.consoleHandle, SW_HIDE); - } - } -#endif - // Initialize File System Factory _fsFactory = new WindowsFilesystemFactory(); @@ -96,6 +58,26 @@ void OSystem_Win32::init() { OSystem_SDL::init(); } +void OSystem_Win32::initBackend() { + // Console window is enabled by default on Windows + ConfMan.registerDefault("console", true); + + // Enable or disable the window console window + if (ConfMan.getBool("console")) { + if (AllocConsole()) { + freopen("CONIN$","r",stdin); + freopen("CONOUT$","w",stdout); + freopen("CONOUT$","w",stderr); + } + SetConsoleTitle("ScummVM Status Window"); + } else { + FreeConsole(); + } + + // Invoke parent implementation of this method + OSystem_SDL::initBackend(); +} + bool OSystem_Win32::hasFeature(Feature f) { if (f == kFeatureDisplayLogFile) diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h index cc2fc51d36..b56997a63b 100644 --- a/backends/platform/sdl/win32/win32.h +++ b/backends/platform/sdl/win32/win32.h @@ -28,6 +28,7 @@ class OSystem_Win32 : public OSystem_SDL { public: virtual void init(); + virtual void initBackend(); virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0); diff --git a/backends/platform/wince/README-WinCE.txt b/backends/platform/wince/README-WinCE.txt index c48d9ca998..8f1262051a 100644 --- a/backends/platform/wince/README-WinCE.txt +++ b/backends/platform/wince/README-WinCE.txt @@ -1,10 +1,26 @@ ScummVM Windows CE FAQ -Last updated: 2011-05-27 -Release version: 1.3.0 +Last updated: 2011-07-01 +Release version: 1.3.1 ------------------------------------------------------------------------ New in this version ------------------- +1.3.1: +- Fix for Normal2xAspect scaler which was causing screen update issues in some + games. +- Fix for Normal1xAspect scaler which caused problems in the bottom part of the + screen when toolbar was hidden. +- Fix for freelook mode. +- Fix for timer manager, caused timing issues in some games. +- Activated runtime language detection for ScummVM gui. +- Toolbar is now hidden when returning to the game list. +- Double-tap right-click emulation is now turned off for SCI games by default. +- Added a new option "no_doubletap_paneltoggle" for scummvm.ini to disable + toolbar toggling when double-tapping on the top part of the screen. +- SDL library related fixes: + * Fix for screen/mouse-cursor rotation issues (fixes erratic touchscreen + behaviour) + * Fix for hardware keyboard on some devices (HTC Touch Pro, etc.) 1.3.0: This is the first official Windows CE release since 1.1.1. diff --git a/backends/plugins/elf/memory-manager.cpp b/backends/plugins/elf/memory-manager.cpp index 02669b3647..058d818dc4 100644 --- a/backends/plugins/elf/memory-manager.cpp +++ b/backends/plugins/elf/memory-manager.cpp @@ -29,7 +29,9 @@ #include "common/util.h" #include <malloc.h> +namespace Common { DECLARE_SINGLETON(ELFMemoryManager); +} ELFMemoryManager::ELFMemoryManager() : _heap(0), _heapSize(0), _heapAlign(0), diff --git a/backends/plugins/elf/shorts-segment-manager.cpp b/backends/plugins/elf/shorts-segment-manager.cpp index b3a9531c2d..caa328a4f2 100644 --- a/backends/plugins/elf/shorts-segment-manager.cpp +++ b/backends/plugins/elf/shorts-segment-manager.cpp @@ -33,7 +33,9 @@ extern char __plugin_hole_start; // Indicates start of hole in program file for extern char __plugin_hole_end; // Indicates end of hole in program file extern char _gp[]; // Value of gp register +namespace Common { DECLARE_SINGLETON(ShortSegmentManager); // For singleton +} ShortSegmentManager::ShortSegmentManager() { _shortsStart = &__plugin_hole_start ; //shorts segment begins at the plugin hole we made when linking diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp index 18d99d6eca..04889f3dd7 100644 --- a/backends/taskbar/win32/win32-taskbar.cpp +++ b/backends/taskbar/win32/win32-taskbar.cpp @@ -66,7 +66,7 @@ // System.Title property key, values taken from http://msdn.microsoft.com/en-us/library/bb787584.aspx const PROPERTYKEY PKEY_Title = { /* fmtid = */ { 0xF29F85E0, 0x4FF9, 0x1068, { 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9 } }, /* propID = */ 2 }; -Win32TaskbarManager::Win32TaskbarManager() : _taskbar(NULL) { +Win32TaskbarManager::Win32TaskbarManager() : _taskbar(NULL), _count(0), _icon(NULL) { // Do nothing if not running on Windows 7 or later if (!isWin7OrLater()) return; @@ -96,6 +96,9 @@ Win32TaskbarManager::~Win32TaskbarManager() { _taskbar->Release(); _taskbar = NULL; + if (_icon) + DestroyIcon(_icon); + CoUninitialize(); } @@ -144,6 +147,123 @@ void Win32TaskbarManager::setProgressState(TaskbarProgressState state) { _taskbar->SetProgressState(getHwnd(), (TBPFLAG)state); } +void Win32TaskbarManager::setCount(int count) { + if (_taskbar == NULL) + return; + + if (count == 0) { + _taskbar->SetOverlayIcon(getHwnd(), NULL, L""); + return; + } + + // FIXME: This isn't really nice and could use a cleanup. + // The only good thing is that it doesn't use GDI+ + // and thus does not have a dependancy on it, + // with the downside of being a lot more ugly. + // Maybe replace it by a Graphic::Surface, use + // ScummVM font drawing and extract the contents at + // the end? + + if (_count != count || _icon == NULL) { + // Cleanup previous icon + _count = count; + if (_icon) + DestroyIcon(_icon); + + Common::String countString = (count < 100 ? Common::String::format("%d", count) : "9+"); + + // Create transparent background + BITMAPV5HEADER bi; + ZeroMemory(&bi, sizeof(BITMAPV5HEADER)); + bi.bV5Size = sizeof(BITMAPV5HEADER); + bi.bV5Width = 16; + bi.bV5Height = 16; + bi.bV5Planes = 1; + bi.bV5BitCount = 32; + bi.bV5Compression = BI_RGB; + // Set 32 BPP alpha format + bi.bV5RedMask = 0x00FF0000; + bi.bV5GreenMask = 0x0000FF00; + bi.bV5BlueMask = 0x000000FF; + bi.bV5AlphaMask = 0xFF000000; + + // Get DC + HDC hdc; + hdc = GetDC(NULL); + HDC hMemDC = CreateCompatibleDC(hdc); + ReleaseDC(NULL, hdc); + + // Create a bitmap mask + HBITMAP hBitmapMask = CreateBitmap(16, 16, 1, 1, NULL); + + // Create the DIB section with an alpha channel + void *lpBits; + HBITMAP hBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, (void **)&lpBits, NULL, 0); + HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap); + + // Load the icon background + HICON hIconBackground = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(1002 /* IDI_COUNT */)); + DrawIconEx(hMemDC, 0, 0, hIconBackground, 16, 16, 0, 0, DI_NORMAL); + DeleteObject(hIconBackground); + + // Draw the count + LOGFONT lFont; + memset(&lFont, 0, sizeof(LOGFONT)); + lFont.lfHeight = 10; + lFont.lfWeight = FW_BOLD; + lFont.lfItalic = 1; + strcpy(lFont.lfFaceName, "Arial"); + + HFONT hFont = CreateFontIndirect(&lFont); + SelectObject(hMemDC, hFont); + + RECT rect; + SetRect(&rect, 4, 4, 12, 12); + SetTextColor(hMemDC, RGB(48, 48, 48)); + SetBkMode(hMemDC, TRANSPARENT); + DrawText(hMemDC, countString.c_str(), -1, &rect, DT_NOCLIP|DT_CENTER); + + // Set the text alpha to fully opaque (we consider the data inside the text rect) + DWORD *lpdwPixel = (DWORD *)lpBits; + for (int x = 3; x < 12; x++) { + for(int y = 3; y < 12; y++) { + unsigned char *p = (unsigned char *)(lpdwPixel + x * 16 + y); + + if (p[0] != 0 && p[1] != 0 && p[2] != 0) + p[3] = 255; + } + } + + // Cleanup DC + DeleteObject(hFont); + SelectObject(hMemDC, hOldBitmap); + DeleteDC(hMemDC); + + // Prepare our new icon + ICONINFO ii; + ii.fIcon = FALSE; + ii.xHotspot = 0; + ii.yHotspot = 0; + ii.hbmMask = hBitmapMask; + ii.hbmColor = hBitmap; + + _icon = CreateIconIndirect(&ii); + + DeleteObject(hBitmap); + DeleteObject(hBitmapMask); + + if (!_icon) { + warning("[Win32TaskbarManager::setCount] Cannot create icon for count"); + return; + } + } + + // Sets the overlay icon + LPWSTR desc = ansiToUnicode(Common::String::format("Found games: %d", count).c_str()); + _taskbar->SetOverlayIcon(getHwnd(), _icon, desc); + delete[] desc; +} + void Win32TaskbarManager::addRecent(const Common::String &name, const Common::String &description) { //warning("[Win32TaskbarManager::addRecent] Adding recent list entry: %s (%s)", name.c_str(), description.c_str()); diff --git a/backends/taskbar/win32/win32-taskbar.h b/backends/taskbar/win32/win32-taskbar.h index 3415a79bd7..c9d1761017 100644 --- a/backends/taskbar/win32/win32-taskbar.h +++ b/backends/taskbar/win32/win32-taskbar.h @@ -41,11 +41,16 @@ public: virtual void setOverlayIcon(const Common::String &name, const Common::String &description); virtual void setProgressValue(int completed, int total); virtual void setProgressState(TaskbarProgressState state); + virtual void setCount(int count); virtual void addRecent(const Common::String &name, const Common::String &description); private: ITaskbarList3 *_taskbar; + // Count handling + HICON _icon; + int _count; + /** * Get the path to an icon for the game * |