ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

riscossdl-events.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "common/scummsys.h"
00024 
00025 #if defined(RISCOS) && defined(SDL_BACKEND)
00026 
00027 #include "backends/events/riscossdl/riscossdl-events.h"
00028 #include "backends/platform/sdl/riscos/riscos-utils.h"
00029 
00030 #include "common/events.h"
00031 
00032 #include <swis.h>
00033 
00034 RISCOSSdlEventSource::RISCOSSdlEventSource()
00035     : ResVmSdlEventSource() { // ResidualVM: was SdlEventSource
00036     int messages[2];
00037     messages[0] = 3; // Message_DataLoad
00038     messages[1] = 0;
00039     _swix(Wimp_AddMessages, _IN(0), messages);
00040 
00041     SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
00042 }
00043 
00044 bool RISCOSSdlEventSource::handleSysWMEvent(SDL_Event &ev, Common::Event &event) {
00045     int eventCode = ev.syswm.msg->eventCode;
00046     int pollBlock[64];
00047     memcpy(pollBlock, ev.syswm.msg->pollBlock, 64 * sizeof(int));
00048 
00049     if (eventCode == 17 || eventCode == 18) {
00050         char *filename;
00051         switch (pollBlock[4]) {
00052         case 3: // Message_DataLoad
00053             filename = (char *)(pollBlock) + 44;
00054             event.type = Common::EVENT_DROP_FILE;
00055             event.path = RISCOS_Utils::toUnix(Common::String(filename));
00056 
00057             // Acknowledge that the event has been received
00058             pollBlock[4] = 4; // Message_DataLoadAck
00059             pollBlock[3] = pollBlock[2];
00060             _swix(Wimp_SendMessage, _INR(0,2), 19, pollBlock, 0);
00061             return true;
00062         }
00063     }
00064     return false;
00065 }
00066 
00067 #endif


Generated on Sat May 30 2020 05:00:30 for ResidualVM by doxygen 1.7.1
curved edge   curved edge