1
0
Fork 0

Some sanity checks on strings for the cdrom.

Changed E_Exit to warning when direct copyflag is used.
Added printscreen/scrollock/pause to the keymapper.
Ignoring printscreen and pause in keyboard (can be used to map special keys
to).
Added some binds so you can bind special keys to them (MK_scrolllock and
MK_pause).
Updated headers to support those new keys and MK_keys.


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1861
This commit is contained in:
Peter Veenstra 2004-06-30 14:40:08 +00:00
parent 4b8a13bdc1
commit 8f472fb66a
5 changed files with 56 additions and 21 deletions

View file

@ -36,6 +36,7 @@ enum KBD_KEYS {
KBD_grave,KBD_minus,KBD_equals,KBD_backslash,KBD_leftbracket,KBD_rightbracket,
KBD_semicolon,KBD_quote,KBD_period,KBD_comma,KBD_slash,
KBD_printscreen,KBD_pause,
KBD_insert,KBD_home,KBD_pageup,KBD_delete,KBD_end,KBD_pagedown,
KBD_left,KBD_up,KBD_down,KBD_right,

View file

@ -21,7 +21,7 @@
enum MapKeys {
MK_f1,MK_f2,MK_f3,MK_f4,MK_f5,MK_f6,MK_f7,MK_f8,MK_f9,MK_f10,MK_f11,MK_f12,
MK_return,MK_kpminus,
MK_return,MK_kpminus,MK_scrolllock,MK_printscreen,MK_pause,
};

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_mscdex.cpp,v 1.21 2004-06-09 09:11:55 qbix79 Exp $ */
/* $Id: dos_mscdex.cpp,v 1.22 2004-06-30 14:40:07 qbix79 Exp $ */
#include <string.h>
#include <ctype.h>
@ -601,9 +601,12 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph
if (!ReadSectors(GetSubUnit(drive),false,dirEntrySector,1,defBuffer)) return false;
// Get string part
foundName = false;
useName = searchPos;
searchPos = strchr(searchPos,'\\');
if (searchPos) { *searchPos = 0; searchPos++; }
if (searchPos) {
useName = searchPos;
searchPos = strchr(searchPos,'\\');
}
if (searchPos) { *searchPos = 0; searchPos++; }
else foundComplete = true;
do {
@ -622,7 +625,7 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph
if (foundName) {
// TO DO : name gefunden, Daten in den Buffer kopieren
if (foundComplete) {
if (copyFlag) E_Exit("MSCDEX: GetDirEntry: Unsupported copyflag");
if (copyFlag) LOG(LOG_MISC,LOG_ERROR)("MSCDEX: GetDirEntry: Unsupported copyflag. (result structure should be different");
// Direct copy
MEM_BlockCopy(buffer,defBuffer+index,entryLength);
error = iso ? 1:0;
@ -917,7 +920,7 @@ static bool MSCDEX_Handler(void)
if (reg_ah!=0x15) return false;
PhysPt data = PhysMake(SegValue(es),reg_bx);
MSCDEX_LOG("MSCDEX: INT 2F %04X",reg_ax);
MSCDEX_LOG("MSCDEX: INT 2F %04X BX= %04X CX=%04X",reg_ax,reg_bx,reg_bx);
switch (reg_ax) {
case 0x1500: /* Install check */
@ -994,6 +997,7 @@ static bool MSCDEX_Handler(void)
case 0x1510: /* Device driver request */
mscdex->SendDriverRequest(reg_cx,data);
return true;
default : LOG(LOG_MISC,LOG_ERROR)("MSCDEX: Unknwon call : %04X",reg_ax);
return true;

View file

@ -16,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: sdl_mapper.cpp,v 1.5 2004-06-30 14:40:08 qbix79 Exp $ */
#include <vector>
#include <list>
#include <string.h>
@ -432,6 +434,7 @@ void CBindGroup::ActivateBindList(CBindList * list,Bits value) {
}
}
for (it=list->begin();it!=list->end();it++) {
/*BUG:CRASH if keymapper key is removed*/
if (validmod==(*it)->mods) (*it)->Activate(value);
}
}
@ -716,6 +719,15 @@ public:
case MK_kpminus:
key=SDLK_KP_MINUS;
break;
case MK_scrolllock:
key=SDLK_SCROLLOCK;
break;
case MK_pause:
key=SDLK_PAUSE;
break;
case MK_printscreen:
key=SDLK_PRINT;
break;
}
sprintf(buf,"%s \"key %d%s%s%s\"",
entry,
@ -878,7 +890,8 @@ static void CreateLayout(void) {
/* Create the buttons for the Keyboard */
#define BW 28
#define BH 20
#define PX(_X_) ((_X_)*BW)
#define DX 5
#define PX(_X_) ((_X_)*BW + DX)
#define PY(_Y_) (30+(_Y_)*BH)
AddKeyButtonEvent(PX(0),PY(0),BW,BH,"ESC","esc",KBD_esc);
for (i=0;i<12;i++) AddKeyButtonEvent(PX(2+i),PY(0),BW,BH,combo_f[i].title,combo_f[i].entry,combo_f[i].key);
@ -892,7 +905,7 @@ static void CreateLayout(void) {
AddKeyButtonEvent(PX(0),PY(3),BW*2,BH,"CLCK","capslock",KBD_capslock);
for (i=0;i<12;i++) AddKeyButtonEvent(PX(2+i),PY(3),BW,BH,combo_3[i].title,combo_3[i].entry,combo_3[i].key);
AddKeyButtonEvent(0,PY(4),BW*3,BH,"SHIFT","lshift",KBD_leftshift);
AddKeyButtonEvent(PX(0),PY(4),BW*3,BH,"SHIFT","lshift",KBD_leftshift);
for (i=0;i<10;i++) AddKeyButtonEvent(PX(3+i),PY(4),BW,BH,combo_4[i].title,combo_4[i].entry,combo_4[i].key);
AddKeyButtonEvent(PX(13),PY(4),BW*3,BH,"SHIFT","rshift",KBD_rightshift);
@ -904,12 +917,16 @@ static void CreateLayout(void) {
AddKeyButtonEvent(PX(14),PY(5),BW*2,BH,"CTRL","rctrl",KBD_rightctrl);
/* Arrow Keys */
AddKeyButtonEvent(PX(0),PY(7),BW,BH,"INS","insert",KBD_insert);
AddKeyButtonEvent(PX(1),PY(7),BW,BH,"HOM","home",KBD_home);
AddKeyButtonEvent(PX(2),PY(7),BW,BH,"PUP","pageup",KBD_pageup);
AddKeyButtonEvent(PX(0),PY(8),BW,BH,"DEL","delete",KBD_delete);
AddKeyButtonEvent(PX(1),PY(8),BW,BH,"END","end",KBD_end);
AddKeyButtonEvent(PX(2),PY(8),BW,BH,"PDN","pagedown",KBD_pagedown);
AddKeyButtonEvent(PX(0),PY(7),BW,BH,"PRT","printscreen",KBD_printscreen);
AddKeyButtonEvent(PX(1),PY(7),BW,BH,"SCL","scrolllock",KBD_scrolllock);
AddKeyButtonEvent(PX(2),PY(7),BW,BH,"PAU","pause",KBD_pause);
AddKeyButtonEvent(PX(0),PY(8),BW,BH,"INS","insert",KBD_insert);
AddKeyButtonEvent(PX(1),PY(8),BW,BH,"HOM","home",KBD_home);
AddKeyButtonEvent(PX(2),PY(8),BW,BH,"PUP","pageup",KBD_pageup);
AddKeyButtonEvent(PX(0),PY(9),BW,BH,"DEL","delete",KBD_delete);
AddKeyButtonEvent(PX(1),PY(9),BW,BH,"END","end",KBD_end);
AddKeyButtonEvent(PX(2),PY(9),BW,BH,"PDN","pagedown",KBD_pagedown);
AddKeyButtonEvent(PX(1),PY(10),BW,BH,"\x18","up",KBD_up);
AddKeyButtonEvent(PX(0),PY(11),BW,BH,"\x1B","left",KBD_left);
AddKeyButtonEvent(PX(1),PY(11),BW,BH,"\x19","down",KBD_down);
@ -947,7 +964,9 @@ static void CreateLayout(void) {
AddJButtonButton(PX(19),PY(3),BW,BH,"2" ,1,1);
AddJAxisButton (PX(17),PY(4),BW,BH,"X-",1,false,false);
AddJAxisButton (PX(18),PY(4),BW,BH,"Y+",1,true,true);
AddJAxisButton (PX(19),PY(4),BW,BH,"X+",1,false,true); /* The modifier buttons */
AddJAxisButton (PX(19),PY(4),BW,BH,"X+",1,false,true);
/* The modifier buttons */
AddModButton(PX(0),PY(13),50,20,"Mod1",1);
AddModButton(PX(2),PY(13),50,20,"Mod2",2);
AddModButton(PX(4),PY(13),50,20,"Mod3",3);
@ -961,8 +980,9 @@ static void CreateLayout(void) {
}
}
/* Create some text buttons */
new CTextButton(200,00,124,20,"Keyboard Layout");
new CTextButton(PX(6),00,124,20,"Keyboard Layout");
new CTextButton(PX(16),00,124,20,"Joystick Layout");
bind_but.action=new CCaptionButton(200,330,0,0);
bind_but.event_title=new CCaptionButton(0,350,0,0);
@ -1045,7 +1065,8 @@ static struct {
{"quote", SDLK_QUOTE}, {"backslash",SDLK_BACKSLASH}, {"lshift",SDLK_LSHIFT},
{"rshift",SDLK_RSHIFT}, {"lalt",SDLK_LALT}, {"ralt",SDLK_RALT},
{"lctrl",SDLK_LCTRL}, {"rctrl",SDLK_RCTRL}, {"comma",SDLK_COMMA},
{"period",SDLK_PERIOD}, {"slash",SDLK_SLASH}, {"pagedown",SDLK_PAGEDOWN},
{"period",SDLK_PERIOD}, {"slash",SDLK_SLASH}, {"printscreen",SDLK_PRINT},
{"scrolllock",SDLK_SCROLLOCK}, {"pause",SDLK_PAUSE}, {"pagedown",SDLK_PAGEDOWN},
{"pageup",SDLK_PAGEUP}, {"insert",SDLK_INSERT}, {"home",SDLK_HOME},
{"delete",SDLK_DELETE}, {"end",SDLK_END}, {"up",SDLK_UP},
{"left",SDLK_LEFT}, {"down",SDLK_DOWN}, {"right",SDLK_RIGHT},
@ -1074,6 +1095,11 @@ static void CreateDefaultBinds(void) {
(*hit)->MakeDefaultBind(buffer);
CreateStringBind(buffer);
}
/* JOYSTICK */
if (SDL_NumJoysticks()>0) {
// default mapping
}
}
void MAPPER_AddHandler(MAPPER_Handler * handler,MapKeys key,Bitu mods,char * eventname,char * buttonname) {
@ -1162,7 +1188,7 @@ void MAPPER_Run(void) {
for (CEventVector_it evit=events.begin();evit!=events.end();evit++) {
(*evit)->DeActivateAll();
}
bool mousetoggle=false;
if(mouselocked) {
mousetoggle=true;

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: keyboard.cpp,v 1.25 2004-06-20 22:03:34 harekiet Exp $ */
/* $Id: keyboard.cpp,v 1.26 2004-06-30 14:40:08 qbix79 Exp $ */
#include <string.h>
#include <assert.h>
@ -320,6 +320,10 @@ void KEYBOARD_AddKey(KBD_KEYS keytype,bool pressed) {
case KBD_pagedown:extend=true;ret=81;break;
case KBD_insert:extend=true;ret=82;break;
case KBD_delete:extend=true;ret=83;break;
case KBD_pause:
case KBD_printscreen:
/* Not handled yet. But usuable in mapper for special events */
return;
default:
E_Exit("Unsupported key press");
break;