[Scummvm-cvs-logs] SF.net SVN: scummvm: [30943] scummvm/branches/branch-0-11-0/backends

sev at users.sourceforge.net sev at users.sourceforge.net
Sat Feb 23 22:27:17 CET 2008


Revision: 30943
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30943&view=rev
Author:   sev
Date:     2008-02-23 13:27:17 -0800 (Sat, 23 Feb 2008)

Log Message:
-----------
Patch #1900179: "PlayStation2 ScummVM-0.11.1 patch"

Modified Paths:
--------------
    scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs-factory.cpp
    scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/fileio.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/irxboot.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2input.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2mutex.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2time.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/systemps2.cpp
    scummvm/branches/branch-0-11-0/backends/platform/ps2/systemps2.h

Added Paths:
-----------
    scummvm/branches/branch-0-11-0/backends/platform/ps2/Makefile.ps2
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/Makefile
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/__ps2kbd.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/imports.lst
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
    scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.c
    scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.h
    scummvm/branches/branch-0-11-0/backends/platform/ps2/sdlkeys.h

Modified: scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs-factory.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs-factory.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs-factory.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -36,5 +36,17 @@
 }
 
 AbstractFilesystemNode *Ps2FilesystemFactory::makeFileNodePath(const String &path) const {
-	return new Ps2FilesystemNode(path);
+	// return new Ps2FilesystemNode(path);
+
+	Ps2FilesystemNode *nf = new Ps2FilesystemNode(path, true);
+/*
+	int fd = fio.dopen(path.c_str());
+	if (fd < 0) {
+		nf->_isDirectory = false;
+	}
+	else {
+		fio.dclose(fd);
+	}
+*/
+	return nf; // new Ps2FilesystemNode(path, true);
 }

Modified: scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/fs/ps2/ps2-fs.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -26,9 +26,21 @@
 #include <kernel.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "asyncfio.h"
+#include "fileio.h"
+
 #include "systemps2.h"
 
+#define DEFAULT_MODE (FIO_S_IRUSR | FIO_S_IWUSR | FIO_S_IRGRP | FIO_S_IWGRP | FIO_S_IROTH | FIO_S_IWOTH)
+
+FILE *ps2_fopen(const char *fname, const char *mode);
+int ps2_fclose(FILE *stream);
+// extern int fileXioChdir(const char* pathname);
+
+#include <fileXio_rpc.h>
+
+
 extern AsyncFio fio;
 extern OSystem_PS2 *g_systemPs2;
 
@@ -38,6 +50,9 @@
  * Parts of this class are documented in the base interface class, AbstractFilesystemNode.
  */
 class Ps2FilesystemNode : public AbstractFilesystemNode {
+
+friend class Ps2FilesystemFactory;
+
 protected:
 	String _displayName;
 	String _path;
@@ -56,20 +71,108 @@
 	 * @param path String with the path the new node should point to.
 	 */
 	Ps2FilesystemNode(const String &path);
+	Ps2FilesystemNode(const String &path, bool verify);
 	
 	/**
 	 * Copy constructor.
 	 */
 	Ps2FilesystemNode(const Ps2FilesystemNode *node);
+	
+	virtual bool exists() const {
+		int fd;
 
-	virtual bool exists() const { return true; }		//FIXME: this is just a stub
+		printf("Q: Does %s exist ?\n", _path.c_str());
+
+		if (_path[4] != ':') { // don't bother for relative path...
+		                       //  ...they always fail on PS2!
+			printf("A: nope -> skip relative path\n");
+			return false;
+		}
+
+		if (_path[0] == 'h') { // bypass host
+			printf("A: nope -> skip host\n");
+			return false;
+		}
+
+		if ((fd = fio.open(_path.c_str(), O_RDONLY)) >= 0) { /* it's a file */
+			fio.close(fd);
+			printf("A: yep -> file\n");
+			return true;
+		}
+
+		   /* romeo's black magic */
+		fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR); 
+		if (fd == -EISDIR) {
+			printf("A: yep -> dir\n");
+			return true;
+		}
+		/* NOTE: it cannot be a file cause it would have been caught by
+		         the previous test, so no need to close it ;-)          */
+
+		printf("A: nope\n");
+		return false;
+	}
+
 	virtual String getDisplayName() const { return _displayName; }
 	virtual String getName() const { return _displayName; }
 	virtual String getPath() const { return _path; }
-	virtual bool isDirectory() const { return _isDirectory; }
-	virtual bool isReadable() const { return true; }	//FIXME: this is just a stub
-	virtual bool isWritable() const { return true; }	//FIXME: this is just a stub
+	virtual bool isDirectory() const {
 
+		printf("Q: Is %s a dir?\n", _path.c_str());
+
+#if 0
+		int fd;
+
+		if (_path.empty()) {
+			printf("A: yep -> top level\n");
+			return true; // top level
+		}
+
+		if (_path.lastChar() == ':' ||
+			(_path.lastChar() == '/' && _path[_path.size()-2] == ':')) {
+			printf("A: yep -> device\n");
+			return true; // device
+		}
+
+		fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
+		if (fd == -EISDIR) {
+			printf("A: yep\n");
+			return true;
+		}
+
+		if (fd >= 0)
+			fio.close(fd);
+
+		printf("A: nope\n");
+		return false;
+#else
+		if (_isDirectory)
+			printf("A: yep -> _isDirectory == 1\n");
+		else
+			printf("A: nope -> _isDirectory == 0\n");
+
+		return _isDirectory;
+#endif
+	}
+
+	virtual bool isReadable() const {
+		int fd;
+		if ((fd = fio.open(_path.c_str(), O_RDONLY)) >= 0) {
+			fio.close(fd);
+			return true;
+		}
+		return false;
+	}
+
+	virtual bool isWritable() const {
+		int fd;
+		if ((fd =  fio.open(_path.c_str(), O_WRONLY)) >= 0) {
+			fio.close(fd);
+			return true;
+		}
+		return false;
+	}
+
 	virtual AbstractFilesystemNode *clone() const { return new Ps2FilesystemNode(this); }
 	virtual AbstractFilesystemNode *getChild(const String &n) const;
 	virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
@@ -83,13 +186,19 @@
  * @return Pointer to the first char of the last component inside str.
  */
 const char *lastPathComponent(const Common::String &str) {
-	//FIXME: implement this method properly.
-	// This code is probably around the constructors,
-	// but I couldn't figure it out without having
-	// doubts on the correctness of my assumptions.
-	// Therefore, I leave it to the porter to correctly
-	// implement this method.
-	assert(false);
+	if (str.empty())
+		return "";
+
+	const char *start = str.c_str();
+	const char *cur = start + str.size() - 2;
+
+	while (cur >= start && *cur != '/' && *cur != ':') {
+		--cur;
+	}
+
+	printf("romeo : lastPathComponent = %s\n", cur + 1);
+
+	return cur + 1;
 }
 
 Ps2FilesystemNode::Ps2FilesystemNode() {
@@ -124,6 +233,105 @@
 	}
 }
 
+Ps2FilesystemNode::Ps2FilesystemNode(const String &path, bool verify) {
+	_path = path;
+	_isDirectory = true;
+
+	if (strcmp(path.c_str(), "") == 0) {
+		_isRoot = true;
+		_displayName = String("PlayStation 2");
+		verify = false; /* root is always a dir*/
+	} else {
+		_isRoot = false;
+		const char *dsplName = NULL, *pos = path.c_str();
+		while (*pos)
+			if (*pos++ == '/')
+				dsplName = pos;
+		if (dsplName)
+			_displayName = String(dsplName);
+		else {
+			if (strncmp(path.c_str(), "cdfs", 4) == 0)
+				_displayName = "DVD Drive";
+			else if (strncmp(path.c_str(), "mass", 4) == 0)
+				_displayName = "USB Mass Storage";
+			else
+				_displayName = "Harddisk";
+			verify = false; /* devices are always dir */
+		}
+	}
+
+	if (verify && !_isRoot) {
+		int medium, fd;
+
+		if (strncmp(path.c_str(), "pfs0", 4) == 0)
+			medium = 0;
+		else if (strncmp(path.c_str(), "cdfs", 4) == 0)
+			medium = 1;
+		else if (strncmp(path.c_str(), "mass", 4) == 0)
+			medium = 2;
+
+		switch(medium) {
+
+		case 0: /* hd */
+		printf("hd >  ");
+		fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
+
+		if (fd == -EISDIR) {
+			printf(" romeo : new node [ %s ] is a dir\n", path.c_str());
+		}
+		else if (fd >=0) {
+			_isDirectory = false;
+			printf(" romeo : new node [ %s ] is -not- a dir (%d)\n",
+				path.c_str(), fd);
+			fio.close(fd);
+		}
+		else
+			printf(" romeo : new node [ %s ] is -not- (%d)\n",
+				 path.c_str(), fd);
+
+		break;
+
+		case 1: /* cd */
+		printf("cd >  ");
+		fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
+
+		if (fd == -ENOENT) {
+			printf(" romeo : new node [ %s ] is a dir\n", path.c_str());
+		}
+		else if (fd >=0) {
+			_isDirectory = false;
+			printf(" romeo : new node [ %s ] is -not- a dir (%d)\n",
+				path.c_str(), fd);
+			fio.close(fd);
+		}
+		else
+			printf(" romeo : new node [ %s ] is -not- (%d)\n",
+				path.c_str(), fd);
+
+		break;
+
+		case 2: /* usb */
+		printf("usb >  ");
+		// fd = fio.open(_path.c_str(), O_RDONLY, DEFAULT_MODE | FIO_S_IFDIR);
+		fd = fio.chdir(path.c_str());
+
+		if (fd == -48) {
+			printf(" romeo : new node [ %s ] is a dir\n", path.c_str());
+			// fio.close(fd);
+			// chdir("");
+		}
+		else {
+			_isDirectory = false;
+			printf(" romeo : new node [ %s ] is a -not- a dir (%d)\n",
+				path.c_str(), fd);
+		}
+
+		break;
+		} /* switch(medium) */
+
+	}
+}
+
 Ps2FilesystemNode::Ps2FilesystemNode(const Ps2FilesystemNode *node) {
 	_displayName = node->_displayName;
 	_isDirectory = node->_isDirectory;
@@ -195,7 +403,7 @@
 		char listDir[256];
 		int fd;
 		
-		if (_path.lastChar() == '/')
+		if (_path.lastChar() == '/' /* || _path.lastChar() == ':'*/)
 			fd = fio.dopen(_path.c_str());
 		else {
 			sprintf(listDir, "%s/", _path.c_str());

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -364,6 +364,30 @@
 	}
 }
 
+void Gs2dScreen::clearScreen(void) {
+	WaitSema(g_DmacSema);
+	memset(_screenBuf, 0, _width * _height);
+	_screenChanged = true;
+	SignalSema(g_DmacSema);
+}
+
+Graphics::Surface *Gs2dScreen::lockScreen() {
+	WaitSema(g_DmacSema);
+
+	_framebuffer.pixels = _screenBuf;
+	_framebuffer.w = _width;
+	_framebuffer.h = _height;
+	_framebuffer.pitch = _width; // -not- _pitch; ! It's EE mem, not Tex
+	_framebuffer.bytesPerPixel = 1;
+
+	return &_framebuffer;
+}
+
+void Gs2dScreen::unlockScreen() {
+	_screenChanged = true;
+	SignalSema(g_DmacSema);
+}
+
 void Gs2dScreen::setPalette(const uint32 *pal, uint8 start, uint16 num) {
 	assert(start + num <= 256);
 
@@ -386,20 +410,11 @@
 	}
 }
 
