[Scummvm-cvs-logs] SF.net SVN: scummvm:[33185] scummvm/branches/gsoc2008-vkeybd
kenny-d at users.sourceforge.net
kenny-d at users.sourceforge.net
Tue Jul 22 02:15:19 CEST 2008
Revision: 33185
http://scummvm.svn.sourceforge.net/scummvm/?rev=33185&view=rev
Author: kenny-d
Date: 2008-07-22 00:15:13 +0000 (Tue, 22 Jul 2008)
Log Message:
-----------
Merged revisions 32879,32883,32895,32899,32902-32904,32910-32912,32923-32924,32930-32931,32938,32940,32948-32949,32951,32960-32964,32966-32970,32972-32974,32976,32978,32983,32986-32990,32992,32994,33002-33004,33006-33007,33009-33010,33014,33017,33021-33023,33030,33033,33052-33053,33056-33058,33061-33064,33068,33070,33072,33075,33078-33079,33083,33086-33087,33089,33094-33096,33098-33099,33104,33108-33109,33114-33117,33120,33135-33146,33160,33162,33165,33167-33169 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
Modified Paths:
--------------
scummvm/branches/gsoc2008-vkeybd/Makefile
scummvm/branches/gsoc2008-vkeybd/NEWS
scummvm/branches/gsoc2008-vkeybd/backends/midi/quicktime.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/dc/Makefile
scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/wordcompletion.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/Makefile.ps2
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/fileio.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/irxboot.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/systemps2.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/systemps2.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/psp/Makefile
scummvm/branches/gsoc2008-vkeybd/backends/platform/psp/osys_psp.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/psp/osys_psp.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/sdl/sdl.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/sdl/sdl.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/symbian/BuildPackageUpload_LocalSettings.pl
scummvm/branches/gsoc2008-vkeybd/backends/platform/symbian/src/SymbianOS.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/wii/osystem.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/wii/osystem.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/wii/osystem_sfx.cpp
scummvm/branches/gsoc2008-vkeybd/backends/platform/wince/missing/missing.cpp
scummvm/branches/gsoc2008-vkeybd/backends/saves/default/default-saves.cpp
scummvm/branches/gsoc2008-vkeybd/base/game.cpp
scummvm/branches/gsoc2008-vkeybd/base/game.h
scummvm/branches/gsoc2008-vkeybd/base/internal_version.h
scummvm/branches/gsoc2008-vkeybd/base/plugins.h
scummvm/branches/gsoc2008-vkeybd/common/config-manager.cpp
scummvm/branches/gsoc2008-vkeybd/common/file.cpp
scummvm/branches/gsoc2008-vkeybd/common/str.cpp
scummvm/branches/gsoc2008-vkeybd/common/str.h
scummvm/branches/gsoc2008-vkeybd/common/stream.cpp
scummvm/branches/gsoc2008-vkeybd/common/stream.h
scummvm/branches/gsoc2008-vkeybd/configure
scummvm/branches/gsoc2008-vkeybd/dists/msvc7/parallaction.vcproj
scummvm/branches/gsoc2008-vkeybd/dists/msvc71/parallaction.vcproj
scummvm/branches/gsoc2008-vkeybd/dists/msvc8/parallaction.vcproj
scummvm/branches/gsoc2008-vkeybd/dists/msvc9/parallaction.vcproj
scummvm/branches/gsoc2008-vkeybd/dists/redhat/scummvm.spec
scummvm/branches/gsoc2008-vkeybd/dists/scummvm.rc
scummvm/branches/gsoc2008-vkeybd/dists/slackware/scummvm.SlackBuild
scummvm/branches/gsoc2008-vkeybd/engines/agos/agos.h
scummvm/branches/gsoc2008-vkeybd/engines/agos/gfx.cpp
scummvm/branches/gsoc2008-vkeybd/engines/cine/cine.h
scummvm/branches/gsoc2008-vkeybd/engines/cine/gfx.cpp
scummvm/branches/gsoc2008-vkeybd/engines/cine/prc.cpp
scummvm/branches/gsoc2008-vkeybd/engines/cine/prc.h
scummvm/branches/gsoc2008-vkeybd/engines/cine/script_fw.cpp
scummvm/branches/gsoc2008-vkeybd/engines/cine/texte.cpp
scummvm/branches/gsoc2008-vkeybd/engines/cine/texte.h
scummvm/branches/gsoc2008-vkeybd/engines/cine/various.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/detection.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/driver_vga.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/goblin.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/goblin.h
scummvm/branches/gsoc2008-vkeybd/engines/gob/goblin_v2.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/inter.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/inter.h
scummvm/branches/gsoc2008-vkeybd/engines/gob/inter_v1.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/inter_v2.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/mult.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/mult.h
scummvm/branches/gsoc2008-vkeybd/engines/gob/mult_v1.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/mult_v2.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/sound/sound.h
scummvm/branches/gsoc2008-vkeybd/engines/gob/sound/soundmixer.h
scummvm/branches/gsoc2008-vkeybd/engines/gob/variables.cpp
scummvm/branches/gsoc2008-vkeybd/engines/gob/variables.h
scummvm/branches/gsoc2008-vkeybd/engines/igor/igor.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/detection.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/kyra_mr.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/kyra_mr.h
scummvm/branches/gsoc2008-vkeybd/engines/kyra/kyra_v1.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/script.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/script.h
scummvm/branches/gsoc2008-vkeybd/engines/kyra/script_tim.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/script_tim.h
scummvm/branches/gsoc2008-vkeybd/engines/kyra/sequences_lok.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/sound.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/sound_lok.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/sound_towns.cpp
scummvm/branches/gsoc2008-vkeybd/engines/kyra/staticres.cpp
scummvm/branches/gsoc2008-vkeybd/engines/lure/luredefs.h
scummvm/branches/gsoc2008-vkeybd/engines/lure/res_struct.cpp
scummvm/branches/gsoc2008-vkeybd/engines/m4/converse.cpp
scummvm/branches/gsoc2008-vkeybd/engines/m4/globals.cpp
scummvm/branches/gsoc2008-vkeybd/engines/m4/globals.h
scummvm/branches/gsoc2008-vkeybd/engines/m4/resource.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/callables_ns.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/dialogue.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/disk.h
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/disk_br.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/disk_ns.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/exec_br.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/exec_ns.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/gfxbase.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/graphics.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/graphics.h
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/gui_br.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/input.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/input.h
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/module.mk
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/objects.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/parallaction.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/parallaction.h
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/parallaction_br.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/parallaction_ns.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/parser_br.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/parser_ns.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/sound.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/walk.cpp
scummvm/branches/gsoc2008-vkeybd/engines/queen/graphics.cpp
scummvm/branches/gsoc2008-vkeybd/engines/queen/graphics.h
scummvm/branches/gsoc2008-vkeybd/engines/queen/sound.cpp
scummvm/branches/gsoc2008-vkeybd/engines/queen/sound.h
scummvm/branches/gsoc2008-vkeybd/engines/scumm/detection.cpp
scummvm/branches/gsoc2008-vkeybd/engines/scumm/dialogs.cpp
scummvm/branches/gsoc2008-vkeybd/engines/scumm/dialogs.h
scummvm/branches/gsoc2008-vkeybd/engines/scumm/he/resource_he.cpp
scummvm/branches/gsoc2008-vkeybd/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
scummvm/branches/gsoc2008-vkeybd/engines/scumm/imuse_digi/dimuse_track.h
scummvm/branches/gsoc2008-vkeybd/engines/scumm/saveload.cpp
scummvm/branches/gsoc2008-vkeybd/engines/sword2/music.cpp
scummvm/branches/gsoc2008-vkeybd/engines/sword2/sound.h
scummvm/branches/gsoc2008-vkeybd/sound/midiparser_smf.cpp
scummvm/branches/gsoc2008-vkeybd/sound/midiparser_xmidi.cpp
scummvm/branches/gsoc2008-vkeybd/test/common/str.h
Added Paths:
-----------
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/elf/
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/Makefile
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/imports.lst
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/balloons.cpp
scummvm/branches/gsoc2008-vkeybd/engines/parallaction/exec.h
scummvm/branches/gsoc2008-vkeybd/tools/svnpropset.sh
Removed Paths:
-------------
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/Makefile
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/imports.lst
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
Property Changed:
----------------
scummvm/branches/gsoc2008-vkeybd/
scummvm/branches/gsoc2008-vkeybd/backends/platform/dc/
Property changes on: scummvm/branches/gsoc2008-vkeybd
___________________________________________________________________
Modified: svnmerge-integrated
- /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-rtl:1-32741 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-32874
+ /scummvm/branches/gsoc2008-gui:1-31703 /scummvm/branches/gsoc2008-rtl:1-32741 /scummvm/branches/gsoc2008-tfmx:1-31765 /scummvm/trunk:1-33184
Added: svn:mergeinfo
+ /scummvm/trunk:32879-33169
Modified: scummvm/branches/gsoc2008-vkeybd/Makefile
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/Makefile 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/Makefile 2008-07-22 00:15:13 UTC (rev 33185)
@@ -25,7 +25,7 @@
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
# Enable even more warnings...
CXXFLAGS+= -pedantic -Wpointer-arith -Wcast-qual -Wcast-align
-CXXFLAGS+= -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wwrite-strings
+CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings
# Disable RTTI and exceptions, and enabled checking of pointers returned by "new"
CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new
Modified: scummvm/branches/gsoc2008-vkeybd/NEWS
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/NEWS 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/NEWS 2008-07-22 00:15:13 UTC (rev 33185)
@@ -3,19 +3,23 @@
0.12.0 (????-??-??)
New Games:
- - Added support for The Legend of Kyrandia: Book Two: Hand of Fate
- - Added support for The Legend of Kyrandia: Book Three: Malcolm's Revenge
- - Added support for Lost in Time
- - Added support for The Bizarre Adventures of Woodruff and the Schnibble
- - Added support for the PC version of Waxworks
+ - Added support for The Legend of Kyrandia: Book Two: Hand of Fate.
+ - Added support for The Legend of Kyrandia: Book Three: Malcolm's Revenge.
+ - Added support for Lost in Time.
+ - Added support for The Bizarre Adventures of Woodruff and the Schnibble.
+ - Added support for the PC version of Waxworks.
- Added support for the Macintosh version of I Have no Mouth, and I
- must Scream
- - Added support for Drascula: The Vampire Strikes Back
+ must Scream.
+ - Added support for Drascula: The Vampire Strikes Back.
General:
- Added CAMD MIDI driver for AmigaOS4.
- Revived the PS2 port (was already in 0.11.1 but was forgotten in the
release notes).
+ - Plugged numerous memory leaks in all engines (part of GSoC'08 task),
+ - Added audio double buffering to the SDL backend, which fixes the
+ problems with the MT-32 emulator on Mac OS X (for now only enabled
+ on Mac OS X).
AGOS:
- Fixed palette issues in Amiga versions of Simon the Sorcerer 1.
Modified: scummvm/branches/gsoc2008-vkeybd/backends/midi/quicktime.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/midi/quicktime.cpp 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/midi/quicktime.cpp 2008-07-22 00:15:13 UTC (rev 33185)
@@ -132,8 +132,7 @@
return MERR_DEVICE_NOT_AVAILABLE;
}
-void MidiDriver_QT::close()
-{
+void MidiDriver_QT::close() {
MidiDriver_MPU401::close();
dispose();
}
@@ -248,8 +247,7 @@
NASetController(qtNoteAllocator, qtNoteChannel[channel], kControllerPitchBend, theBend);
}
-void MidiDriver_QT::dispose()
-{
+void MidiDriver_QT::dispose() {
for (int i = 0; i < 16; i++) {
if (qtNoteChannel[i] != 0)
NADisposeNoteChannel(qtNoteAllocator, qtNoteChannel[i]);
Property changes on: scummvm/branches/gsoc2008-vkeybd/backends/platform/dc
___________________________________________________________________
Modified: svn:ignore
- *.d
gui
graphics
sound
common
base
backends
tools
plugins
engines
scummvm.elf
scummvm.bin
SCUMMVM.BIN
*.PLG
+ .deps
gui
graphics
sound
common
base
backends
tools
plugins
engines
scummvm.elf
scummvm.bin
SCUMMVM.BIN
*.PLG
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/dc/Makefile
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/dc/Makefile 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/dc/Makefile 2008-07-22 00:15:13 UTC (rev 33185)
@@ -33,8 +33,33 @@
DEFINES += -DDYNAMIC_MODULES
PRE_OBJS_FLAGS = -Wl,--whole-archive
POST_OBJS_FLAGS = -Wl,--no-whole-archive
+ENABLED=DYNAMIC_PLUGIN
+else
+ENABLED=STATIC_PLUGIN
endif
+ENABLE_SCUMM = $(ENABLED)
+ENABLE_SCUMM_7_8 = $(ENABLED)
+ENABLE_HE = $(ENABLED)
+ENABLE_AGI = $(ENABLED)
+ENABLE_AGOS = $(ENABLED)
+ENABLE_CINE = $(ENABLED)
+ENABLE_CRUISE = $(ENABLED)
+ENABLE_DRASCULA = $(ENABLED)
+ENABLE_GOB = $(ENABLED)
+ENABLE_IGOR = $(ENABLED)
+ENABLE_KYRA = $(ENABLED)
+ENABLE_LURE = $(ENABLED)
+ENABLE_M4 = $(ENABLED)
+ENABLE_MADE = $(ENABLED)
+ENABLE_PARALLACTION = $(ENABLED)
+ENABLE_QUEEN = $(ENABLED)
+ENABLE_SAGA = $(ENABLED)
+ENABLE_SKY = $(ENABLED)
+ENABLE_SWORD1 = $(ENABLED)
+ENABLE_SWORD2 = $(ENABLED)
+ENABLE_TOUCHE = $(ENABLED)
+
OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \
label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o
@@ -50,7 +75,7 @@
plugin_dist :
for p in plugins/*.plg; do \
- sh-elf-strip -g -o "`basename \"$$p\" | tr '[:lower:]' '[:upper:]'`" "$$p"; \
+ sh-elf-strip -g -o "`basename \"$$p\" | LC_CTYPE=C tr '[:lower:]' '[:upper:]'`" "$$p"; \
done
dist : SCUMMVM.BIN plugins plugin_dist
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.cpp 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.cpp 2008-07-22 00:15:13 UTC (rev 33185)
@@ -168,7 +168,7 @@
u8 gameID;
bool snapToBorder = false;
-bool consoleEnable = false;
+bool consoleEnable = true;
bool gameScreenSwap = false;
bool isCpuScalerEnabled();
//#define HEAVY_LOGGING
@@ -899,12 +899,6 @@
return BG_GFX + 0x10000; // 16bit qty!
}
-void setSoundProc(OSystem_DS::SoundProc proc, void* param) {
-// consolePrintf("Set sound callback");
- soundCallback = proc;
- soundParam = param;
-}
-
// The sound system in ScummVM seems to always return stereo interleaved samples.
// Here, I'm treating an 11Khz stereo stream as a 22Khz mono stream, which works sorta ok, but is
// a horrible bodge. Any advice on how to change the engine to output mono would be greatly
@@ -914,7 +908,8 @@
consolePrintf("doSoundCallback...");
#endif
- if (soundCallback) {
+ if (OSystem_DS::instance())
+ if (OSystem_DS::instance()->getMixerImpl()) {
lastCallbackFrame = frameCount;
for (int r = IPC->playingSection; r < IPC->playingSection + 4; r++) {
@@ -923,7 +918,7 @@
if (IPC->fillNeeded[chunk]) {
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
- soundCallback(soundParam, (byte *) (soundBuffer + ((bufferSamples >> 2) * chunk)), bufferSamples >> 1);
+ OSystem_DS::instance()->getMixerImpl()->mixCallback((byte *) (soundBuffer + ((bufferSamples >> 2) * chunk)), bufferSamples >> 1);
IPC->fillNeeded[chunk] = false;
DC_FlushAll();
}
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.h 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/dsmain.h 2008-07-22 00:15:13 UTC (rev 33185)
@@ -88,7 +88,6 @@
void doTimerCallback(); // Call callback function if required
// Sound
-void setSoundProc(OSystem_DS::SoundProc proc, void* param); // Setup a callback function for sound
void doSoundCallback(); // Call function if sound buffers need more data
void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound
void stopSound(int channel);
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.cpp 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.cpp 2008-07-22 00:15:13 UTC (rev 33185)
@@ -67,10 +67,12 @@
ConfMan.setInt("autosave_period", 0);
ConfMan.setBool("FM_medium_quality", true);
- _mixer = new DSAudioMixer;
- _timer = new DSTimerManager;
- DS::setSoundProc(Audio::Mixer::mixCallback, _mixer);
- DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
+ _mixer = new DSAudioMixer(this);
+ _timer = new DSTimerManager();
+ DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
+
+ _mixer->setOutputRate(11025 /*DS::getSoundFrequency()*/);
+ _mixer->setReady(true);
OSystem::initBackend();
}
@@ -139,7 +141,7 @@
green >>= 3;
blue >>= 3;
-// if (r != 255)
+ if (r != 255)
{
BG_PALETTE[r] = red | (green << 5) | (blue << 10);
if (!DS::getKeyboardEnable()) {
@@ -158,13 +160,13 @@
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
- u16* image = (u16 *) DS::get8BitBackBuffer();
+ const u16* image = (const u16 *) DS::get8BitBackBuffer();
for (int y = 0; y < DS::getGameHeight(); y++)
{
DC_FlushRange(image + (y << 8), DS::getGameWidth());
for (int x = 0; x < DS::getGameWidth() >> 1; x++)
{
- *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x];
+ *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y << 8) + x];
}
}
@@ -277,7 +279,7 @@
void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
u16* bg = (u16 *) DS::get16BitBackBuffer();
- u16* src = (u16 *) buf;
+ const u16* src = (const u16 *) buf;
// if (x + w > 256) w = 256 - x;
//if (x + h > 256) h = 256 - y;
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.h 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/osystem_ds.h 2008-07-22 00:15:13 UTC (rev 33185)
@@ -30,10 +30,13 @@
#include "gbampsave.h"
#include "backends/saves/default/default-saves.h"
#include "backends/timer/default/default-timer.h"
-#include "sound/mixer.h"
+#include "sound/mixer_intern.h"
#include "graphics/surface.h"
-class DSAudioMixer : public Audio::Mixer {
+class DSAudioMixer : public Audio::MixerImpl {
+
+public:
+ DSAudioMixer(OSystem* system) : Audio::MixerImpl(system) { }
};
class DSTimerManager : public DefaultTimerManager {
@@ -62,7 +65,7 @@
Graphics::Surface* createTempFrameBuffer();
public:
- typedef void (*SoundProc)(void *param, byte *buf, int len);
+ typedef void (*SoundProc)(byte *buf, int len);
typedef int (*TimerProc)(int interval);
OSystem_DS();
@@ -146,6 +149,8 @@
virtual void unlockScreen();
virtual Audio::Mixer* getMixer() { return _mixer; }
+ Audio::MixerImpl* getMixerImpl() { return _mixer; }
+
virtual Common::TimerManager* getTimerManager() { return _timer; }
static int timerHandler(int t);
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/wordcompletion.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/wordcompletion.cpp 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ds/arm9/source/wordcompletion.cpp 2008-07-22 00:15:13 UTC (rev 33185)
@@ -1,6 +1,6 @@
#include "wordcompletion.h"
-#include "engines/agi/agi.h"
#include "osystem_ds.h"
+#include "engines/agi/agi.h" // Caution for #define for NUM_CHANNELS, causes problems in mixer_intern.h
#ifdef ENABLE_AGI
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/Makefile.ps2
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/Makefile.ps2 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/Makefile.ps2 2008-07-22 00:15:13 UTC (rev 33185)
@@ -19,16 +19,17 @@
srcdir = ../../..
VPATH = $(srcdir)
INCDIR = ../../../
+DEPDIR = .deps
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 = /home/robby/libStuffNew/ps2sdk-ports
+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 = /home/robby/libStuff
+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
Modified: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/fileio.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/fileio.cpp 2008-07-21 23:33:03 UTC (rev 33184)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/fileio.cpp 2008-07-22 00:15:13 UTC (rev 33185)
@@ -340,8 +340,6 @@
assert(cacheListSema >= 0);
}
- //printf("ps2_fopen: %s, %s\n", fname, mode);
-
if (((mode[0] != 'r') && (mode[0] != 'w')) || ((mode[1] != '\0') && (mode[1] != 'b'))) {
printf("unsupported mode \"%s\" for file \"%s\"\n", mode, fname);
return NULL;
@@ -363,6 +361,8 @@
} else {
// Regular access to one of the devices
+ printf("ps2_fopen = %s\n", fname); // romeo : temp
+
if (!rdOnly)
return NULL; // we only provide readaccess for cd,dvd,hdd,usb
@@ -378,19 +378,22 @@
}
int64 cacheId = -1;
- if (rdOnly && tocManager.haveEntries())
+ if (tocManager.haveEntries())
cacheId = tocManager.fileExists(fname);
if (cacheId != 0) {
Ps2File *file = findInCache(cacheId);
- if (file)
+ if (file) {
+ printf(" findInCache(%x)\n", cacheId); // romeo : temp
return (FILE*)file;
+ }
bool isAudioFile = strstr(fname, ".bun") || strstr(fname, ".BUN") || strstr(fname, ".Bun");
file = new Ps2ReadFile(cacheId, isAudioFile);
if (file->open(fname)) {
openFileCount++;
+ printf(" new cacheID = %x\n", cacheId); // romeo : temp
return (FILE*)file;
} else
delete file;
@@ -579,7 +582,7 @@
}
char readPath[256];
sprintf(readPath, "%s/", _root);
- printf("readDir: %s\n", readPath);
+ printf("readDir: %s (root: %s )\n", readPath, root);
readDir(readPath, &_rootNode, 0);
}
@@ -587,28 +590,62 @@
if (level <= 2) { // we don't scan deeper than that
iox_dirent_t dirent;
int fd = fio.dopen(path);
+ TocNode *eNode = NULL; // = *node; // entry node
+ bool first = true;
+
+ printf("path=%s - level=%d fd=%d\n", path, level, fd); // romeo : temp
if (fd >= 0) {
- while (fio.dread(fd, &dirent) > 0)
- if (dirent.name[0] != '.') { // skip '.' and '..'
+ while (fio.dread(fd, &dirent) > 0) {
+ if (dirent.name[0] != '.') { // skip '.' & '..' - romeo : check
+ // --- do we have them on PS2?
*node = new TocNode;
+ if (first) {
+ eNode = *node;
+ first = false;
+ }
(*node)->sub = (*node)->next = NULL;
-
(*node)->nameLen = strlen(dirent.name);
memcpy((*node)->name, dirent.name, (*node)->nameLen + 1);
- if (dirent.stat.mode & FIO_S_IFDIR) { // directory
+ if (dirent.stat.mode & FIO_S_IFDIR) {
(*node)->isDir = true;
- char nextPath[256];
- sprintf(nextPath, "%s%s/", path, dirent.name);
- readDir(nextPath, &((*node)->sub), level + 1);
- } else
+ printf("dirent.name = %s [DIR]\n", dirent.name);
+ }
+ else {
(*node)->isDir = false;
+ printf("dirent.name = %s\n", dirent.name);
+ }
+
node = &((*node)->next);
}
+ }
+
fio.dclose(fd);
- } else
- printf("Can't open path: %s\n", path);
+ }
+
+ TocNode *iNode = eNode;
+ char nextPath[256];
+
+ while (iNode) {
+ if (iNode->isDir == true) {
+ sprintf(nextPath, "%s%s/", path, iNode->name);
+ readDir(nextPath, &(iNode->sub), level + 1);
+ }
+ iNode = iNode->next;
+ }
+
}
+
+ /*
+ ** Wizard of Oz' trick (to get all games running from USB on PS2):
+
+ 1. Make a list of files / dirs in level #0 (dclose before continuing)
+
+ 2. Go through the dirs : dopen / dread them / mark dirs / dclose
+
+ It's a safe recursion, cause it recurses on 'isDir' nodes
+ after dclosing the higher hierarchy
+ */
}
int64 TocManager::fileExists(const char *name) {
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/Makefile
===================================================================
--- scummvm/trunk/backends/platform/ps2/iop/rpckbd/Makefile 2008-07-21 11:33:30 UTC (rev 33169)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/Makefile 2008-07-22 00:15:13 UTC (rev 33185)
@@ -1,30 +0,0 @@
-# _____ ___ ____ ___ ____
-# ____| | ____| | | |____|
-# | ___| |____ ___| ____| | \ 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
Copied: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/Makefile (from rev 33169, scummvm/trunk/backends/platform/ps2/iop/rpckbd/Makefile)
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/Makefile (rev 0)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/Makefile 2008-07-22 00:15:13 UTC (rev 33185)
@@ -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
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h 2008-07-21 11:33:30 UTC (rev 33169)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h 2008-07-22 00:15:13 UTC (rev 33185)
@@ -1,90 +0,0 @@
-/*
-# _____ ___ ____ ___ ____
-# ____| | ____| | | |____|
-# | ___| |____ ___| ____| | \ 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
Copied: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h (from rev 33169, scummvm/trunk/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h)
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h (rev 0)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/include/ps2kbd.h 2008-07-22 00:15:13 UTC (rev 33185)
@@ -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
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/imports.lst
===================================================================
--- scummvm/trunk/backends/platform/ps2/iop/rpckbd/src/imports.lst 2008-07-21 11:33:30 UTC (rev 33169)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/imports.lst 2008-07-22 00:15:13 UTC (rev 33185)
@@ -1,58 +0,0 @@
-
-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
-
Copied: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/imports.lst (from rev 33169, scummvm/trunk/backends/platform/ps2/iop/rpckbd/src/imports.lst)
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/imports.lst (rev 0)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/imports.lst 2008-07-22 00:15:13 UTC (rev 33185)
@@ -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
+
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/irx_imports.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/iop/rpckbd/src/irx_imports.h 2008-07-21 11:33:30 UTC (rev 33169)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/irx_imports.h 2008-07-22 00:15:13 UTC (rev 33185)
@@ -1,35 +0,0 @@
-/*
-# _____ ___ ____ ___ ____
-# ____| | ____| | | |____|
-# | ___| |____ ___| ____| | \ 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 */
Copied: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/irx_imports.h (from rev 33169, scummvm/trunk/backends/platform/ps2/iop/rpckbd/src/irx_imports.h)
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/irx_imports.h (rev 0)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/irx_imports.h 2008-07-22 00:15:13 UTC (rev 33185)
@@ -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 */
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c
===================================================================
--- scummvm/trunk/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c 2008-07-21 11:33:30 UTC (rev 33169)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c 2008-07-22 00:15:13 UTC (rev 33185)
@@ -1,1199 +0,0 @@
-/*
-# _____ ___ ____ ___ ____
-# ____| | ____| | | |____|
-# | ___| |____ ___| ____| | \ 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(¶m);
- 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(¶m);
-
- 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;
-}
Copied: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c (from rev 33169, scummvm/trunk/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c)
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c (rev 0)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/ps2kbd.c 2008-07-22 00:15:13 UTC (rev 33185)
@@ -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(¶m);
+ 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(¶m);
+
+ 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;
+}
Deleted: scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/us_keymap.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/iop/rpckbd/src/us_keymap.h 2008-07-21 11:33:30 UTC (rev 33169)
+++ scummvm/branches/gsoc2008-vkeybd/backends/platform/ps2/iop/rpckbd/src/us_keymap.h 2008-07-22 00:15:13 UTC (rev 33185)
@@ -1,1579 +0,0 @@
-/*
-# _____ ___ ____ ___ ____
-# ____| | ____| | | |____|
-# | ___| |____ ___| ____| | \ 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,
@@ 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