-Graphics::Surface *Gs2dScreen::lockScreen() {
+void Gs2dScreen::grabScreen(Graphics::Surface *surf) {
+	assert(surf);
 	WaitSema(g_DmacSema);
-
-	_framebuffer.pixels = _screen->pixels;
-	_framebuffer.w = _screen->w;
-	_framebuffer.h = _screen->h;
-	_framebuffer.pitch = _screen->pitch;
-	_framebuffer.bytesPerPixel = 1;
-
-	return &_framebuffer;
-}
-
-void Gs2dScreen::unlockScreen() {
-	_screenChanged = true;
+	surf->create(_width, _height, 1);
+	memcpy(surf->pixels, _screenBuf, _width * _height);
 	SignalSema(g_DmacSema);
 }
 

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.h	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/Gs2dScreen.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -28,6 +28,7 @@
 
 #include "sysdefs.h"
 #include "backends/platform/ps2/DmaPipe.h"
+#include "graphics/surface.h"
 
 enum TVMode {
 	TV_DONT_CARE = 0,
@@ -56,13 +57,16 @@
 
 	void copyPrintfOverlay(const uint8* buf);
 	void clearPrintfOverlay(void);
+	void clearScreen(void);
 
+	Graphics::Surface *lockScreen();
+	void unlockScreen();
+
 	void copyScreenRect(const uint8 *buf, int pitch, int x, int y, int w, int h);
 	void setPalette(const uint32 *pal, uint8 start, uint16 num);
 	void updateScreen(void);
 	void grabPalette(uint32 *pal, uint8 start, uint16 num);
-	Graphics::Surface *lockScreen();
-	void unlockScreen();
+	void grabScreen(Graphics::Surface *surf);
 	//- overlay routines
 	void copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h);
 	void grabOverlay(uint16 *buf, uint16 pitch);
@@ -94,13 +98,12 @@
 	uint32 _clutPtrs[3];    //   vram pointers
 	uint32 _texPtrs[4];     //
 
+	Graphics::Surface _framebuffer;
 	uint16 _width, _height, _pitch;
 	int16  _mouseX, _mouseY, _hotSpotX, _hotSpotY;
 	uint32 _mouseScaleX, _mouseScaleY;
 	uint8  _mTraCol;
 
-	Graphics::Surface _framebuffer;
-
 	int _shakePos;
 
 	bool _showMouse, _showOverlay, _screenChanged, _overlayChanged, _clutChanged;

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/Makefile.ps2
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/Makefile.ps2	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/Makefile.ps2	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,72 @@
+# $Header: Exp $
+include $(PS2SDK)/Defs.make
+
+DISABLE_SCALERS = true
+DISABLE_HQ_SCALERS = true
+# DISABLE_KYRA = true
+HAVE_GCC3 = true
+
+CC		= ee-gcc
+CXX     = ee-g++
+AS      = ee-gcc
+LD      = ee-gcc
+AR      = ee-ar cru
+RANLIB  = ee-ranlib
+STRIP   = ee-strip
+MKDIR 	= mkdir -p
+RM 	= rm -f
+
+srcdir = ../../..
+VPATH = $(srcdir)
+INCDIR = ../../../
+
+DEFINES  = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_MPEG2 -DUSE_ZLIB -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
+
+# PS2SDK-Ports from ps2dev.org's SVN repository for libmad, zlib and ucl
+PS2SDK_PORTS = /mnt/winxp/scummvm/ports
+PS2SDK_PORTS_INCS = /ucl /zlib/include /libmad/ee/include
+PS2SDK_PORTS_LIBS = /ucl /zlib/lib /libmad/ee/lib
+
+# we also need SjPcm, Tremor and libmpeg2
+MORE_LIBS_DIR = /mnt/winxp/scummvm/ports
+MORE_LIBS_INCS = /SjPcm/ee/src /mpeg2dec/include /tremor
+MORE_LIBS_LIBS = /SjPcm/ee/lib /mpeg2dec/libmpeg2 /tremor/tremor
+
+INCLUDES  = $(addprefix -I$(PS2SDK_PORTS),$(PS2SDK_PORTS_INCS)) 
+INCLUDES += $(addprefix -I$(MORE_LIBS_DIR),$(MORE_LIBS_INCS))
+INCLUDES += -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
+
+TARGET = elf/scummvm.elf
+
+OBJS := backends/platform/ps2/DmaPipe.o \
+    backends/platform/ps2/Gs2dScreen.o \
+    backends/platform/ps2/irxboot.o \
+	backends/platform/ps2/ps2input.o \
+	backends/platform/ps2/ps2pad.o \
+    backends/platform/ps2/savefile.o \
+    backends/platform/ps2/fileio.o \
+    backends/platform/ps2/icon.o \
+    backends/platform/ps2/asyncfio.o \
+    backends/platform/ps2/cd.o \
+    backends/platform/ps2/eecodyvdfs.o \
+    backends/platform/ps2/rpckbd.o \
+    backends/platform/ps2/systemps2.o \
+    backends/platform/ps2/ps2mutex.o \
+    backends/platform/ps2/ps2time.o
+    
+MODULE_DIRS += .
+
+include $(srcdir)/Makefile.common
+
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile 
+LDFLAGS += -L $(PS2SDK)/ee/lib -L .
+LDFLAGS += $(addprefix -L$(MORE_LIBS_DIR),$(MORE_LIBS_LIBS))
+LDFLAGS += $(addprefix -L$(PS2SDK_PORTS),$(PS2SDK_PORTS_LIBS)) 
+LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmpeg2 -lmad -ltremor -lz -lucl -lm -lc -lfileXio -lkernel -lstdc++ 
+# LDFLAGS += -s 
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+	$(LD) $^ $(LDFLAGS) -o $@
+


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/Makefile.ps2
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -35,6 +35,9 @@
 
 extern void sioprintf(const char *zFormat, ...);
 
+#define dbg_printf sioprintf
+// #define dbg_printf printf
+
 AsyncFio::AsyncFio(void) {
 	_runningOp = NULL;
 	memset((int *)_ioSlots, 0, MAX_HANDLES * sizeof(int));
@@ -55,15 +58,28 @@
 	fileXioOpen(name, ioMode, DEFAULT_MODE);
 	fileXioWaitAsync(FXIO_WAIT, &res);
 	SignalSema(_ioSema);
+	dbg_printf("FIO: open(%s, %d) => %d", name, ioMode, res);
 	return res;
 }
 
+int AsyncFio::open(const char *name, int ioMode, int mode) {
+	WaitSema(_ioSema);
+	checkSync();
+	int res;
+	fileXioOpen(name, ioMode, mode);
+	fileXioWaitAsync(FXIO_WAIT, &res);
+	SignalSema(_ioSema);
+	dbg_printf("FIO: open ext(%s, %d, %d) => %d", name, ioMode, mode, res);
+	return res;
+}
+
 void AsyncFio::close(int handle) {
 	WaitSema(_ioSema);
 	checkSync();
 	fileXioClose(handle);
 	int res;
 	fileXioWaitAsync(FXIO_WAIT, &res);
+	dbg_printf("FIO: close(%d) => %d", handle, res);
 	if (res != 0)
 		sioprintf("ERROR: fileXioClose failed, EC %d", res);
 	_ioSlots[handle] = 0;
@@ -122,6 +138,7 @@
 	fileXioDopen(name);
 	fileXioWaitAsync(FXIO_WAIT, &res);
 	SignalSema(_ioSema);
+	dbg_printf("FIO: dopen(%s) => %d", name, res);
 	return res;
 }
 
@@ -141,10 +158,23 @@
 	checkSync();
 	fileXioDclose(fd);
 	fileXioWaitAsync(FXIO_WAIT, &res);
-	assert(res == 0);
+	//assert(res == 0);
+	dbg_printf("FIO: dclose(%d) => %d", fd, res);
+	if (res != 0)
+		sioprintf("ERROR: fileXioDclose failed, EC %d", res);
 	SignalSema(_ioSema);
 }
 
+int AsyncFio::chdir(const char *name) {
+	int res;
+	WaitSema(_ioSema);
+	checkSync();
+	fileXioChdir(name);
+	fileXioWaitAsync(FXIO_WAIT, &res);
+	SignalSema(_ioSema);
+	return res;
+}
+
 int AsyncFio::mount(const char *mountpoint, const char *mountstring, int flag) {
 	int res;
 	WaitSema(_ioSema);

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.h	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/asyncfio.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -31,6 +31,7 @@
 	AsyncFio(void);
 	~AsyncFio(void);
 	int open(const char *name, int ioMode);
+	int open(const char *name, int ioMode, int mode);
 	void close(int handle);
 	void read(int fd, void *dest, unsigned int len);
 	void write(int fd, const void *src, unsigned int len);
@@ -39,6 +40,7 @@
 	int dopen(const char *name);
 	int dread(int fd, iox_dirent_t *dest);
 	void dclose(int fd);
+	int chdir(const char *name);
 	int mount(const char *mountpoint, const char *mountstring, int flag);
 	int umount(const char *mountpoint);
 	int sync(int fd);

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/fileio.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/fileio.h	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/fileio.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -26,6 +26,10 @@
 #ifndef __PS2FILE_IO__
 #define __PS2FILE_IO__
 
+typedef unsigned long uint64;
+typedef signed long   int64;
+
+#include <stdio.h>
 #include "common/scummsys.h"
 
 class Ps2File {

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/Makefile
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/Makefile	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/Makefile	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,30 @@
+# _____     ___ ____     ___ ____
+#  ____|   |    ____|   |        | |____|
+# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+
+
+IOP_OBJS_DIR = obj/
+IOP_BIN_DIR = bin/
+IOP_SRC_DIR = src/
+IOP_INC_DIR = include/
+
+IOP_BIN=bin/rpckbd.irx
+IOP_OBJS=obj/ps2kbd.o obj/imports.o
+
+IOP_CFLAGS=-Wall
+IOP_INCS += -I$(PS2SDKSRC)/iop/usb/usbd/include
+
+all: $(IOP_OBJS_DIR) $(IOP_BIN_DIR) $(IOP_BIN)
+
+clean:
+	rm -f -r $(IOP_OBJS_DIR) $(IOP_BIN_DIR)
+
+include $(PS2SDKSRC)/Defs.make
+include $(PS2SDKSRC)/iop/Rules.make
+include $(PS2SDKSRC)/iop/Rules.release


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/Makefile
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/__ps2kbd.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/__ps2kbd.h	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/__ps2kbd.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,97 @@
+/*
+# _____     ___ ____     ___ ____
+#  ____|   |    ____|   |        | |____|
+# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2
+*/
+
+#ifndef __PS2KBD_H__
+#define __PS2KBD_H__
+
+#define PS2KBD_FSNAME "usbkbd"
+#define PS2KBD_KBDFILE "dev"
+#define PS2KBD_DEVFILE (PS2KBD_FSNAME ":" PS2KBD_KBDFILE)
+
+
+#define PS2KBD_LED_NUMLOCK   1
+#define PS2KBD_LED_CAPSLOCK  2
+#define PS2KBD_LED_SCRLOCK   4
+#define PS2KBD_LED_COMPOSE   8
+#define PS2KBD_LED_KANA      16
+
+#define PS2KBD_LED_MASK      0x1F;
+
+#define PS2KBD_ESCAPE_KEY    0x1B
+
+#define PS2KBD_LEFT_CTRL   (1 << 0)
+#define PS2KBD_LEFT_SHIFT  (1 << 1)
+#define PS2KBD_LEFT_ALT    (1 << 2)
+#define PS2KBD_LEFT_GUI    (1 << 3)
+#define PS2KBD_RIGHT_CTRL  (1 << 4)
+#define PS2KBD_RIGHT_SHIFT (1 << 5)
+#define PS2KBD_RIGHT_ALT   (1 << 6)
+#define PS2KBD_RIGHT_GUI   (1 << 7)
+
+#define PS2KBD_CTRL    (PS2KBD_LEFT_CTRL | PS2KBD_RIGHT_CTRL)
+#define PS2KBD_SHIFT  (PS2KBD_LEFT_SHIFT | PS2KBD_RIGHT_SHIFT)
+#define PS2KBD_ALT    (PS2KBD_LEFT_ALT | PS2KBD_RIGHT_ALT)
+#define PS2KBD_GUI    (PS2KBD_LEFT_GUI | PS2KBD_RIGHT_GUI)
+
+#define PS2KBD_RAWKEY_UP   0xF0
+#define PS2KBD_RAWKEY_DOWN 0xF1
+
+typedef struct _kbd_rawkey
+
+{
+  u8 state;
+  u8 key;
+} kbd_rawkey __attribute__ ((packed));
+
+#define PS2KBD_READMODE_NORMAL 1
+#define PS2KBD_READMODE_RAW    2
+
+/* Notes on read mode */
+/* In normal readmode (default) read multiples of 1 character off the keyboard file. These are 
+   processed by the keymaps so that you get back ASCII data */
+/* In raw readmode must read multiples of 2. First byte indicates state (i.e. Up or Down)
+   Second byte is the USB key code for that key. This table is presented in the USB HID Usage Tables manaual
+   from usb.org */
+
+#define PS2KBD_BLOCKING 1
+#define PS2KBD_NONBLOCKING 0
+
+#define PS2KBD_KEYMAP_SIZE 256
+
+typedef struct _kbd_keymap
+
+{
+  u8 keymap[PS2KBD_KEYMAP_SIZE];
+  u8 shiftkeymap[PS2KBD_KEYMAP_SIZE];
+  u8 keycap[PS2KBD_KEYMAP_SIZE];
+} kbd_keymap;
+
+/* IOCTLs for the keyboard file driver */
+
+#define PS2KBD_IOCTL_SETREADMODE     1 /* Sets up keymapped or raw mode */
+#define PS2KBD_IOCTL_SETLEDS         2 /* Sets the LED state for ALL keyboards connected */
+#define PS2KBD_IOCTL_SETREPEATRATE   3 /* Sets the repeat rate of the keyboard */
+#define PS2KBD_IOCTL_SETKEYMAP       4 /* Sets the keymap for the standard keys, non shifted and shifted */
+#define PS2KBD_IOCTL_SETCTRLMAP      5 /* Sets the control key mapping */
+#define PS2KBD_IOCTL_SETALTMAP       6 /* Sets the alt key mapping */
+#define PS2KBD_IOCTL_SETSPECIALMAP   7 /* Sets the special key mapping */
+#define PS2KBD_IOCTL_SETBLOCKMODE    8 /* Sets whether the keyboard driver blocks on read */
+#define PS2KBD_IOCTL_FLUSHBUFFER     9 /* Flush the internal buffer, probably best after a keymap change */
+#define PS2KBD_IOCTL_RESETKEYMAP    10 /* Reset keymaps to default states */
+
+/* Note on keymaps. In normal keymap a 0 would indicate no key */
+/* Key maps are represented by 3 256*8bit tables. First table maps USB key to a char when not shifted */
+/* Second table maps USB key to a char when shifted */
+/* Third table contains boolean values. If 1 then the key is shifted/unshifted in capslock, else capslock is ignored */
+
+#endif


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/__ps2kbd.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,90 @@
+/*
+# _____     ___ ____     ___ ____
+#  ____|   |    ____|   |        | |____|
+# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2
+*/
+
+#ifndef __PS2KBD_H__
+#define __PS2KBD_H__
+
+#define PS2KBD_RPC_ID	0xb0b0b80
+
+#define PS2KBD_LED_NUMLOCK   1
+#define PS2KBD_LED_CAPSLOCK  2
+#define PS2KBD_LED_SCRLOCK   4
+#define PS2KBD_LED_COMPOSE   8
+#define PS2KBD_LED_KANA      16
+
+#define PS2KBD_LED_MASK      0x1F;
+
+#define PS2KBD_ESCAPE_KEY    0x1B
+
+#define PS2KBD_LEFT_CTRL   (1 << 0)
+#define PS2KBD_LEFT_SHIFT  (1 << 1)
+#define PS2KBD_LEFT_ALT    (1 << 2)
+#define PS2KBD_LEFT_GUI    (1 << 3)
+#define PS2KBD_RIGHT_CTRL  (1 << 4)
+#define PS2KBD_RIGHT_SHIFT (1 << 5)
+#define PS2KBD_RIGHT_ALT   (1 << 6)
+#define PS2KBD_RIGHT_GUI   (1 << 7)
+
+#define PS2KBD_CTRL    (PS2KBD_LEFT_CTRL | PS2KBD_RIGHT_CTRL)
+#define PS2KBD_SHIFT  (PS2KBD_LEFT_SHIFT | PS2KBD_RIGHT_SHIFT)
+#define PS2KBD_ALT    (PS2KBD_LEFT_ALT | PS2KBD_RIGHT_ALT)
+#define PS2KBD_GUI    (PS2KBD_LEFT_GUI | PS2KBD_RIGHT_GUI)
+
+#define PS2KBD_RAWKEY_UP   0xF0
+#define PS2KBD_RAWKEY_DOWN 0xF1
+
+typedef struct _kbd_rawkey {
+  u8 state;
+  u8 key;
+} kbd_rawkey __attribute__ ((packed));
+
+#define PS2KBD_READMODE_NORMAL 1
+#define PS2KBD_READMODE_RAW    2
+
+/* Notes on read mode */
+/* In normal readmode (default) read multiples of 1 character off the keyboard file. These are 
+   processed by the keymaps so that you get back ASCII data */
+/* In raw readmode must read multiples of 2. First byte indicates state (i.e. Up or Down)
+   Second byte is the USB key code for that key. This table is presented in the USB HID Usage Tables manaual
+   from usb.org */
+
+#define PS2KBD_KEYMAP_SIZE 256
+
+typedef struct _kbd_keymap
+
+{
+  u8 keymap[PS2KBD_KEYMAP_SIZE];
+  u8 shiftkeymap[PS2KBD_KEYMAP_SIZE];
+  u8 keycap[PS2KBD_KEYMAP_SIZE];
+} kbd_keymap;
+
+
+/* IRPC function numbers */
+#define KBD_RPC_SETREADMODE     1 /* Sets up keymapped or raw mode */
+#define KBD_RPC_SETLEDS         2 /* Sets the LED state for ALL keyboards connected */
+#define KBD_RPC_SETREPEATRATE   3 /* Sets the repeat rate of the keyboard */
+#define KBD_RPC_SETKEYMAP       4 /* Sets the keymap for the standard keys, non shifted and shifted */
+#define KBD_RPC_SETCTRLMAP      5 /* Sets the control key mapping */
+#define KBD_RPC_SETALTMAP       6 /* Sets the alt key mapping */
+#define KBD_RPC_SETSPECIALMAP   7 /* Sets the special key mapping */
+#define KBD_RPC_FLUSHBUFFER     9 /* Flush the internal buffer, probably best after a keymap change */
+#define KBD_RPC_RESETKEYMAP    10 /* Reset keymaps to default states */
+#define KBD_RPC_READKEY		   11
+#define KBD_RPC_READRAW		   12
+
+/* Note on keymaps. In normal keymap a 0 would indicate no key */
+/* Key maps are represented by 3 256*8bit tables. First table maps USB key to a char when not shifted */
+/* Second table maps USB key to a char when shifted */
+/* Third table contains boolean values. If 1 then the key is shifted/unshifted in capslock, else capslock is ignored */
+
+#endif


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/imports.lst
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/imports.lst	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/imports.lst	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,58 @@
+
+sysclib_IMPORTS_start
+I_memset
+I_strcmp
+I_memcpy
+sysclib_IMPORTS_end
+
+loadcore_IMPORTS_start
+I_FlushDcache
+loadcore_IMPORTS_end
+
+sifcmd_IMPORTS_start
+I_sceSifInitRpc
+I_sceSifSetRpcQueue
+I_sceSifRegisterRpc
+I_sceSifRpcLoop
+sifcmd_IMPORTS_end
+
+stdio_IMPORTS_start
+I_printf
+stdio_IMPORTS_end
+
+thsemap_IMPORTS_start
+I_CreateSema
+I_SignalSema
+I_WaitSema
+I_PollSema
+I_DeleteSema
+thsemap_IMPORTS_end
+
+thbase_IMPORTS_start
+I_StartThread
+I_CreateThread
+I_USec2SysClock
+I_iSetAlarm
+I_SetAlarm
+I_CancelAlarm
+thbase_IMPORTS_end
+
+thevent_IMPORTS_start
+I_WaitEventFlag
+I_iSetEventFlag
+I_CreateEventFlag
+thevent_IMPORTS_end
+
+sysmem_IMPORTS_start
+I_AllocSysMemory
+I_FreeSysMemory
+sysmem_IMPORTS_end
+
+usbd_IMPORTS_start
+I_UsbGetDeviceStaticDescriptor
+I_UsbOpenEndpoint
+I_UsbSetDevicePrivateData
+I_UsbTransfer
+I_UsbRegisterDriver
+usbd_IMPORTS_end
+


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/imports.lst
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/irx_imports.h	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/irx_imports.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,35 @@
+/*
+# _____     ___ ____     ___ ____
+#  ____|   |    ____|   |        | |____|
+# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright (c) 2003 Marcus R. Brown <mrbrown at 0xd6.org> 
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# Defines all IRX imports.
+*/
+
+#ifndef IOP_IRX_IMPORTS_H
+#define IOP_IRX_IMPORTS_H
+
+#include "irx.h"
+
+/* Please keep these in alphabetical order!  */
+#include "dmacman.h"
+#include "intrman.h"
+#include "libsd.h"
+#include "loadcore.h"
+#include "sifcmd.h"
+#include "stdio.h"
+#include "sysclib.h"
+#include "sysmem.h"
+#include "thbase.h"
+#include "thevent.h"
+#include "thmsgbx.h"
+#include "thsemap.h"
+#include "usbd.h"
+#include "vblank.h"
+
+#endif /* IOP_IRX_IMPORTS_H */


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,1199 @@
+/*
+# _____     ___ ____     ___ ____
+#  ____|   |    ____|   |        | |____|
+# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2005, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2
+*/
+
+#include "types.h"
+#include "ioman.h"
+#include "loadcore.h"
+#include "stdio.h"
+#include "sifcmd.h"
+#include "sifrpc.h"
+#include "sysclib.h"
+#include "sysmem.h"
+#include "usbd.h"
+#include "usbd_macro.h"
+#include "thbase.h"
+#include "thevent.h"
+#include "thsemap.h"
+
+#include "ps2kbd.h"
+#include "us_keymap.h"
+
+#define PS2KBD_VERSION 0x100
+
+#define USB_SUBCLASS_BOOT 1
+#define USB_HIDPROTO_KEYBOARD 1
+
+#define PS2KBD_MAXDEV 2
+#define PS2KBD_MAXKEYS 6
+
+#define PS2KBD_DEFLINELEN 4096
+#define PS2KBD_DEFREPEATRATE 100
+/* Default repeat rate in milliseconds */
+#define PS2KBD_REPEATWAIT 1000
+/* Number of milliseconds to wait before starting key repeat */
+#define USB_KEYB_NUMLOCK 0x53
+#define USB_KEYB_CAPSLOCK 0x39
+#define USB_KEYB_SCRLOCK 0x47
+
+#define USB_KEYB_NUMPAD_START 0x54
+#define USB_KEYB_NUMPAD_END 0x63
+
+#define SEMA_ZERO -419
+#define SEMA_DELETED -425
+
+int ps2kbd_init();
+void ps2kbd_config_set(int resultCode, int bytes, void *arg);
+void ps2kbd_idlemode_set(int resultCode, int bytes, void *arg);
+void ps2kbd_data_recv(int resultCode, int bytes, void *arg);
+int ps2kbd_probe(int devId);
+int ps2kbd_connect(int devId);
+int ps2kbd_disconnect(int devId);
+void usb_getstring(int endp, int index, char *desc);
+
+typedef struct _kbd_data_recv
+
+{
+  u8 mod_keys;
+  u8 reserved;
+  u8 keycodes[PS2KBD_MAXKEYS];
+} kbd_data_recv;
+
+typedef struct _keyb_dev
+
+{
+  int configEndp;
+  int dataEndp;
+  int packetSize;
+  int devId;
+  int interfaceNo;    /* Holds the interface number selected on this device */
+  char repeatkeys[2];
+  u32 eventmask;
+  u8 ledStatus;     /* Maintains state on the led status */
+  kbd_data_recv oldData;
+  kbd_data_recv data; /* Holds the data for the transfers */
+} kbd_dev;
+
+/* Global Variables */
+
+int kbd_readmode;
+u32 kbd_repeatrate;
+kbd_dev *devices[PS2KBD_MAXDEV]; /* Holds a list of current devices */
+int dev_count;
+UsbDriver kbd_driver = { NULL, NULL, "PS2Kbd", ps2kbd_probe, ps2kbd_connect, ps2kbd_disconnect };
+u8 *lineBuffer;
+u32 lineStartP, lineEndP;
+int lineSema;
+int bufferSema;
+u32 lineSize;
+u8 keymap[PS2KBD_KEYMAP_SIZE];         /* Normal key map */
+u8 shiftkeymap[PS2KBD_KEYMAP_SIZE];  /* Shifted key map */
+u8 keycap[PS2KBD_KEYMAP_SIZE];          /* Does this key get shifted by capslock ? */
+u8 special_keys[PS2KBD_KEYMAP_SIZE];
+u8 control_map[PS2KBD_KEYMAP_SIZE];
+u8 alt_map[PS2KBD_KEYMAP_SIZE];
+//static struct fileio_driver kbd_fdriver;
+iop_device_t kbd_filedrv;
+u8 keyModValue[8] = { 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7 };
+int repeat_tid;
+int eventid;   /* Id of the repeat event */
+
+int _start ()
+{
+  FlushDcache();
+
+  ps2kbd_init();
+
+  printf("PS2KBD - USB Keyboard Library\n");
+
+  return 0;
+
+}
+
+int ps2kbd_probe(int devId)
+
+{
+  UsbDeviceDescriptor *dev;
+  UsbConfigDescriptor *conf;
+  UsbInterfaceDescriptor *intf;
+  UsbEndpointDescriptor *endp;
+  //UsbStringDescriptor *str;
+
+  if(dev_count >= PS2KBD_MAXDEV)
+    {
+      printf("ERROR: Maximum keyboard devices reached\n");
+      return 0;
+    }
+
+  //printf("PS2Kbd_probe devId %d\n", devId);
+
+  dev = UsbGetDeviceStaticDescriptor(devId, NULL, USB_DT_DEVICE); /* Get device descriptor */
+  if(!dev) 
+    {
+      printf("ERROR: Couldn't get device descriptor\n");
+      return 0;
+    }
+
+  //printf("Device class %d, Size %d, Man %d, Product %d Cpnfigurations %d\n", dev->bDeviceClass, dev->bMaxPacketSize0, dev->iManufacturer, dev->iProduct, dev->bNumConfigurations);
+  /* Check that the device class is specified in the interfaces and it has at least one configuration */
+  if((dev->bDeviceClass != USB_CLASS_PER_INTERFACE) || (dev->bNumConfigurations < 1))
+    {
+      //printf("This is not the droid you're looking for\n");
+      return 0;
+    }
+
+  conf = UsbGetDeviceStaticDescriptor(devId, dev, USB_DT_CONFIG);
+  if(!conf)
+    {
+      printf("ERROR: Couldn't get configuration descriptor\n");
+      return 0;
+    }
+  //printf("Config Length %d Total %d Interfaces %d\n", conf->bLength, conf->wTotalLength, conf->bNumInterfaces);
+
+  if((conf->bNumInterfaces < 1) || (conf->wTotalLength < (sizeof(UsbConfigDescriptor) + sizeof(UsbInterfaceDescriptor))))
+    {
+      printf("ERROR: No interfaces available\n");
+      return 0;
+    }
+     
+  intf = (UsbInterfaceDescriptor *) ((char *) conf + conf->bLength); /* Get first interface */
+/*   printf("Interface Length %d Endpoints %d Class %d Sub %d Proto %d\n", intf->bLength, */
+/* 	 intf->bNumEndpoints, intf->bInterfaceClass, intf->bInterfaceSubClass, */
+/* 	 intf->bInterfaceProtocol); */
+
+  if((intf->bInterfaceClass != USB_CLASS_HID) || (intf->bInterfaceSubClass != USB_SUBCLASS_BOOT) ||
+     (intf->bInterfaceProtocol != USB_HIDPROTO_KEYBOARD) || (intf->bNumEndpoints < 1))
+
+    {
+      //printf("We came, we saw, we told it to fuck off\n");
+      return 0;
+    }
+
+  endp = (UsbEndpointDescriptor *) ((char *) intf + intf->bLength);
+  endp = (UsbEndpointDescriptor *) ((char *) endp + endp->bLength); /* Go to the data endpoint */
+
+  //printf("Endpoint 1 Addr %d, Attr %d, MaxPacket %d\n", endp->bEndpointAddress, endp->bmAttributes, endp->wMaxPacketSizeLB);
+  
+  if(((endp->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) ||
+     ((endp->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN))
+    {
+      printf("ERROR: Endpoint not interrupt type and/or an input\n");
+      return 0;
+    }
+
+  printf("PS2KBD: Found a keyboard device\n");
+
+  return 1;
+}
+
+int ps2kbd_connect(int devId)
+
+{
+  /* Assume we can only get here if we have already checked the device is kosher */
+
+  UsbDeviceDescriptor *dev;
+  UsbConfigDescriptor *conf;
+  UsbInterfaceDescriptor *intf;
+  UsbEndpointDescriptor *endp;
+  kbd_dev *currDev;
+  int devLoop;
+
+  //printf("PS2Kbd_connect devId %d\n", devId);
+
+  dev = UsbGetDeviceStaticDescriptor(devId, NULL, USB_DT_DEVICE); /* Get device descriptor */
+  if(!dev) 
+    {
+      printf("ERROR: Couldn't get device descriptor\n");
+      return 1;
+    }
+
+  conf = UsbGetDeviceStaticDescriptor(devId, dev, USB_DT_CONFIG);
+  if(!conf)
+    {
+      printf("ERROR: Couldn't get configuration descriptor\n");
+      return 1;
+    }
+     
+  intf = (UsbInterfaceDescriptor *) ((char *) conf + conf->bLength); /* Get first interface */
+  endp = (UsbEndpointDescriptor *) ((char *) intf + intf->bLength);
+  endp = (UsbEndpointDescriptor *) ((char *) endp + endp->bLength); /* Go to the data endpoint */
+
+  for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+    {
+      if(devices[devLoop] == NULL)
+	{
+	  break;
+	}
+    }
+
+  if(devLoop == PS2KBD_MAXDEV)
+    {
+      /* How the f*** did we end up here ??? */
+      printf("ERROR: Device Weirdness!!\n");
+      return 1;
+    }
+
+  currDev = (kbd_dev *) AllocSysMemory(0, sizeof(kbd_dev), NULL);
+  if(!currDev)
+    {
+      printf("ERROR: Couldn't allocate a device point for the kbd\n");
+      return 1;
+    }
+
+  devices[devLoop] = currDev;
+  memset(currDev, 0, sizeof(kbd_dev));
+  currDev->configEndp = UsbOpenEndpoint(devId, NULL);
+  currDev->dataEndp = UsbOpenEndpoint(devId, endp);
+  currDev->packetSize = endp->wMaxPacketSizeLB | ((int) endp->wMaxPacketSizeHB << 8);
+  currDev->eventmask = (1 << devLoop);
+  if(currDev->packetSize > sizeof(kbd_data_recv))
+    {
+      currDev->packetSize = sizeof(kbd_data_recv);
+    }
+
+  if(dev->iManufacturer != 0)
+    {
+      usb_getstring(currDev->configEndp, dev->iManufacturer, "Keyboard Manufacturer");
+    }
+
+  if(dev->iProduct != 0)
+    {
+      usb_getstring(currDev->configEndp, dev->iProduct, "Keyboard Product");
+    }
+
+  currDev->devId = devId;
+  currDev->interfaceNo = intf->bInterfaceNumber;
+  currDev->ledStatus = 0;
+
+  UsbSetDevicePrivateData(devId, currDev); /* Set the index for the device data */
+
+  //printf("Configuration value %d\n", conf->bConfigurationValue);
+  UsbSetDeviceConfiguration(currDev->configEndp, conf->bConfigurationValue, ps2kbd_config_set, currDev);
+
+  dev_count++; /* Increment device count */
+  printf("PS2KBD: Connected device\n");
+
+  return 0;
+}
+
+int ps2kbd_disconnect(int devId)
+
+{
+  int devLoop;
+  printf("PS2Kbd_disconnect devId %d\n", devId);
+
+  for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+    {
+      if((devices[devLoop]) && (devices[devLoop]->devId == devId))
+	{
+	  dev_count--;
+	  FreeSysMemory(devices[devLoop]);
+	  devices[devLoop] = NULL;
+	  printf("PS2KBD: Disconnected device\n");
+	  break;
+	}
+    }
+
+  return 0;
+}
+
+typedef struct _string_descriptor
+
+{
+  u8 buf[200];
+  char *desc;
+} string_descriptor; 
+
+void ps2kbd_getstring_set(int resultCode, int bytes, void *arg)
+
+{
+  UsbStringDescriptor *str = (UsbStringDescriptor *) arg;
+  string_descriptor *strBuf = (string_descriptor *) arg;
+  char string[50];
+  int strLoop;
+
+/*   printf("=========getstring=========\n"); */
+
+/*   printf("PS2KEYBOARD: GET_DESCRIPTOR res %d, bytes %d, arg %p\n", resultCode, bytes, arg); */
+
+  if(resultCode == USB_RC_OK)
+    {
+      memset(string, 0, 50);
+      for(strLoop = 0; strLoop < ((bytes - 2) / 2); strLoop++)
+	{
+	  string[strLoop] = str->wData[strLoop] & 0xFF;
+	}
+      printf("%s: %s\n", strBuf->desc, string);
+    }
+  
+  FreeSysMemory(arg);
+}
+
+void usb_getstring(int endp, int index, char *desc)
+
+{
+  u8 *data;
+  string_descriptor *str;
+  int ret; 
+
+  data = (u8 *) AllocSysMemory(0, sizeof(string_descriptor), NULL);
+  str = (string_descriptor *) data;
+
+  if(data != NULL)
+    {
+      str->desc = desc;
+      ret = UsbControlTransfer(endp, 0x80, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) | index, 
+			       0, sizeof(string_descriptor) - 4, data, ps2kbd_getstring_set, data);
+      if(ret != USB_RC_OK)
+	{
+	  printf("PS2KBD: Error sending string descriptor request\n");
+	  FreeSysMemory(data);
+	}
+    }
+}
+
+void ps2kbd_config_set(int resultCode, int bytes, void *arg)
+     /* Called when we have finished choosing our configuration */
+
+{
+  kbd_dev *dev;
+
+  if(resultCode != USB_RC_OK)
+    {
+      printf("PS2KEYBOARD: Configuration set error res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+      return;
+    }
+
+  //printf("PS2KEYBOARD: Configuration set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+  /* Do a interrupt data transfer */
+
+  dev = (kbd_dev *) arg;
+  if(dev != NULL)
+    {
+      int ret;
+      
+      ret = UsbControlTransfer(dev->configEndp, 0x21, USB_REQ_SET_IDLE, 0, dev->interfaceNo, 0, NULL, ps2kbd_idlemode_set, arg);
+    }
+}
+
+void ps2kbd_idlemode_set(int resultCode, int bytes, void *arg)
+
+{
+  kbd_dev *dev;
+
+
+
+  if(resultCode != USB_RC_OK)
+    {
+      printf("PS2KBD: Idlemode set error res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+      return;
+    }
+  
+  dev = (kbd_dev *) arg;
+  if(dev != NULL)
+    {
+      int ret;
+      
+      ret = UsbInterruptTransfer(dev->dataEndp, &dev->data, dev->packetSize, ps2kbd_data_recv, arg);
+    }
+}
+
+void ps2kbd_led_set(int resultCode, int bytes, void *arg)
+
+{
+  //printf("LED Set\n");
+}
+
+void ps2kbd_build_uniquekeys(u8 *res, const u8 *new, const u8 *old)
+
+     /* Builds a list of unique keys */
+
+{
+  int loopNew, loopOld;
+  int loopRes = 0;
+  int foundKey;
+
+  for(loopNew = 0; loopNew < PS2KBD_MAXKEYS; loopNew++)
+    {
+      if(new[loopNew] != 0)
+	{
+	  foundKey = 0;
+	  for(loopOld = 0; loopOld < PS2KBD_MAXKEYS; loopOld++)
+	    {
+	      if(new[loopNew] == old[loopOld])
+		{
+		  foundKey = 1;
+		  break;
+		}
+	    }
+	  if(!foundKey)
+	    {
+	      res[loopRes++] = new[loopNew];
+	    }
+	}
+    }
+}
+
+u32 ps2kbd_repeathandler(void *arg)
+
+{
+  kbd_dev *dev = arg;
+  iop_sys_clock_t t;
+  //printf("Repeat handler\n");
+
+  iSetEventFlag(eventid, dev->eventmask);
+
+  USec2SysClock(kbd_repeatrate * 1000, &t);
+  iSetAlarm(&t, ps2kbd_repeathandler, arg);
+
+  return t.hi;
+}
+
+void ps2kbd_getkeys(u8 keyMods, u8 ledStatus, const u8 *keys, kbd_dev *dev)
+
+{
+  int loopKey;
+  int tempPos = 0;
+  int byteCount = 0;
+  u8 currChars[2];
+
+  if(lineStartP < lineEndP)
+    {
+      tempPos = lineStartP + lineSize;
+    }
+  else
+    {
+      tempPos = lineStartP;
+    }
+  
+  for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++)
+    {
+      u8 currKey = keys[loopKey];
+
+      currChars[0] = 0;
+      currChars[1] = 0;
+
+      if(lineEndP == (tempPos - 1))
+	{
+	  break;
+	}
+
+      if(currKey) /* If this is a valid key */
+	{
+	  if((currKey >= USB_KEYB_NUMPAD_START) && (currKey <= USB_KEYB_NUMPAD_END))
+	    /* Handle numpad specially */
+	    {
+	      if(ledStatus & PS2KBD_LED_NUMLOCK)
+		{
+		  if(keymap[currKey])
+		    {
+		      currChars[0] = keymap[currKey];
+		    }
+		}
+	      else
+		{
+		  if(special_keys[currKey])
+		    {
+		      currChars[0] = PS2KBD_ESCAPE_KEY;
+		      currChars[1] = special_keys[currKey];
+		    }
+		  else if(keymap[currKey] != '5') /* Make sure this isnt a 5 key :) */
+		    {
+		      currChars[0] = keymap[currKey];
+		    }
+		}
+	    }
+	  else if(special_keys[currKey]) /* This is a special key */
+	    {
+	      currChars[0] = PS2KBD_ESCAPE_KEY;
+	      currChars[1] = special_keys[currKey];
+	    }
+	  else if(keyMods & PS2KBD_CTRL) /* CTRL */
+	    {
+	      if(control_map[currKey])
+		{
+		  currChars[0] = control_map[currKey];
+		}
+	    }
+	  else if(keyMods & PS2KBD_ALT) /* ALT */
+	    {
+	      if(alt_map[currKey])
+		{
+		  currChars[0] = alt_map[currKey];
+		}
+	    }
+	  else if(keyMods & PS2KBD_SHIFT) /* SHIFT */
+	    {
+	      if((ledStatus & PS2KBD_LED_CAPSLOCK) && (keycap[currKey]))
+		{
+		  currChars[0] = keymap[currKey];
+		}
+	      else
+		{
+		  currChars[0] = shiftkeymap[currKey];
+		}
+	    }
+	  else /* Normal key */
+	    {
+	      if(keymap[keys[loopKey]])
+		{
+		  if((ledStatus & PS2KBD_LED_CAPSLOCK) && (keycap[currKey]))
+		    {
+		      currChars[0] = shiftkeymap[currKey];
+		    }
+		  else
+		    {
+		      currChars[0] = keymap[currKey];
+		    }
+		}
+	    }
+	}
+
+      if((currChars[0] == PS2KBD_ESCAPE_KEY) && (currChars[1] != 0))
+	{
+	  if(lineEndP != (tempPos - 2))
+	    {
+	      lineBuffer[lineEndP++] = currChars[0];
+	      lineEndP %= lineSize;
+	      lineBuffer[lineEndP++] = currChars[1];
+	      lineEndP %= lineSize;
+	      byteCount += 2;
+	    }
+	  dev->repeatkeys[0] = currChars[0];
+	  dev->repeatkeys[1] = currChars[1];
+	}
+      else if(currChars[0] != 0)
+	{
+	  lineBuffer[lineEndP++] = currChars[0];
+	  lineEndP %= lineSize;
+	  byteCount++;
+	  dev->repeatkeys[0] = currChars[0];
+	  dev->repeatkeys[1] = 0;
+	}
+    }
+
+  if(byteCount > 0) 
+    {
+      iop_sys_clock_t t;
+      /* Set alarm to do repeat rate */
+      //printf("repeatkeys %d %d\n", kbd_repeatkeys[0], kbd_repeatkeys[1]);
+      USec2SysClock(PS2KBD_REPEATWAIT * 1000, &t);
+      SetAlarm(&t, ps2kbd_repeathandler, dev);
+    }
+
+  for(loopKey = 0; loopKey < byteCount; loopKey++) /* Signal the sema to indicate data */
+    {
+      SignalSema(bufferSema);
+    }
+
+/*   lineBuffer[PS2KBD_DEFLINELEN - 1] = 0; */
+/*   printf(lineBuffer); */
+  //printf("lineStart %d, lineEnd %d\n", lineStartP, lineEndP);
+}
+
+
+void ps2kbd_getkeys_raw(u8 newKeyMods, u8 oldKeyMods, u8 *new, const u8 *old)
+
+{
+  int loopKey;
+  u8 currKey;
+  u8 keyMods = newKeyMods ^ oldKeyMods;
+  u8 keyModsMap = newKeyMods & keyMods;
+  int tempPos = 0;
+  int byteCount = 0;
+
+  if(lineStartP < lineEndP)
+    {
+      tempPos = lineStartP + lineSize;
+    }
+  else
+    {
+      tempPos = lineStartP;
+    }
+  
+  for(loopKey = 0; loopKey < 8; loopKey++)
+    {
+      int currMod = (1 << loopKey);
+      if(keyMods & currMod) 
+	{
+	  if(lineEndP == (tempPos - 2))
+	    {
+	      return;
+	    }
+
+	  currKey = keyModValue[loopKey];
+
+	  if(keyModsMap & currMod) /* If key pressed */
+	    {
+	      lineBuffer[lineEndP++] = PS2KBD_RAWKEY_DOWN;
+	      //printf("Key down\n");
+	    }
+	  else
+	    {
+	      lineBuffer[lineEndP++] = PS2KBD_RAWKEY_UP;
+	      //printf("Key up\n");
+	    }
+
+	  lineEndP %= lineSize;
+	  lineBuffer[lineEndP++] = currKey;
+	  lineEndP %= lineSize;
+	  byteCount += 2;
+	  //printf("Key %d\n", currKey);
+	}
+    }
+
+  for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++)
+    {
+      if(lineEndP == (tempPos - 2))
+	{
+	  return;
+	}
+
+      if(new[loopKey] != 0)
+	{
+	  lineBuffer[lineEndP++] = PS2KBD_RAWKEY_DOWN;
+	  lineEndP %= lineSize;
+	  lineBuffer[lineEndP++] = new[loopKey];
+	  lineEndP %= lineSize;
+	  byteCount += 2;
+	  //printf("Key down\nKey %d\n", new[loopKey]);
+	}
+
+    }
+
+  for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++)
+    {
+      if(lineEndP == (tempPos - 2))
+	{
+	  return;
+	}
+
+      if(old[loopKey] != 0)
+	{
+	  lineBuffer[lineEndP++] = PS2KBD_RAWKEY_UP;
+	  lineEndP %= lineSize;
+	  lineBuffer[lineEndP++] = old[loopKey];
+	  lineEndP %= lineSize;
+	  byteCount += 2;
+	  //printf("Key up\nKey %d\n", old[loopKey]);
+	}
+
+    }
+
+  for(loopKey = 0; loopKey < byteCount; loopKey++) /* Signal the sema for the number of bytes read */
+    {
+      SignalSema(bufferSema);
+    }
+}
+
+void ps2kbd_data_recv(int resultCode, int bytes, void *arg)
+
+{
+  kbd_dev *dev;
+  int ret;
+  int phantom;
+  int loop;
+
+  if(resultCode != USB_RC_OK)
+    {
+      printf("PS2KEYBOARD: Data Recv set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+      return;
+    }
+  
+  //printf("PS2KBD: Data Recv set res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
+
+  dev = (kbd_dev *) arg;
+  if(dev == NULL)
+    {
+      printf("PS2KBD: dev == NULL\n");
+      return;
+    }
+    
+/*       printf("PS2KBD Modifiers %02X, Keys ", dev->data.mod_keys); */
+/*       for(loop = 0; loop < PS2KBD_MAXKEYS; loop++) */
+/* 	{ */
+/* 	  printf("%02X ", dev->data.keycodes[loop]); */
+/* 	} */
+/*       printf("\n"); */
+
+  CancelAlarm(ps2kbd_repeathandler, dev); /* Make sure repeat alarm is cancelled */
+
+  /* Check for phantom states */
+  phantom = 1;
+  for(loop = 0; loop < PS2KBD_MAXKEYS; loop++)
+    {
+      if(dev->data.keycodes[loop] != 1)
+	{
+	  phantom = 0;
+	  break;
+	}
+    }
+  
+  if(!phantom) /* If not in a phantom state */
+    {
+      u8 uniqueKeys[PS2KBD_MAXKEYS];
+      u8 missingKeys[PS2KBD_MAXKEYS];
+      int loopKey;
+
+      memset(uniqueKeys, 0, PS2KBD_MAXKEYS);
+      memset(missingKeys, 0, PS2KBD_MAXKEYS);
+      ps2kbd_build_uniquekeys(uniqueKeys, dev->data.keycodes, dev->oldData.keycodes);
+      ps2kbd_build_uniquekeys(missingKeys, dev->oldData.keycodes, dev->data.keycodes);
+      /* Build new and missing key lists */
+
+/*       printf("Unique keys : "); */
+/*       for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++) */
+/* 	{ */
+/* 	  printf("%02X ", uniqueKeys[loopKey]); */
+/* 	} */
+/*       printf("\n"); */
+
+/*       printf("Missing keys : "); */
+/*       for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++) */
+/* 	{ */
+/* 	  printf("%02X ", missingKeys[loopKey]); */
+/* 	} */
+/*       printf("\n"); */
+      
+      if(kbd_readmode == PS2KBD_READMODE_NORMAL)
+	{
+	  u8 ledStatus;
+
+	  ledStatus = dev->ledStatus;
+	  //printf("ledStatus %02X\n", ledStatus);
+	  
+	  for(loopKey = 0; loopKey < PS2KBD_MAXKEYS; loopKey++) /* Process key codes */
+	    {
+	      switch(uniqueKeys[loopKey])
+		{
+		case USB_KEYB_NUMLOCK : 
+		  ledStatus ^= PS2KBD_LED_NUMLOCK;
+		  uniqueKeys[loopKey] = 0;
+		  break;
+		case USB_KEYB_CAPSLOCK : 
+		  ledStatus ^= PS2KBD_LED_CAPSLOCK;
+		  uniqueKeys[loopKey] = 0;
+		  break;
+		case USB_KEYB_SCRLOCK :
+		  ledStatus ^= PS2KBD_LED_SCRLOCK;
+		  uniqueKeys[loopKey] = 0;
+		  break;
+		}
+	    }
+	  
+	  if(ledStatus != dev->ledStatus)
+	    {
+	      dev->ledStatus = ledStatus & PS2KBD_LED_MASK;
+	      //printf("LEDS %02X\n", dev->ledStatus);
+	      /* Call Set LEDS */
+	      UsbControlTransfer(dev->configEndp, 0x21, USB_REQ_SET_REPORT, 0x200, 
+				 dev->interfaceNo, 1, &dev->ledStatus, ps2kbd_led_set, arg);
+	    }
+	  
+	  WaitSema(lineSema); /* Make sure no other thread is going to manipulate the buffer */
+	  ps2kbd_getkeys(dev->data.mod_keys, dev->ledStatus, uniqueKeys, dev); /* read in remaining keys */
+	  SignalSema(lineSema);
+	}
+      else /* RAW Mode */
+	{
+	  WaitSema(lineSema);
+	  ps2kbd_getkeys_raw(dev->data.mod_keys, dev->oldData.mod_keys, uniqueKeys, missingKeys);
+	  SignalSema(lineSema);
+	}
+
+      memcpy(&dev->oldData, &dev->data, sizeof(kbd_data_recv));
+    }
+  
+  ret = UsbInterruptTransfer(dev->dataEndp, &dev->data, dev->packetSize, ps2kbd_data_recv, arg);
+}
+
+void flushbuffer()
+
+{
+  iop_sema_t s;
+
+  lineStartP = 0;
+  lineEndP = 0;
+  memset(lineBuffer, 0, lineSize);
+  
+  DeleteSema(bufferSema);
+  s.initial = 0;
+  s.max = lineSize;
+  s.option = 0;
+  s.attr = 0;
+  bufferSema = CreateSema(&s); /* Create a sema to maintain status of readable data */
+  
+  if(bufferSema <= 0)
+    {
+      printf("Error creating buffer sema\n");
+    }
+}
+
+void ps2kbd_rpc_setreadmode(u32 readmode)
+
+{
+  int devLoop;
+
+  if(readmode == kbd_readmode) return; 
+
+  if((readmode == PS2KBD_READMODE_NORMAL) || (readmode == PS2KBD_READMODE_RAW))
+    {
+      /* Reset line buffer */
+      //printf("ioctl_setreadmode %d\n", readmode);
+      for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+	{
+	  CancelAlarm(ps2kbd_repeathandler, devices[devLoop]);
+	}
+
+      WaitSema(lineSema);
+      kbd_readmode = readmode;
+      flushbuffer();
+      SignalSema(lineSema);
+    }
+}
+
+void ps2kbd_rpc_setkeymap(kbd_keymap *keymaps)
+
+{
+  //printf("ioctl_setkeymap %p\n", keymaps);
+  WaitSema(lineSema);   /* Lock the input so you dont end up with weird results */
+  memcpy(keymap, keymaps->keymap, PS2KBD_KEYMAP_SIZE);
+  memcpy(shiftkeymap, keymaps->shiftkeymap, PS2KBD_KEYMAP_SIZE);
+  memcpy(keycap, keymaps->keycap, PS2KBD_KEYMAP_SIZE);
+  SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setctrlmap(u8 *ctrlmap)
+
+{
+  //printf("ioctl_setctrlmap %p\n", ctrlmap);
+  WaitSema(lineSema);
+  memcpy(control_map, ctrlmap, PS2KBD_KEYMAP_SIZE);
+  SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setaltmap(u8 *altmap)
+
+{
+  //printf("ioctl_setaltmap %p\n", altmap);
+  WaitSema(lineSema);
+  memcpy(alt_map, altmap, PS2KBD_KEYMAP_SIZE);
+  SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setspecialmap(u8 *special)
+
+{
+  //printf("ioctl_setspecialmap %p\n", special);
+  WaitSema(lineSema);
+  memcpy(special_keys, special, PS2KBD_KEYMAP_SIZE);
+  SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_resetkeymap()
+     /* Reset keymap to default US variety */
+
+{
+  //printf("ioctl_resetkeymap()\n");
+  WaitSema(lineSema);
+  memcpy(keymap, us_keymap, PS2KBD_KEYMAP_SIZE);
+  memcpy(shiftkeymap, us_shiftkeymap, PS2KBD_KEYMAP_SIZE);
+  memcpy(keycap, us_keycap, PS2KBD_KEYMAP_SIZE);
+  memcpy(special_keys, us_special_keys, PS2KBD_KEYMAP_SIZE);
+  memcpy(control_map, us_control_map, PS2KBD_KEYMAP_SIZE);
+  memcpy(alt_map, us_alt_map, PS2KBD_KEYMAP_SIZE);
+  SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_flushbuffer()
+     /* Flush the internal buffer */
+
+{
+  //printf("ioctl_flushbuffer()\n");
+  WaitSema(lineSema);
+  flushbuffer();
+  SignalSema(lineSema);
+}
+
+void ps2kbd_rpc_setleds(u8 ledStatus)
+
+{
+  int devLoop;
+  kbd_dev *dev;
+
+  //printf("ioctl_setleds %d\n", ledStatus);
+  ledStatus &= PS2KBD_LED_MASK;
+  for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+    {
+      dev = devices[devLoop];
+      if(dev)
+	{
+	  if(ledStatus != dev->ledStatus)
+	    {
+	      dev->ledStatus = ledStatus & PS2KBD_LED_MASK;
+	      UsbControlTransfer(dev->configEndp, 0x21, USB_REQ_SET_REPORT, 0x200,
+				 dev->interfaceNo, 1, &dev->ledStatus, ps2kbd_led_set, dev);
+	    }
+	}
+    }
+}
+
+void ps2kbd_rpc_setrepeatrate(u32 rate)
+{
+  kbd_repeatrate = rate;
+}
+
+int kbd_read(void *buf, int size)
+{
+	int count = 0;
+	char *data = (char *) buf;
+
+	if(kbd_readmode == PS2KBD_READMODE_RAW)
+		size &= ~1; /* Ensure size of a multiple of 2 */
+
+	if (PollSema(bufferSema) >= 0) {
+		SignalSema(bufferSema);
+		if (WaitSema(lineSema) >= 0) {
+			while((count < size) && (lineStartP != lineEndP)) {
+				data[count] = lineBuffer[lineStartP++];
+				lineStartP %= lineSize;
+				count++;
+				PollSema(bufferSema); /* Take off one count from the sema */
+			}
+			SignalSema(lineSema);
+		}
+	}
+	return count;
+}
+
+void repeat_thread(void *arg)
+
+{
+  u32 eventmask;
+  int devLoop;
+
+  for(;;)
+    {
+      WaitEventFlag(eventid, 0xFFFFFFFF, 0x01 | 0x10, &eventmask);
+      //printf("Recieved event %08X\n", eventmask);
+      for(devLoop = 0; devLoop < PS2KBD_MAXDEV; devLoop++)
+	{
+	  if((eventmask & (1 << devLoop)) && (devices[devLoop]))
+	    {
+	      int tempPos = 0;
+
+	      WaitSema(lineSema);
+	      if(lineStartP < lineEndP)
+		{
+		  tempPos = lineStartP + lineSize;
+		}
+	      else
+		{
+		  tempPos = lineStartP;
+		}
+
+	      if((devices[devLoop]->repeatkeys[0]) && (devices[devLoop]->repeatkeys[1]))
+		{
+		  if(lineEndP != (tempPos - 2))
+		    {
+		      lineBuffer[lineEndP++] = devices[devLoop]->repeatkeys[0];
+		      lineEndP %= lineSize;	      
+		      lineBuffer[lineEndP++] = devices[devLoop]->repeatkeys[1];
+		      lineEndP %= lineSize;
+		      SignalSema(bufferSema);
+		      SignalSema(bufferSema);
+		    }
+		}
+	      else if(devices[devLoop]->repeatkeys[0])
+		{
+		  if(lineEndP != (tempPos - 1))
+		    {
+		      lineBuffer[lineEndP++] = devices[devLoop]->repeatkeys[0];
+		      lineEndP %= lineSize;	      
+		      SignalSema(bufferSema);
+		    }
+		}
+
+	      SignalSema(lineSema);
+	    }
+	}
+    }
+}
+
+int init_repeatthread()
+     /* Creates a thread to handle key repeats */
+{
+  iop_thread_t param;
+  iop_event_t event;
+
+  event.attr = 0;
+  event.option = 0;
+  event.bits = 0;
+  eventid = CreateEventFlag(&event);
+
+  param.attr         = TH_C;
+  param.thread    = repeat_thread;
+  param.priority     = 40;
+  param.stacksize    = 0x800;
+  param.option       = 0;
+
+  repeat_tid = CreateThread(&param);
+  if (repeat_tid > 0) {
+    StartThread(repeat_tid, 0);
+    return 0;
+  }
+  else 
+    {
+      return 1;
+    }
+}
+
+static unsigned long retKey;
+
+void *ps2kbd_rpc_server(int fno, void *data, int size) {
+	retKey = 0;
+	switch (fno) {
+	case KBD_RPC_SETREADMODE:
+		ps2kbd_rpc_setreadmode(*(u32 *)data);
+		break;
+	case KBD_RPC_SETKEYMAP:
+		ps2kbd_rpc_setkeymap((kbd_keymap *) data);
+		break;
+	case KBD_RPC_SETALTMAP:
+		ps2kbd_rpc_setaltmap((u8 *) data);
+		break;
+	case KBD_RPC_SETCTRLMAP:
+		ps2kbd_rpc_setctrlmap((u8 *) data);
+		break;
+	case KBD_RPC_SETSPECIALMAP:
+		ps2kbd_rpc_setspecialmap((u8 *) data);
+		break;
+	case KBD_RPC_FLUSHBUFFER:
+		ps2kbd_rpc_flushbuffer();
+		break;
+	case KBD_RPC_SETLEDS:
+		ps2kbd_rpc_setleds(*(u8*) data);
+		break;
+	case KBD_RPC_RESETKEYMAP:
+		ps2kbd_rpc_resetkeymap();
+		break;
+	case KBD_RPC_SETREPEATRATE:
+		ps2kbd_rpc_setrepeatrate(*(u32 *) data);
+		break;
+	case KBD_RPC_READRAW:
+		kbd_read(&retKey, 2);
+		return &retKey;
+	case KBD_RPC_READKEY:
+		kbd_read(&retKey, 1);
+		return &retKey;
+	default:
+		printf("Ps2Kbd: Unknown RPC command %d\n", fno);
+		break;
+	}
+	return NULL;
+}
+
+struct t_SifRpcDataQueue qd;
+struct t_SifRpcServerData sd0;
+void *rpcRcvBuf;
+
+void ps2kbd_start_rpc(unsigned long tid) {
+	rpcRcvBuf = AllocSysMemory(0, 3 * PS2KBD_KEYMAP_SIZE, NULL);
+	printf("Ps2Kbd: starting RPC server\n");
+	SifInitRpc(0);
+
+	SifSetRpcQueue(&qd, tid);
+	SifRegisterRpc(&sd0, PS2KBD_RPC_ID, ps2kbd_rpc_server, rpcRcvBuf, 0, 0, &qd);
+	SifRpcLoop(&qd);
+}
+
+int ps2kbd_init_rpc(void) {
+	struct _iop_thread param;
+	int th;
+
+	param.attr         = 0x02000000;
+	param.thread       = (void*)ps2kbd_start_rpc;
+	param.priority 	  = 40;
+	param.stacksize    = 0x800;
+	param.option      = 0;
+
+	th = CreateThread(&param);
+
+	if (th > 0)	{
+		StartThread(th, (void *)th);
+		return 0;
+	} else
+		return -1;
+}
+
+int ps2kbd_init() {
+  int ret;
+  iop_sema_t s;
+
+  s.initial = 1;
+  s.max = 1;
+  s.option = 0;
+  s.attr = 0;
+  lineSema = CreateSema(&s);
+  if(lineSema <= 0)
+    {
+      printf("Error creating sema\n");
+      return 1;
+    }
+
+  s.initial = 0;
+  s.max = PS2KBD_DEFLINELEN;
+  s.option = 0;
+  s.attr = 0;
+  bufferSema = CreateSema(&s); /* Create a sema to maintain status of readable data */
+  if(bufferSema <= 0)
+    {
+      printf("Error creating buffer sema\n");
+      return 1;
+    }
+
+  lineBuffer = (u8 *) AllocSysMemory(0, PS2KBD_DEFLINELEN, NULL);
+  if(lineBuffer == NULL)
+    {
+      printf("Error allocating line buffer\n");
+      return 1;
+    }
+  lineStartP = 0;
+  lineEndP = 0;
+  lineSize = PS2KBD_DEFLINELEN;
+  memset(lineBuffer, 0, PS2KBD_DEFLINELEN);
+  
+  memset(devices, 0, sizeof(kbd_dev *) * PS2KBD_MAXDEV);
+  dev_count = 0;
+  kbd_readmode = PS2KBD_READMODE_NORMAL;
+  kbd_repeatrate = PS2KBD_DEFREPEATRATE;
+  memcpy(keymap, us_keymap, PS2KBD_KEYMAP_SIZE);
+  memcpy(shiftkeymap, us_shiftkeymap, PS2KBD_KEYMAP_SIZE);
+  memcpy(keycap, us_keycap, PS2KBD_KEYMAP_SIZE);
+  memcpy(special_keys, us_special_keys, PS2KBD_KEYMAP_SIZE);
+  memcpy(control_map, us_control_map, PS2KBD_KEYMAP_SIZE);
+  memcpy(alt_map, us_alt_map, PS2KBD_KEYMAP_SIZE);
+
+  ps2kbd_init_rpc();
+  init_repeatthread();
+
+  ret = UsbRegisterDriver(&kbd_driver);
+  if(ret != USB_RC_OK)
+    {
+      printf("Error registering USB devices\n");
+      return 1;
+    }
+
+  printf("UsbRegisterDriver %d\n", ret);
+
+  return 0;
+}


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/us_keymap.h	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/us_keymap.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,1579 @@
+/*
+# _____     ___ ____     ___ ____
+#  ____|   |    ____|   |        | |____|
+# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2
+*/
+
+#ifndef __US_KEYMAP_H__
+#define __US_KEYMAP_H__
+
+/* Default US keymap */
+
+u8 us_keymap[PS2KBD_KEYMAP_SIZE] = 
+  { 
+    0,
+    0,
+    0,
+    0,
+    'a',
+    'b',
+    'c',
+    'd',
+    'e',
+    'f',
+    'g',
+    'h',
+    'i',
+    'j',
+    'k',
+    'l',
+    'm',
+    'n',
+    'o',
+    'p',
+    'q',
+    'r',
+    's',
+    't',
+    'u',
+    'v',
+    'w',
+    'x',
+    'y',
+    'z',
+    '1',
+    '2',
+    '3',
+    '4',
+    '5',
+    '6',
+    '7',
+    '8',
+    '9',
+    '0',
+    10, /* line feed */
+    0, /* Esc */
+    0x7,/* BS */
+    0x9, /* TAB */
+    0x20,
+    '-',
+    '=',
+    '[',
+    ']',
+    '\\',
+    '#',
+    ';',
+    '\'',
+    '`',
+    ',',
+    '.',
+    '/',
+    0, /* CL */
+    0, // F1
+    0, // F2
+    0, // F3
+    0, // F4
+    0, // F5
+    0, // F6
+    0, // F7
+    0, // F8 
+    0, // F9
+    0, // F10
+    0, // F11
+    0, // F12
+    0, // PrintScr
+    0, // Scroll Lock
+    0, // Pause
+    0, // Insert
+    0, // Home 
+    0, // Pg Up
+    0, // Delete
+    0, // End
+    0, // Pg Down
+    0, // Right
+    0, // Left
+    0, // Down
+    0, // Up
+    0, // Numlock
+    '/', // Keypad 
+    '*',
+    '-',
+    '+',
+    10,
+    '1',
+    '2',
+    '3',
+    '4',
+    '5',
+    '6',
+    '7',
+    '8',
+    '9',
+    '0',
+    '.',
+    '\\',
+    0,
+    0,
+    '=',
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
+  };
+
+u8 us_shiftkeymap[PS2KBD_KEYMAP_SIZE] = 
+  {
+    0,
+    0,
+    0,
+    0,
+    'A',
+    'B',
+    'C',
+    'D',
+    'E',
+    'F',
+    'G',
+    'H',
+    'I',
+    'J',
+    'K',
+    'L',
+    'M',
+    'N',
+    'O',
+    'P',
+    'Q',
+    'R',
+    'S',
+    'T',
+    'U',
+    'V',
+    'W',
+    'X',
+    'Y',
+    'Z',
+    '!',
+    '@',
+    '#',
+    '$',
+    '%',
+    '^',
+    '&',
+    '*',
+    '(',
+    ')',
+    10, /* line feed */
+    0, /* Esc */
+    0x7,/* BS */
+    0x9, /* TAB */
+    0x20,
+    '_',
+    '+',
+    '{',
+    '}',
+    '|',
+    '~',
+    ':',
+    '"',
+    '~',
+    '<',
+    '>',
+    '?',
+    0, /* CL */
+    0, // F1
+    0, // F2
+    0, // F3
+    0, // F4
+    0, // F5
+    0, // F6
+    0, // F7
+    0, // F8 
+    0, // F9
+    0, // F10
+    0, // F11
+    0, // F12
+    0, // PrintScr
+    0, // Scroll Lock
+    0, // Pause
+    0, // Insert
+    0, // Home 
+    0, // Pg Up
+    0, // Delete
+    0, // End
+    0, // Pg Down
+    0, // Right
+    0, // Left
+    0, // Down
+    0, // Up
+    0, // Numlock
+    '/', // Keypad 
+    '*',
+    '-',
+    '+',
+    10,
+    '1',
+    '2',
+    '3',
+    '4',
+    '5',
+    '6',
+    '7',
+    '8',
+    '9',
+    '0',
+    '.',
+    '\\',
+    0,
+    0,
+    '=',
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
+  };
+
+u8 us_keycap[PS2KBD_KEYMAP_SIZE] = 
+  {
+    0,
+    0,
+    0,
+    0,
+    1, //a
+    1, //b
+    1, //c
+    1, //d
+    1, //e
+    1, //f
+    1,//g
+    1,//h
+    1,//i
+    1,//j
+    1,//k
+    1,//l
+    1,//m
+    1,//n
+    1,//o
+    1,//p
+    1,//q
+    1,//r
+    1,//s
+    1,//t
+    1,//u
+    1,//v
+    1,//w
+    1,//x
+    1,//y
+    1,//z
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0, /* line feed */
+    0, /* Esc */
+    0,/* BS */
+    0, /* TAB */
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0, /* CL */
+    0, // F1
+    0, // F2
+    0, // F3
+    0, // F4
+    0, // F5
+    0, // F6
+    0, // F7
+    0, // F8 
+    0, // F9
+    0, // F10
+    0, // F11
+    0, // F12
+    0, // PrintScr
+    0, // Scroll Lock
+    0, // Pause
+    0, // Insert
+    0, // Home 
+    0, // Pg Up
+    0, // Delete
+    0, // End
+    0, // Pg Down
+    0, // Right
+    0, // Left
+    0, // Down
+    0, // Up
+    0, // Numlock
+    0, // Keypad 
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
+  };
+
+u8 us_special_keys[PS2KBD_KEYMAP_SIZE] = { 
+
+    0,
+    0,
+    0,
+    0,
+    0, //a
+    0, //b
+    0, //c
+    0, //d
+    0, //e
+    0, //f
+    0,//g
+    0,//h
+    0,//i
+    0,//j
+    0,//k
+    0,//l
+    0,//m
+    0,//n
+    0,//o
+    0,//p
+    0,//q
+    0,//r
+    0,//s
+    0,//t
+    0,//u
+    0,//v
+    0,//w
+    0,//x
+    0,//y
+    0,//z
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0, /* line feed */
+    0x1B, /* Esc */
+    0,/* BS */
+    0, /* TAB */
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0, /* CL */
+    1, // F1
+    2, // F2
+    3, // F3
+    4, // F4
+    5, // F5
+    6, // F6
+    7, // F7
+    8, // F8 
+    9, // F9
+    10, // F10
+    11, // F11
+    12, // F12
+    32, // PrintScr
+    33, // Scroll Lock
+    34, // Pause
+    35, // Insert
+    36, // Home 
+    37, // Pg Up
+    38, // Delete
+    39, // End
+    40, // Pg Down
+    41, // Right
+    42, // Left
+    43, // Down
+    44, // Up
+    0, // Numlock
+    0, // Keypad / 
+    0, // Keypad *
+    0, // Keypad -
+    0, // Keypad +
+    0, // Keypad Enter
+    39, // Keypad 1/End
+    43, // Keypad 2/Down
+    40, // Keypad 3/PageDn
+    42, // Keypad 4/Left
+    0, // Keypad 5
+    41, // Keypad 6/Right
+    36, // Keypad 7/Home
+    44, // Keypad 8/Up
+    37, // Keypad 9/PageUp
+    35, // Keypad 0/Insert
+    38, // Keypad ./Delete
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
+  };
+
+u8 us_control_map[PS2KBD_KEYMAP_SIZE] = { 
+
+    0,
+    0,
+    0,
+    0,
+    1, //a
+    2, //b
+    3, //c
+    4, //d
+    5, //e
+    6, //f
+    7,//g
+    8,//h
+    9,//i
+    10,//j
+    11,//k
+    12,//l
+    13,//m
+    14,//n
+    15,//o
+    16,//p
+    17,//q
+    18,//r
+    19,//s
+    20,//t
+    21,//u
+    22,//v
+    23,//w
+    24,//x
+    25,//y
+    26,//z
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0, /* line feed */
+    0, /* Esc */
+    0,/* BS */
+    0, /* TAB */
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0, /* CL */
+    0, // F1
+    0, // F2
+    0, // F3
+    0, // F4
+    0, // F5
+    0, // F6
+    0, // F7
+    0, // F8 
+    0, // F9
+    0, // F10
+    0, // F11
+    0, // F12
+    0, // PrintScr
+    0, // Scroll Lock
+    0, // Pause
+    0, // Insert
+    0, // Home 
+    0, // Pg Up
+    0, // Delete
+    0, // End
+    0, // Pg Down
+    0, // Right
+    0, // Left
+    0, // Down
+    0, // Up
+    0, // Numlock
+    0, // Keypad 
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
+};
+
+u8 us_alt_map[PS2KBD_KEYMAP_SIZE] = { 
+
+    0,
+    0,
+    0,
+    0,
+    128, //a
+    129, //b
+    130, //c
+    131, //d
+    132, //e
+    133, //f
+    134,//g
+    135,//h
+    136,//i
+    137,//j
+    138,//k
+    139,//l
+    140,//m
+    141,//n
+    142,//o
+    143,//p
+    144,//q
+    145,//r
+    146,//s
+    147,//t
+    148,//u
+    149,//v
+    150,//w
+    151,//x
+    152,//y
+    154,//z
+    155,
+    156,
+    157,
+    158,
+    159,
+    160,
+    161,
+    162,
+    163,
+    164,
+    165, /* line feed */
+    0, /* Esc */
+    0,/* BS */
+    0, /* TAB */
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0, /* CL */
+    0, // F1
+    0, // F2
+    0, // F3
+    0, // F4
+    0, // F5
+    0, // F6
+    0, // F7
+    0, // F8 
+    0, // F9
+    0, // F10
+    0, // F11
+    0, // F12
+    0, // PrintScr
+    0, // Scroll Lock
+    0, // Pause
+    0, // Insert
+    0, // Home 
+    0, // Pg Up
+    0, // Delete
+    0, // End
+    0, // Pg Down
+    0, // Right
+    0, // Left
+    0, // Down
+    0, // Up
+    0, // Numlock
+    0, // Keypad 
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0
+  };
+
+#endif


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/irxboot.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/irxboot.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/irxboot.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -34,8 +34,8 @@
 
 extern void sioprintf(const char *zFormat, ...);
 
-static const char hddArg[] = "-o" "\0" "4" "\0" "-n" "\0" "20";
-static const char pfsArg[] = "-m" "\0" "2" "\0" "-o" "\0" "16" "\0" "-n" "\0" "40" /*"\0" "-debug"*/;
+static const char hddArg[] = "-o" "\0" "8" "\0" "-n" "\0" "20";
+static const char pfsArg[] = "-m" "\0" "2" "\0" "-o" "\0" "32" "\0" "-n" "\0" "72"; // "\0" "-debug";
 
 IrxFile irxFiles[] = {
 	{ "SIO2MAN", BIOS, NOTHING, NULL, 0 },
@@ -209,6 +209,7 @@
 		}
 		curModule++;
 	}
+
 	*modules = resModules;
 	sioprintf("List of %d modules:", curModule - resModules);
 	for (int i = 0; i < curModule - resModules; i++)

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2input.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2input.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2input.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -31,6 +31,7 @@
 #include "backends/platform/ps2/ps2input.h"
 #include "backends/platform/ps2/ps2pad.h"
 #include "backends/platform/ps2/systemps2.h"
+#include "backends/platform/ps2/sdlkeys.h"
 #include "common/events.h"
 #include "common/system.h"
 
@@ -95,15 +96,15 @@
 #define PAD_CHECK_TIME 20
 
 int Ps2Input::mapKey(int key, int mod) { // copied from sdl backend
-	if (key >= Common::KEYCODE_F1 && key <= Common::KEYCODE_F9) {
-		return key - Common::KEYCODE_F1 + Common::ASCII_F1;
-	} else if (key >= Common::KEYCODE_KP0 && key <= Common::KEYCODE_KP9) {
-		return key - Common::KEYCODE_KP0 + '0';
-	} else if (key >= Common::KEYCODE_UP && key <= Common::KEYCODE_PAGEDOWN) {
+	if (key >= SDLK_F1 && key <= SDLK_F9) {
+		return key - SDLK_F1 + 315;
+	} else if (key >= SDLK_KP0 && key <= SDLK_KP9) {
+		return key - SDLK_KP0 + '0';
+	} else if (key >= SDLK_UP && key <= SDLK_PAGEDOWN) {
 		return key;
 	} else if (key >= 'a' && key <= 'z' && mod & Common::KBD_SHIFT) {
 		return key & ~0x20;
-	} else if (key >= Common::KEYCODE_NUMLOCK && key <= Common::KEYCODE_EURO) {
+	} else if (key >= SDLK_NUMLOCK && key <= SDLK_EURO) {
 		return 0;
 	}
 	return key;
@@ -141,17 +142,17 @@
 		PS2KbdRawKey key;
 		if (PS2KbdReadRaw(&key) == 1) {
 			if (_usbToSdlk[key.key]) {
-				if ((_usbToSdlk[key.key] == Common::KEYCODE_LSHIFT) || (_usbToSdlk[key.key] == Common::KEYCODE_RSHIFT)) {
+				if ((_usbToSdlk[key.key] == SDLK_LSHIFT) || (_usbToSdlk[key.key] == SDLK_RSHIFT)) {
 					if (key.state & 1)
 						_keyFlags |= Common::KBD_SHIFT;
 					else
 						_keyFlags &= ~Common::KBD_SHIFT;
-				} else if ((_usbToSdlk[key.key] == Common::KEYCODE_LCTRL) || (_usbToSdlk[key.key] == Common::KEYCODE_RCTRL)) {
+				} else if ((_usbToSdlk[key.key] == SDLK_LCTRL) || (_usbToSdlk[key.key] == SDLK_RCTRL)) {
 					if (key.state & 1)
 						_keyFlags |= Common::KBD_CTRL;
 					else
 						_keyFlags &= ~Common::KBD_CTRL;
-				} else if ((_usbToSdlk[key.key] == Common::KEYCODE_LALT) || (_usbToSdlk[key.key] == Common::KEYCODE_RALT)) {
+				} else if ((_usbToSdlk[key.key] == SDLK_LALT) || (_usbToSdlk[key.key] == SDLK_RALT)) {
 					if (key.state & 1)
 						_keyFlags |= Common::KBD_ALT;
 					else
@@ -162,7 +163,7 @@
 				else
 					event->type = Common::EVENT_KEYUP;
 				event->kbd.flags = 0;
-				event->kbd.keycode = _usbToSdlk[key.key];
+				event->kbd.keycode = (Common::KeyCode)_usbToSdlk[key.key];
 				event->kbd.ascii = mapKey(_usbToSdlk[key.key], _keyFlags);
 				return true;
 			} else
@@ -241,7 +242,7 @@
 		}
 		if (_padCodes[entry]) {
 			event->type = (down) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
-			event->kbd.keycode = _padCodes[entry];
+			event->kbd.keycode = (Common::KeyCode)_padCodes[entry];
 			event->kbd.flags = _padFlags[entry];
 			event->kbd.ascii = mapKey(_padCodes[entry], _padFlags[entry]);
 			return true;
@@ -255,106 +256,106 @@
 	/* 01 */	0,
 	/* 02 */	0,
 	/* 03 */	0,
-	/* 04 */	Common::KEYCODE_a,
-	/* 05 */	Common::KEYCODE_b,
-	/* 06 */	Common::KEYCODE_c,
-	/* 07 */	Common::KEYCODE_d,
-	/* 08 */	Common::KEYCODE_e,
-	/* 09 */	Common::KEYCODE_f,
-	/* 0A */	Common::KEYCODE_g,
-	/* 0B */	Common::KEYCODE_h,
-	/* 0C */	Common::KEYCODE_i,
-	/* 0D */	Common::KEYCODE_j,
-	/* 0E */	Common::KEYCODE_k,
-	/* 0F */	Common::KEYCODE_l,
-	/* 10 */	Common::KEYCODE_m,
-	/* 11 */	Common::KEYCODE_n,
-	/* 12 */	Common::KEYCODE_o,
-	/* 13 */	Common::KEYCODE_p,
-	/* 14 */	Common::KEYCODE_q,
-	/* 15 */	Common::KEYCODE_r,
-	/* 16 */	Common::KEYCODE_s,
-	/* 17 */	Common::KEYCODE_t,
-	/* 18 */	Common::KEYCODE_u,
-	/* 19 */	Common::KEYCODE_v,
-	/* 1A */	Common::KEYCODE_w,
-	/* 1B */	Common::KEYCODE_x,
-	/* 1C */	Common::KEYCODE_y,
-	/* 1D */	Common::KEYCODE_z,
-	/* 1E */	Common::KEYCODE_1,
-	/* 1F */	Common::KEYCODE_2,
-	/* 20 */	Common::KEYCODE_3,
-	/* 21 */	Common::KEYCODE_4,
-	/* 22 */	Common::KEYCODE_5,
-	/* 23 */	Common::KEYCODE_6,
-	/* 24 */	Common::KEYCODE_7,
-	/* 25 */	Common::KEYCODE_8,
-	/* 26 */	Common::KEYCODE_9,
-	/* 27 */	Common::KEYCODE_0,
-	/* 28 */	Common::KEYCODE_RETURN,
-	/* 29 */	Common::KEYCODE_ESCAPE,
-	/* 2A */	Common::KEYCODE_BACKSPACE,
-	/* 2B */	Common::KEYCODE_TAB,
-	/* 2C */	Common::KEYCODE_SPACE,
-	/* 2D */	Common::KEYCODE_MINUS,
-	/* 2E */	Common::KEYCODE_EQUALS,
-	/* 2F */	Common::KEYCODE_LEFTBRACKET,
-	/* 30 */	Common::KEYCODE_RIGHTBRACKET,
-	/* 31 */	Common::KEYCODE_BACKSLASH,
-	/* 32 */	Common::KEYCODE_HASH,
-	/* 33 */	Common::KEYCODE_SEMICOLON,
-	/* 34 */	Common::KEYCODE_QUOTE,
-	/* 35 */	Common::KEYCODE_BACKQUOTE,
-	/* 36 */	Common::KEYCODE_COMMA,
-	/* 37 */	Common::KEYCODE_PERIOD,
-	/* 38 */	Common::KEYCODE_SLASH,
-	/* 39 */	Common::KEYCODE_CAPSLOCK,
-	/* 3A */	Common::KEYCODE_F1,
-	/* 3B */	Common::KEYCODE_F2,
-	/* 3C */	Common::KEYCODE_F3,
-	/* 3D */	Common::KEYCODE_F4,
-	/* 3E */	Common::KEYCODE_F5,
-	/* 3F */	Common::KEYCODE_F6,
-	/* 40 */	Common::KEYCODE_F7,
-	/* 41 */	Common::KEYCODE_F8,
-	/* 42 */	Common::KEYCODE_F9,
-	/* 43 */	Common::KEYCODE_F10,
-	/* 44 */	Common::KEYCODE_F11,
-	/* 45 */	Common::KEYCODE_F12,
-	/* 46 */	Common::KEYCODE_PRINT,
-	/* 47 */	Common::KEYCODE_SCROLLOCK,
-	/* 48 */	Common::KEYCODE_PAUSE,
-	/* 49 */	Common::KEYCODE_INSERT,
-	/* 4A */	Common::KEYCODE_HOME,
-	/* 4B */	Common::KEYCODE_PAGEUP,
-	/* 4C */	Common::KEYCODE_DELETE,
-	/* 4D */	Common::KEYCODE_END,
-	/* 4E */	Common::KEYCODE_PAGEDOWN,
-	/* 4F */	Common::KEYCODE_RIGHT,
-	/* 50 */	Common::KEYCODE_LEFT,
-	/* 51 */	Common::KEYCODE_DOWN,
-	/* 52 */	Common::KEYCODE_UP,
-	/* 53 */	Common::KEYCODE_NUMLOCK,
-	/* 54 */	Common::KEYCODE_KP_DIVIDE,
-	/* 55 */	Common::KEYCODE_KP_MULTIPLY,
-	/* 56 */	Common::KEYCODE_KP_MINUS,
-	/* 57 */	Common::KEYCODE_KP_PLUS,
-	/* 58 */	Common::KEYCODE_KP_ENTER,
-	/* 59 */	Common::KEYCODE_KP1,
-	/* 5A */	Common::KEYCODE_KP2,
-	/* 5B */	Common::KEYCODE_KP3,
-	/* 5C */	Common::KEYCODE_KP4,
-	/* 5D */	Common::KEYCODE_KP5,
-	/* 5E */	Common::KEYCODE_KP6,
-	/* 5F */	Common::KEYCODE_KP7,
-	/* 60 */	Common::KEYCODE_KP8,
-	/* 61 */	Common::KEYCODE_KP9,
-	/* 62 */	Common::KEYCODE_KP0,
-	/* 63 */	Common::KEYCODE_KP_PERIOD,
+	/* 04 */	SDLK_a,
+	/* 05 */	SDLK_b,
+	/* 06 */	SDLK_c,
+	/* 07 */	SDLK_d,
+	/* 08 */	SDLK_e,
+	/* 09 */	SDLK_f,
+	/* 0A */	SDLK_g,
+	/* 0B */	SDLK_h,
+	/* 0C */	SDLK_i,
+	/* 0D */	SDLK_j,
+	/* 0E */	SDLK_k,
+	/* 0F */	SDLK_l,
+	/* 10 */	SDLK_m,
+	/* 11 */	SDLK_n,
+	/* 12 */	SDLK_o,
+	/* 13 */	SDLK_p,
+	/* 14 */	SDLK_q,
+	/* 15 */	SDLK_r,
+	/* 16 */	SDLK_s,
+	/* 17 */	SDLK_t,
+	/* 18 */	SDLK_u,
+	/* 19 */	SDLK_v,
+	/* 1A */	SDLK_w,
+	/* 1B */	SDLK_x,
+	/* 1C */	SDLK_y,
+	/* 1D */	SDLK_z,
+	/* 1E */	SDLK_1,
+	/* 1F */	SDLK_2,
+	/* 20 */	SDLK_3,
+	/* 21 */	SDLK_4,
+	/* 22 */	SDLK_5,
+	/* 23 */	SDLK_6,
+	/* 24 */	SDLK_7,
+	/* 25 */	SDLK_8,
+	/* 26 */	SDLK_9,
+	/* 27 */	SDLK_0,
+	/* 28 */	SDLK_RETURN,
+	/* 29 */	SDLK_ESCAPE,
+	/* 2A */	SDLK_BACKSPACE,
+	/* 2B */	SDLK_TAB,
+	/* 2C */	SDLK_SPACE,
+	/* 2D */	SDLK_MINUS,
+	/* 2E */	SDLK_EQUALS,
+	/* 2F */	SDLK_LEFTBRACKET,
+	/* 30 */	SDLK_RIGHTBRACKET,
+	/* 31 */	SDLK_BACKSLASH,
+	/* 32 */	SDLK_HASH,
+	/* 33 */	SDLK_SEMICOLON,
+	/* 34 */	SDLK_QUOTE,
+	/* 35 */	SDLK_BACKQUOTE,
+	/* 36 */	SDLK_COMMA,
+	/* 37 */	SDLK_PERIOD,
+	/* 38 */	SDLK_SLASH,
+	/* 39 */	SDLK_CAPSLOCK,
+	/* 3A */	SDLK_F1,
+	/* 3B */	SDLK_F2,
+	/* 3C */	SDLK_F3,
+	/* 3D */	SDLK_F4,
+	/* 3E */	SDLK_F5,
+	/* 3F */	SDLK_F6,
+	/* 40 */	SDLK_F7,
+	/* 41 */	SDLK_F8,
+	/* 42 */	SDLK_F9,
+	/* 43 */	SDLK_F10,
+	/* 44 */	SDLK_F11,
+	/* 45 */	SDLK_F12,
+	/* 46 */	SDLK_PRINT,
+	/* 47 */	SDLK_SCROLLOCK,
+	/* 48 */	SDLK_PAUSE,
+	/* 49 */	SDLK_INSERT,
+	/* 4A */	SDLK_HOME,
+	/* 4B */	SDLK_PAGEUP,
+	/* 4C */	SDLK_DELETE,
+	/* 4D */	SDLK_END,
+	/* 4E */	SDLK_PAGEDOWN,
+	/* 4F */	SDLK_RIGHT,
+	/* 50 */	SDLK_LEFT,
+	/* 51 */	SDLK_DOWN,
+	/* 52 */	SDLK_UP,
+	/* 53 */	SDLK_NUMLOCK,
+	/* 54 */	SDLK_KP_DIVIDE,
+	/* 55 */	SDLK_KP_MULTIPLY,
+	/* 56 */	SDLK_KP_MINUS,
+	/* 57 */	SDLK_KP_PLUS,
+	/* 58 */	SDLK_KP_ENTER,
+	/* 59 */	SDLK_KP1,
+	/* 5A */	SDLK_KP2,
+	/* 5B */	SDLK_KP3,
+	/* 5C */	SDLK_KP4,
+	/* 5D */	SDLK_KP5,
+	/* 5E */	SDLK_KP6,
+	/* 5F */	SDLK_KP7,
+	/* 60 */	SDLK_KP8,
+	/* 61 */	SDLK_KP9,
+	/* 62 */	SDLK_KP0,
+	/* 63 */	SDLK_KP_PERIOD,
 	/* 64 */	0,
 	/* 65 */	0,
 	/* 66 */	0,
-	/* 67 */	Common::KEYCODE_KP_EQUALS,
+	/* 67 */	SDLK_KP_EQUALS,
 	/* 68 */	0,
 	/* 69 */	0,
 	/* 6A */	0,
@@ -475,13 +476,13 @@
 	/* DD */	0,
 	/* DE */	0,
 	/* DF */	0,
-	/* E0 */    Common::KEYCODE_LCTRL,
-	/* E1 */	Common::KEYCODE_LSHIFT,
-	/* E2 */	Common::KEYCODE_LALT,
+	/* E0 */    SDLK_LCTRL,
+	/* E1 */	SDLK_LSHIFT,
+	/* E2 */	SDLK_LALT,
 	/* E3 */	0,
-	/* E4 */    Common::KEYCODE_RCTRL,
-	/* E5 */	Common::KEYCODE_RSHIFT,
-	/* E6 */	Common::KEYCODE_RALT,
+	/* E4 */    SDLK_RCTRL,
+	/* E5 */	SDLK_RSHIFT,
+	/* E6 */	SDLK_RALT,
 	/* E7 */	0,
 	/* E8 */	0,
 	/* E9 */	0,
@@ -510,22 +511,22 @@
 };
 
 const int Ps2Input::_padCodes[16] = {
-	Common::KEYCODE_1,		 // Select
+	SDLK_1,		 // Select
 	0,			 // L3
 	0,			 // R3
-	Common::KEYCODE_F5,	 // Start
+	SDLK_F5,	 // Start
 	0,			 //	Up
 	0,			 //	Right
 	0,			 //	Down
 	0,			 //	Left
-	Common::KEYCODE_KP0,	 //	L2
+	SDLK_KP0,	 //	L2
 	0,			 //	R2
-	Common::KEYCODE_n,		 //	L1
-	Common::KEYCODE_y,		 //	R1
-	Common::KEYCODE_ESCAPE, // Triangle
+	SDLK_n,		 //	L1
+	SDLK_y,		 //	R1
+	SDLK_ESCAPE, // Triangle
 	0,			 //	Circle  => Right mouse button
 	0,			 //	Cross	=> Left mouse button
-	Common::KEYCODE_RETURN	 //	Square
+	SDLK_RETURN	 //	Square
 };
 
 const int Ps2Input::_padFlags[16] = {

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2mutex.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2mutex.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2mutex.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -25,6 +25,17 @@
 
 #include "backends/platform/ps2/systemps2.h"
 
+void OSystem_PS2::initMutexes(void) {
+	ee_sema_t newSema;
+	newSema.init_count = 1;
+	newSema.max_count = 1;
+	_mutexSema = CreateSema(&newSema);
+	for (int i = 0; i < MAX_MUTEXES; i++) {
+		_mutex[i].sema = -1;
+		_mutex[i].count = _mutex[i].owner = 0;
+	}
+}
+
 OSystem::MutexRef OSystem_PS2::createMutex(void) {
 	WaitSema(_mutexSema);
 	Ps2Mutex *mutex = NULL;
@@ -49,6 +60,7 @@
 	WaitSema(_mutexSema);
 	Ps2Mutex *sysMutex = (Ps2Mutex*)mutex;
 	int tid = GetThreadId();
+
 	assert(tid != 0);
 	if (sysMutex->owner && (sysMutex->owner == tid))
 		sysMutex->count++;
@@ -66,6 +78,7 @@
 	WaitSema(_mutexSema);
 	Ps2Mutex *sysMutex = (Ps2Mutex*)mutex;
 	int tid = GetThreadId();
+
 	if (sysMutex->owner && sysMutex->count && (sysMutex->owner == tid))
 		sysMutex->count--;
 	else {

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2time.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2time.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/ps2time.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -26,6 +26,8 @@
 #include "backends/platform/ps2/systemps2.h"
 #include "eecodyvdfs.h"
 #include <osd_config.h>
+#include <time.h>
+
 #define FROM_BCD(a) ((a >> 4) * 10 + (a & 0xF))
 
 static int	  g_timeSecs;
@@ -104,15 +106,10 @@
 }
 
 extern "C" time_t time(time_t *p) {
-	if (p) *p = (time_t)g_timeSecs;
 	return (time_t)g_timeSecs;
 }
 
 extern "C" struct tm *localtime(const time_t *p) {
-	// FIXME: This function should actually use the value in *p!
-	// But the work needed for that is not necessary -- just implement
-	// OSystem::getTimeAndDate using the code provided here, and
-	// ditch the custom time & localtime methods.
 	uint32 currentSecs = g_timeSecs + (msecCount - g_lastTimeCheck) / 1000;
 	if (currentSecs >= SECONDS_PER_DAY) {
 		buildNewDate(+1);

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.c
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.c	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.c	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,178 @@
+/*
+# _____     ___ ____     ___ ____
+#  ____|   |    ____|   |        | |____|
+# |     ___|   |____ ___|    ____| |    \    PS2DEV Open Source Project.
+#-----------------------------------------------------------------------
+# Copyright 2005, ps2dev - http://www.ps2dev.org
+# Licenced under Academic Free License version 2.0
+# Review ps2sdk README & LICENSE files for further details.
+#
+# $Id$
+# USB Keyboard Driver for PS2 using RPC instead of FIO
+*/
+
+#include <tamtypes.h>
+#include <kernel.h>
+#include <sifrpc.h>
+#include <string.h>
+#include "backends/platform/ps2/rpckbd.h"
+
+static int curr_readmode = PS2KBD_READMODE_NORMAL;
+static int kbdRpcSema = -1;
+static int kbdInitialized = 0;
+
+static SifRpcClientData_t cd0;
+static unsigned char rpcBuf[3 * PS2KBD_KEYMAP_SIZE] __attribute__((aligned (16)));
+static unsigned int  rpcKey __attribute__((aligned (16)));
+
+int PS2KbdInit(void)
+/* Initialise the keyboard library */
+{
+	int res;
+	ee_sema_t kbdSema;
+
+	while ((res = SifBindRpc(&cd0, PS2KBD_RPC_ID, 0)) < 0)
+		nopdelay();
+
+	memset(rpcBuf, 0, 3 * PS2KBD_KEYMAP_SIZE);
+	rpcKey = 0;
+
+	kbdSema.init_count = 1;
+	kbdSema.max_count = 1;
+
+	kbdRpcSema = CreateSema(&kbdSema);
+	if (kbdRpcSema >= 0) {
+		kbdInitialized = 1;
+		return 0;
+	} else
+		return -1;
+}
+
+static void rpcCompleteIntr(void *param) {
+    iSignalSema(kbdRpcSema);
+}
+
+int PS2KbdRead(char *key)
+/* Reads 1 character from the keyboard */
+{
+	int res;
+	if ((!kbdInitialized) || (curr_readmode != PS2KBD_READMODE_NORMAL))
+		return -1;
+	
+	if (PollSema(kbdRpcSema) >= 0) {
+		// last rpc call completed
+		res = (rpcKey != 0);
+		*key = *(char *)UNCACHED_SEG(&rpcKey);
+		SifCallRpc(&cd0, KBD_RPC_READKEY, SIF_RPC_M_NOWAIT, rpcBuf, 0, &rpcKey, 4, rpcCompleteIntr, NULL);
+		return res;
+	} else // rpc still running
+		return 0;
+}
+
+int PS2KbdReadRaw(PS2KbdRawKey *key)
+/* Reads 1 raw character from the keyboard */
+{
+	int res;
+	if ((!kbdInitialized) || (curr_readmode != PS2KBD_READMODE_RAW))
+		return -1;
+
+	if (PollSema(kbdRpcSema) >= 0) {
+		// last rpc call completed
+		res = (rpcKey != 0);
+		*key = *(PS2KbdRawKey *)UNCACHED_SEG(&rpcKey);
+		SifCallRpc(&cd0, KBD_RPC_READRAW, SIF_RPC_M_NOWAIT, rpcBuf, 0, &rpcKey, 4, rpcCompleteIntr, NULL);
+		return res;
+	} else // rpc still running
+		return 0;
+}
+
+int PS2KbdSetReadmode(u32 readmode)
+/* Sets the read mode to normal or raw */
+{
+	if (kbdInitialized) {
+		if (curr_readmode == readmode)
+			return 0;
+		WaitSema(kbdRpcSema);
+		*(unsigned int *)rpcBuf = curr_readmode = readmode;
+		return SifCallRpc(&cd0, KBD_RPC_SETREADMODE, SIF_RPC_M_NOWAIT, rpcBuf, 4, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+
+int PS2KbdSetLeds(u8 leds)
+/* Sets all connected keyboards leds */
+{
+	if (kbdInitialized) {
+		WaitSema(kbdRpcSema);
+		*(unsigned char *)rpcBuf = leds;
+		return SifCallRpc(&cd0, KBD_RPC_SETLEDS, SIF_RPC_M_NOWAIT, rpcBuf, 4, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+
+int PS2KbdSetKeymap(PS2KbdKeyMap *keymaps)
+/* Sets the current keymap */
+{
+	if (kbdInitialized) {
+		WaitSema(kbdRpcSema);
+		memcpy(rpcBuf + 0 * PS2KBD_KEYMAP_SIZE, keymaps->keymap,      PS2KBD_KEYMAP_SIZE);
+		memcpy(rpcBuf + 1 * PS2KBD_KEYMAP_SIZE, keymaps->shiftkeymap, PS2KBD_KEYMAP_SIZE);
+		memcpy(rpcBuf + 2 * PS2KBD_KEYMAP_SIZE, keymaps->keycap,      PS2KBD_KEYMAP_SIZE);
+		return SifCallRpc(&cd0, KBD_RPC_SETKEYMAP, SIF_RPC_M_NOWAIT, rpcBuf, 3 * PS2KBD_KEYMAP_SIZE, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+
+int PS2KbdSetCtrlmap(u8 *ctrlmap)
+/* Sets the control key mappings */
+{
+	if (kbdInitialized) {
+		WaitSema(kbdRpcSema);
+		memcpy(rpcBuf, ctrlmap, PS2KBD_KEYMAP_SIZE);
+		return SifCallRpc(&cd0, KBD_RPC_SETCTRLMAP, SIF_RPC_M_NOWAIT, rpcBuf, PS2KBD_KEYMAP_SIZE, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+
+int PS2KbdSetAltmap(u8 *altmap)
+/* Sets the alt key mappings */
+{
+	if (kbdInitialized) {
+		WaitSema(kbdRpcSema);
+		memcpy(rpcBuf, altmap, PS2KBD_KEYMAP_SIZE);
+		return SifCallRpc(&cd0, KBD_RPC_SETALTMAP, SIF_RPC_M_NOWAIT, rpcBuf, PS2KBD_KEYMAP_SIZE, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+
+int PS2KbdSetSpecialmap(u8 *special)
+/* Sets the special key mappings */
+{
+	if (kbdInitialized) {
+		WaitSema(kbdRpcSema);
+		memcpy(rpcBuf, special, PS2KBD_KEYMAP_SIZE);
+		return SifCallRpc(&cd0, KBD_RPC_SETSPECIALMAP, SIF_RPC_M_NOWAIT, rpcBuf, PS2KBD_KEYMAP_SIZE, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+
+int PS2KbdFlushBuffer(void)
+/* Flushes the keyboard buffer */
+{
+	if (kbdInitialized) {
+		WaitSema(kbdRpcSema);
+		return SifCallRpc(&cd0, KBD_RPC_FLUSHBUFFER, SIF_RPC_M_NOWAIT, rpcBuf, 0, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+
+int PS2KbdResetKeymap(void)
+/* Resets the keymap to the default US mapping */
+{
+	if (kbdInitialized) {
+		WaitSema(kbdRpcSema);
+		return SifCallRpc(&cd0, KBD_RPC_RESETKEYMAP, SIF_RPC_M_NOWAIT, rpcBuf, 0, rpcBuf, 0, rpcCompleteIntr, NULL);
+	} else
+		return -1;
+}
+


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.c
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.h	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,28 @@
+#ifndef __RPCKBD_H__
+#define __RPCKBD_H__
+
+#include "backends/platform/ps2/iop/rpckbd/include/ps2kbd.h"
+
+typedef kbd_rawkey PS2KbdRawKey;
+typedef kbd_keymap PS2KbdKeyMap;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+	int PS2KbdInit(void);
+	int PS2KbdRead(char *key);
+	int PS2KbdReadRaw(PS2KbdRawKey *key);
+	int PS2KbdSetReadmode(u32 readmode);
+	int PS2KbdSetLeds(u8 leds);
+	int PS2KbdSetKeymap(PS2KbdKeyMap *keymaps);
+	int PS2KbdSetCtrlmap(u8 *ctrlmap);
+	int PS2KbdSetAltmap(u8 *altmap);
+	int PS2KbdSetSpecialmap(u8 *special);
+	int PS2KbdFlushBuffer(void);
+	int PS2KbdResetKeymap(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+


Property changes on: scummvm/branches/branch-0-11-0/backends/platform/ps2/rpckbd.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.cpp
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.cpp	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.cpp	2008-02-23 21:27:17 UTC (rev 30943)
@@ -34,6 +34,8 @@
 #include "backends/platform/ps2/savefile.h"
 #include "backends/platform/ps2/Gs2dScreen.h"
 #include "backends/platform/ps2/systemps2.h"
+#include "backends/fs/abstract-fs.h"
+
 #include "common/scummsys.h"
 
 extern void *_gp;
@@ -484,6 +486,90 @@
 	_screen->wantAnim(false);
 }
 
+Common::StringList Ps2SaveFileManager::listSavefiles(const char *regex) {
+	_screen->wantAnim(true);
+	Common::StringList results;
+	int mcType, mcFree, mcFormat, mcResult;
+
+	printf("listSavefiles -> regex=%s\n", regex);
+
+	mcResult = _mc->getInfo(&mcType, &mcFree, &mcFormat);
+
+	if ((mcResult == 0) || (mcResult == -1)) {
+		// there's a memory card in the slot.
+		if (mcResult == -1)
+			_mcNeedsUpdate = true;
+
+		mcTable *mcEntries = (mcTable*)memalign(64, sizeof(mcTable) * MAX_MC_ENTRIES);
+    
+		char temp[256], mcSearchStr[256], *dir, *ext;
+		strcpy(temp, regex);
+		dir = strdup(strtok(temp, "."));
+		ext = strdup(strtok(NULL, "*"));
+
+		printf("dir = %s - ext = %s\n", dir, ext);
+/*
+		strcpy(dirStr, refix);
+		char *pos = strchr(dirStr, '.');
+		if (pos) {
+			strcpy(ext, pos + 1);
+			*pos = '\0';
+		} else
+			ext[0] = '\0';
+*/
+		sprintf(mcSearchStr, "/ScummVM-%s/%s*", dir, ext);
+
+		int numEntries = _mc->getDir(mcSearchStr, 0, MAX_MC_ENTRIES, mcEntries);
+		char *name;
+#if 1
+        for (int i = 0; i < numEntries; i++) {
+			name = (char*)mcEntries[i].name;
+
+            if ((name[0] != '.') && stricmp(name, "icon.sys")) {
+				printf(" name = %s\n", (char*)mcEntries[i].name);
+				if (Common::matchString(name, "s*.ucl")) {
+					sprintf(temp, "%s.%s%c%c", dir, ext, name[1], name[2]);
+					results.push_back(temp);
+					printf("  -> match [%s] ;-)\n", temp);
+				}
+				else {
+					results.push_back(name); // ;-)
+					printf("  -> no match :-(\n");
+				}
+			}
+		}
+#else
+		results.push_back("dig.s00");
+		results.push_back("dig.s01");
+		results.push_back("dig.s03");
+#endif
+		free(mcEntries);
+		free(dir);
+		free(ext);
+    }
+
+    _screen->wantAnim(false);
+
+	return results;
+}
+
+bool Ps2SaveFileManager::removeSavefile(const char *filename) {
+/*
+	char buf[256];
+	sprintf(buf, "%s/%s", getSavePath(), filename);
+*/
+	int res = _mc->remove(filename);
+
+	if (res == 0)
+		return true;
+
+	return false;
+}
+
+const char *Ps2SaveFileManager::getSavePath(void) const {
+	return "mc0:";
+}
+
 bool Ps2SaveFileManager::setupIcon(const char *dest, const char *ico, const char *descr1, const char *descr2) {
 	mcIcon icon_sys;
 	memset(&icon_sys, 0, sizeof(mcIcon));

Modified: scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.h	2008-02-23 21:25:40 UTC (rev 30942)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/savefile.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -42,10 +42,15 @@
 	virtual Common::OutSaveFile *openForSaving(const char *filename);
 	virtual void listSavefiles(const char *prefix, bool *marks, int num);
 
+	virtual Common::StringList listSavefiles(const char *regex);
+	virtual bool removeSavefile(const char *filename);
+
+	/** Get the path to the save game directory. */
+	virtual const char *getSavePath() const;
+
 	void writeSaveNonblocking(char *name, void *buf, uint32 size);
 	void saveThread(void);
 	void quit(void);
-	
 private:
 	bool setupIcon(const char *dest, const char *ico, const char *descr1, const char *descr2);
 

Added: scummvm/branches/branch-0-11-0/backends/platform/ps2/sdlkeys.h
===================================================================
--- scummvm/branches/branch-0-11-0/backends/platform/ps2/sdlkeys.h	                        (rev 0)
+++ scummvm/branches/branch-0-11-0/backends/platform/ps2/sdlkeys.h	2008-02-23 21:27:17 UTC (rev 30943)
@@ -0,0 +1,264 @@
+/* copied from SDK_keysym.h */
+
+#ifndef __SDLKEYS_H__
+#define __SDLKEYS_H__
+
+enum SdlKeyCodes {
+	SDLK_UNKNOWN		= 0,
+	SDLK_FIRST		= 0,
+	SDLK_BACKSPACE		= 8,
+	SDLK_TAB		= 9,
+	SDLK_CLEAR		= 12,
+	SDLK_RETURN		= 13,
+	SDLK_PAUSE		= 19,
+	SDLK_ESCAPE		= 27,
+	SDLK_SPACE		= 32,
+	SDLK_EXCLAIM		= 33,
+	SDLK_QUOTEDBL		= 34,
+	SDLK_HASH		= 35,
+	SDLK_DOLLAR		= 36,
+	SDLK_AMPERSAND		= 38,
+	SDLK_QUOTE		= 39,
+	SDLK_LEFTPAREN		= 40,
+	SDLK_RIGHTPAREN		= 41,
+	SDLK_ASTERISK		= 42,
+	SDLK_PLUS		= 43,
+	SDLK_COMMA		= 44,
+	SDLK_MINUS		= 45,
+	SDLK_PERIOD		= 46,
+	SDLK_SLASH		= 47,
+	SDLK_0			= 48,
+	SDLK_1			= 49,
+	SDLK_2			= 50,
+	SDLK_3			= 51,
+	SDLK_4			= 52,
+	SDLK_5			= 53,
+	SDLK_6			= 54,
+	SDLK_7			= 55,
+	SDLK_8			= 56,
+	SDLK_9			= 57,
+	SDLK_COLON		= 58,
+	SDLK_SEMICOLON		= 59,
+	SDLK_LESS		= 60,
+	SDLK_EQUALS		= 61,
+	SDLK_GREATER		= 62,
+	SDLK_QUESTION		= 63,
+	SDLK_AT			= 64,
+	/*
+	   Skip uppercase letters
+	 */
+	SDLK_LEFTBRACKET	= 91,
+	SDLK_BACKSLASH		= 92,
+	SDLK_RIGHTBRACKET	= 93,
+	SDLK_CARET		= 94,
+	SDLK_UNDERSCORE		= 95,
+	SDLK_BACKQUOTE		= 96,
+	SDLK_a			= 97,
+	SDLK_b			= 98,
+	SDLK_c			= 99,
+	SDLK_d			= 100,
+	SDLK_e			= 101,
+	SDLK_f			= 102,
+	SDLK_g			= 103,
+	SDLK_h			= 104,
+	SDLK_i			= 105,
+	SDLK_j			= 106,
+	SDLK_k			= 107,
+	SDLK_l			= 108,
+	SDLK_m			= 109,
+	SDLK_n			= 110,
+	SDLK_o			= 111,
+	SDLK_p			= 112,
+	SDLK_q			= 113,
+	SDLK_r			= 114,
+	SDLK_s			= 115,
+	SDLK_t			= 116,
+	SDLK_u			= 117,
+	SDLK_v			= 118,
+	SDLK_w			= 119,
+	SDLK_x			= 120,
+	SDLK_y			= 121,
+	SDLK_z			= 122,
+	SDLK_DELETE		= 127,
+	/* End of ASCII mapped keysyms */
+
+	/* International keyboard syms */
+	SDLK_WORLD_0		= 160,		/* 0xA0 */
+	SDLK_WORLD_1		= 161,
+	SDLK_WORLD_2		= 162,
+	SDLK_WORLD_3		= 163,
+	SDLK_WORLD_4		= 164,
+	SDLK_WORLD_5		= 165,
+	SDLK_WORLD_6		= 166,
+	SDLK_WORLD_7		= 167,
+	SDLK_WORLD_8		= 168,
+	SDLK_WORLD_9		= 169,
+	SDLK_WORLD_10		= 170,
+	SDLK_WORLD_11		= 171,
+	SDLK_WORLD_12		= 172,
+	SDLK_WORLD_13		= 173,
+	SDLK_WORLD_14		= 174,
+	SDLK_WORLD_15		= 175,
+	SDLK_WORLD_16		= 176,
+	SDLK_WORLD_17		= 177,
+	SDLK_WORLD_18		= 178,
+	SDLK_WORLD_19		= 179,
+	SDLK_WORLD_20		= 180,
+	SDLK_WORLD_21		= 181,

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list