PEC-586 russian keyboard support

some fixes to subor keyboard layot (anyway, unused currently, todo: reckeck key mapping)
This commit is contained in:
CaH4e3 2014-01-12 14:53:50 +00:00
parent cd3590d3de
commit 5d149f95d2
13 changed files with 515 additions and 408 deletions

1
trunk/src/drivers/win/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/res.aps

View File

@ -376,7 +376,7 @@ static uint32 UpdatePPadData(int w)
static uint8 fkbkeys[0x48];
static uint8 suborkbkeys[0x60];
static uint8 suborkbkeys[0x65];
void KeyboardUpdateState(void); //mbg merge 7/17/06 yech had to add this
@ -421,6 +421,7 @@ void FCEUD_UpdateInput()
if(cidisabled)
UpdateFKB();
break;
case SIFC_PEC586KB:
case SIFC_SUBORKB:
if(cidisabled)
UpdateSuborKB();
@ -510,6 +511,7 @@ void InitInputPorts(bool fourscore)
case SIFC_FKB:
InputDPtr=fkbkeys;
break;
case SIFC_PEC586KB:
case SIFC_SUBORKB:
InputDPtr=suborkbkeys;
break;
@ -554,7 +556,7 @@ ButtConfig fkbmap[0x48]=
MK(BL_CURSORUP),MK(BL_CURSORLEFT),MK(BL_CURSORRIGHT),MK(BL_CURSORDOWN)
};
ButtConfig suborkbmap[0x60]=
ButtConfig suborkbmap[0x65]=
{
MC(0x01),MC(0x3b),MC(0x3c),MC(0x3d),MC(0x3e),MC(0x3f),MC(0x40),MC(0x41),MC(0x42),MC(0x43),
MC(0x44),MC(0x57),MC(0x58),MC(0x45),MC(0x29),MC(0x02),MC(0x03),MC(0x04),MC(0x05),MC(0x06),
@ -565,7 +567,8 @@ ButtConfig suborkbmap[0x60]=
MC(0x21),MC(0x22),MC(0x23),MC(0x24),MC(0x25),MC(0x26),MC(0x27),MC(0x28),MC(0x4b),MC(0x4c),
MC(0x4d),MC(0x2a),MC(0x2c),MC(0x2d),MC(0x2e),MC(0x2f),MC(0x30),MC(0x31),MC(0x32),MC(0x33),
MC(0x34),MC(0x35),MC(0x2b),MC(0xc8),MC(0x4f),MC(0x50),MC(0x51),MC(0x1d),MC(0x38),MC(0x39),
MC(0xcb),MC(0xd0),MC(0xcd),MC(0x52),MC(0x53)
MC(0xcb),MC(0xd0),MC(0xcd),MC(0x52),MC(0x53),MC(0x00),MC(0x00),MC(0x00),MC(0x00),MC(0x00),
MC(0x00),
};
@ -573,7 +576,7 @@ static void UpdateFKB(void)
{
int x;
for(x=0;x<0x48;x++)
for(x=0;x<sizeof(fkbkeys);x++)
{
fkbkeys[x]=0;
@ -586,7 +589,7 @@ static void UpdateSuborKB(void)
{
int x;
for(x=0;x<0x60;x++)
for(x=0;x<sizeof(suborkbkeys);x++)
{
suborkbkeys[x]=0;
@ -718,9 +721,9 @@ void InitInputStuff(void)
for(y=0; y<12; y++)
JoyClearBC(&powerpadsc[x][y]);
for(x=0; x<0x48; x++)
for(x=0; x<sizeof(fkbkeys); x++)
JoyClearBC(&fkbmap[x]);
for(x=0; x<0x60; x++)
for(x=0; x<sizeof(suborkbkeys); x++)
JoyClearBC(&suborkbmap[x]);
for(x=0; x<6; x++)
@ -1062,7 +1065,7 @@ const unsigned int NUMBER_OF_NES_DEVICES = SI_COUNT + 1;
const static unsigned int NUMBER_OF_FAMICOM_DEVICES = SIFC_COUNT + 1;
//these are unfortunate lists. they match the ESI and ESIFC enums
static const int configurable_nes[NUMBER_OF_NES_DEVICES]= { 0, 1, 0, 1, 1, 0 };
static const int configurable_fam[NUMBER_OF_FAMICOM_DEVICES]= { 0,0,0,0, 1,1,0,1, 1,1,1,0, 0,0 };
static const int configurable_fam[NUMBER_OF_FAMICOM_DEVICES]= { 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0 };
const unsigned int FAMICOM_POSITION = 2;
static void UpdateComboPad(HWND hwndDlg, WORD id)
@ -1336,10 +1339,11 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
DoTBConfig(hwndDlg, text, "POWERPADDIALOG", FTrainerButtons, 12);
break;
case SIFC_FKB:
DoTBConfig(hwndDlg, text, "FKBDIALOG", fkbmap, 0x48);
DoTBConfig(hwndDlg, text, "FKBDIALOG", fkbmap, sizeof(fkbkeys));
break;
case SIFC_PEC586KB:
case SIFC_SUBORKB:
DoTBConfig(hwndDlg, text, "SUBORKBDIALOG", suborkbmap, 0x60);
DoTBConfig(hwndDlg, text, "SUBORKBDIALOG", suborkbmap, sizeof(suborkbkeys));
break;
case SIFC_MAHJONG:
DoTBConfig(hwndDlg, text, "MAHJONGDIALOG", MahjongButtons, 21);

View File

@ -12,7 +12,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Íåéòðàëüíûé resources
// Neutral resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
@ -952,17 +952,17 @@ END
SUBORKBDIALOG DIALOGEX 13, 72, 478, 171
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Family Keyboard Configuration"
CAPTION "Subor Keyboard Configuration"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",1,405,151,56,14
LTEXT "Remember to push the ""Scroll Lock"" key during emulation to enable Family Keyboard input.",-1,18,6,370,12
LTEXT "Remember to push the ""Scroll Lock"" key during emulation to enable Keyboard input.",-1,18,6,370,12
GROUPBOX "",-1,9,22,461,123,WS_GROUP
PUSHBUTTON "Esc",300,20,36,16,12
PUSHBUTTON "F1",301,57,37,16,12
PUSHBUTTON "F2",302,77,37,16,12
PUSHBUTTON "F3",303,97,37,16,12
PUSHBUTTON "F4",304,117,37,16,12
PUSHBUTTON "F1",301,58,37,16,12
PUSHBUTTON "F2",302,78,37,16,12
PUSHBUTTON "F3",303,98,37,16,12
PUSHBUTTON "F4",304,118,37,16,12
PUSHBUTTON "F5",305,143,37,16,12
PUSHBUTTON "F6",306,163,37,16,12
PUSHBUTTON "F7",307,183,37,16,12
@ -971,21 +971,21 @@ BEGIN
PUSHBUTTON "F10",310,249,37,16,12
PUSHBUTTON "F11",311,268,37,16,12
PUSHBUTTON "F12",312,288,37,16,12
PUSHBUTTON "Pause",313,333,36,24,12
PUSHBUTTON "Pause",313,318,36,16,12
PUSHBUTTON "`",314,20,60,16,12
PUSHBUTTON "1",315,40,60,16,12
PUSHBUTTON "2",316,60,60,16,12
PUSHBUTTON "3",317,79,60,16,12
PUSHBUTTON "4",318,99,60,16,12
PUSHBUTTON "5",319,119,60,16,12
PUSHBUTTON "6",320,139,60,16,12
PUSHBUTTON "7",321,159,60,16,12
PUSHBUTTON "8",322,179,60,16,12
PUSHBUTTON "9",323,199,60,16,12
PUSHBUTTON "0",324,219,60,16,12
PUSHBUTTON "-",325,239,60,16,12
PUSHBUTTON "=",326,259,60,16,12
PUSHBUTTON "BS",327,279,60,26,12
PUSHBUTTON "1",315,39,60,16,12
PUSHBUTTON "2",316,58,60,16,12
PUSHBUTTON "3",317,77,60,16,12
PUSHBUTTON "4",318,96,60,16,12
PUSHBUTTON "5",319,115,60,16,12
PUSHBUTTON "6",320,134,60,16,12
PUSHBUTTON "7",321,153,60,16,12
PUSHBUTTON "8",322,172,60,16,12
PUSHBUTTON "9",323,191,60,16,12
PUSHBUTTON "0",324,210,60,16,12
PUSHBUTTON "-",325,229,60,16,12
PUSHBUTTON "=",326,248,60,16,12
PUSHBUTTON "BS",327,286,60,16,12
PUSHBUTTON "Ins",328,318,59,16,12
PUSHBUTTON "Home",329,337,59,16,12
PUSHBUTTON "NL",330,385,59,16,12
@ -993,20 +993,20 @@ BEGIN
PUSHBUTTON "*",332,425,59,16,12
PUSHBUTTON "-",333,444,59,16,12
PUSHBUTTON "PUp",334,357,59,16,12
PUSHBUTTON "TAB",335,19,76,25,12
PUSHBUTTON "Q",336,48,76,16,12
PUSHBUTTON "W",337,67,76,16,12
PUSHBUTTON "E",338,86,76,16,12
PUSHBUTTON "R",339,105,76,16,12
PUSHBUTTON "T",340,124,76,16,12
PUSHBUTTON "Y",341,143,76,16,12
PUSHBUTTON "U",342,162,76,16,12
PUSHBUTTON "I",343,181,76,16,12
PUSHBUTTON "O",344,200,76,16,12
PUSHBUTTON "P",345,219,76,16,12
PUSHBUTTON "[",346,238,76,16,12
PUSHBUTTON "]",347,257,76,16,12
PUSHBUTTON "Enter",348,279,76,26,28
PUSHBUTTON "TAB",335,20,76,24,12
PUSHBUTTON "Q",336,47,76,16,12
PUSHBUTTON "W",337,66,76,16,12
PUSHBUTTON "E",338,85,76,16,12
PUSHBUTTON "R",339,104,76,16,12
PUSHBUTTON "T",340,123,76,16,12
PUSHBUTTON "Y",341,142,76,16,12
PUSHBUTTON "U",342,161,76,16,12
PUSHBUTTON "I",343,180,76,16,12
PUSHBUTTON "O",344,199,76,16,12
PUSHBUTTON "P",345,218,76,16,12
PUSHBUTTON "[",346,237,76,16,12
PUSHBUTTON "]",347,256,76,16,12
PUSHBUTTON "Enter",348,274,76,28,29
PUSHBUTTON "Del",349,318,75,16,12
PUSHBUTTON "End",350,338,75,16,12
PUSHBUTTON "PDn",351,357,75,16,12
@ -1040,19 +1040,25 @@ BEGIN
PUSHBUTTON ",",379,195,108,16,12
PUSHBUTTON ".",380,214,108,16,12
PUSHBUTTON "/",381,233,108,16,12
PUSHBUTTON "\\",382,289,108,16,12
PUSHBUTTON "Up",383,337,107,16,12
PUSHBUTTON "\\",382,267,60,16,12
PUSHBUTTON "Up",383,337,108,16,12
PUSHBUTTON "1",384,385,107,16,12
PUSHBUTTON "2",385,405,107,16,12
PUSHBUTTON "3",386,425,107,16,12
PUSHBUTTON "CTRL",387,20,123,28,12
PUSHBUTTON "ALT",388,52,123,28,12
PUSHBUTTON "SPACE",389,84,123,156,12
PUSHBUTTON "Left",390,318,122,16,12
PUSHBUTTON "Dn",391,337,122,16,12
PUSHBUTTON "Right",392,357,122,16,12
PUSHBUTTON "0",393,386,122,35,12
PUSHBUTTON ".",394,425,122,16,12
PUSHBUTTON "ALT",388,66,123,27,12
PUSHBUTTON "SPACE",389,96,123,130,12
PUSHBUTTON "Left",390,318,123,16,12
PUSHBUTTON "Dn",391,337,123,16,12
PUSHBUTTON "Right",392,357,123,16,12
PUSHBUTTON "0",393,386,123,35,12
PUSHBUTTON ".",394,425,123,16,12
PUSHBUTTON "SHIFT",395,254,108,48,12
PUSHBUTTON "ALT",396,229,123,29,12
PUSHBUTTON "CTRL",397,274,123,28,12
PUSHBUTTON "Break",398,337,36,16,12
PUSHBUTTON "Reset",399,357,36,16,12
PUSHBUTTON "Enter",400,444,107,16,28
END
TIMINGCONFIG DIALOGEX 23, 157, 203, 60
@ -2261,12 +2267,12 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
#endif // Íåéòðàëüíûé resources
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Ðóññêèé (Ðîññèÿ) resources
// Russian (Russia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
@ -2341,12 +2347,12 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
#endif // Ðóññêèé (Ðîññèÿ) resources
#endif // Russian (Russia) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Àíãëèéñêèé (ÑØÀ) resources
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@ -2580,7 +2586,7 @@ IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp"
IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp"
IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp"
IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp"
#endif // Àíãëèéñêèé (ÑØÀ) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -2293,13 +2293,13 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
if(wParam==SC_KEYMENU)
{
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled)
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB) || (InputType[2]==SIFC_PEC586KB)) && cidisabled)
break;
if(lParam == VK_RETURN || GetIsFullscreen() || tog) break;
}
goto proco;
case WM_SYSKEYDOWN:
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled)
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB) || (InputType[2]==SIFC_PEC586KB)) && cidisabled)
break; // Hopefully this won't break DInput...
if(GetIsFullscreen() || tog)
@ -2331,26 +2331,16 @@ adelikat: Outsourced this to a remappable hotkey
if(GameInfo)
{
//Only disable command keys if a game is loaded(and the other conditions are right, of course).
if(InputType[2]==SIFC_FKB)
if((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB) || (InputType[2]==SIFC_PEC586KB))
{
if(wParam==VK_SCROLL)
{
cidisabled^=1;
FCEUI_DispMessage("Family Keyboard %sabled.",0,cidisabled?"en":"dis");
FCEUI_DispMessage("%s Keyboard %sabled.",0,InputType[2]==SIFC_FKB?"Family":(InputType[2]==SIFC_SUBORKB?"Subor":"PEC586"),cidisabled?"en":"dis");
}
if(cidisabled)
break; // Hopefully this won't break DInput...
}
if(InputType[2]==SIFC_SUBORKB)
{
if(wParam==VK_SCROLL)
{
cidisabled^=1;
FCEUI_DispMessage("Subor Keyboard %sabled.",0,cidisabled?"en":"dis");
}
if(cidisabled)
break;
}
}
goto proco;

View File

@ -69,14 +69,15 @@ enum ESIFC
SIFC_4PLAYER = 3,
SIFC_FKB = 4,
SIFC_SUBORKB = 5,
SIFC_HYPERSHOT = 6,
SIFC_MAHJONG = 7,
SIFC_QUIZKING = 8,
SIFC_FTRAINERA = 9,
SIFC_FTRAINERB = 10,
SIFC_OEKAKIDS = 11,
SIFC_BWORLD = 12,
SIFC_TOPRIDER = 13,
SIFC_PEC586KB = 6,
SIFC_HYPERSHOT = 7,
SIFC_MAHJONG = 8,
SIFC_QUIZKING = 9,
SIFC_FTRAINERA = 10,
SIFC_FTRAINERB = 11,
SIFC_OEKAKIDS = 12,
SIFC_BWORLD = 13,
SIFC_TOPRIDER = 14,
SIFC_COUNT = SIFC_TOPRIDER
};
@ -92,6 +93,7 @@ inline const char* ESIFC_Name(ESIFC esifc)
"4-Player Adapter",
"Family Keyboard",
"Subor Keyboard",
"PEC586 Keyboard",
"HyperShot Pads",
"Mahjong",
"Quiz King Buzzers",

View File

@ -68,6 +68,7 @@ extern INPUTCFC *FCEU_InitArkanoidFC(void);
extern INPUTCFC *FCEU_InitSpaceShadow(void);
extern INPUTCFC *FCEU_InitFKB(void);
extern INPUTCFC *FCEU_InitSuborKB(void);
extern INPUTCFC *FCEU_InitPEC586KB(void);
extern INPUTCFC *FCEU_InitHS(void);
extern INPUTCFC *FCEU_InitMahjong(void);
extern INPUTCFC *FCEU_InitQuizKing(void);
@ -432,6 +433,9 @@ static void SetInputStuffFC()
case SIFC_SUBORKB:
portFC.driver=FCEU_InitSuborKB();
break;
case SIFC_PEC586KB:
portFC.driver=FCEU_InitPEC586KB();
break;
case SIFC_HYPERSHOT:
portFC.driver=FCEU_InitHS();
break;

View File

@ -21,14 +21,12 @@
#include <string.h>
#include "share.h"
#include "fkb.h"
#define AK2(x,y) ( (FKB_##x) | (FKB_##y <<8) )
#define AK(x) FKB_ ## x
static uint8 bufit[0x49];
static uint8 ksmode;
static uint8 ksindex;
static uint16 matrix[9][2][4] =
{
{ { AK(F8), AK(RETURN), AK(BRACKETLEFT), AK(BRACKETRIGHT) },
@ -51,51 +49,40 @@ static uint16 matrix[9][2][4]=
{ AK(DOWN), AK(SPACE), AK(DELETE), AK(INSERT) } },
};
static void FKB_Write(uint8 v)
{
static void FKB_Write(uint8 v) {
v >>= 1;
if(v&2)
{
if (v & 2) {
if ((ksmode & 1) && !(v & 1))
ksindex = (ksindex + 1) % 9;
}
ksmode = v;
}
static uint8 FKB_Read(int w, uint8 ret)
{
//printf("$%04x, %d, %d\n",w+0x4016,ksindex,ksmode&1);
if(w)
{
static uint8 FKB_Read(int w, uint8 ret) {
if (w) {
int x;
ret &= ~0x1E;
for (x = 0; x < 4; x++)
if (bufit[ matrix[ksindex][ksmode & 1][x] & 0xFF ] || bufit[ matrix[ksindex][ksmode & 1][x] >> 8])
{
ret |= 1 << (x + 1);
}
ret ^= 0x1E;
}
return(ret);
}
static void FKB_Strobe(void)
{
static void FKB_Strobe(void) {
ksmode = 0;
ksindex = 0;
//printf("strobe\n");
}
static void FKB_Update(void *data, int arg)
{
memcpy(bufit+1,data,0x48);
static void FKB_Update(void *data, int arg) {
memcpy(bufit + 1, data, sizeof(bufit) - 1);
}
static INPUTCFC FKB = { FKB_Read, FKB_Write, FKB_Strobe, FKB_Update, 0, 0 };
INPUTCFC *FCEU_InitFKB(void)
{
INPUTCFC *FCEU_InitFKB(void) {
memset(bufit, 0, sizeof(bufit));
ksmode = ksindex = 0;
return(&FKB);

View File

@ -0,0 +1,96 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include "share.h"
#include "suborkb.h"
#define AK(x) FKB_ ## x
static uint8 bufit[0x66];
static uint8 kspos, kstrobe;
static uint8 ksindex;
//TODO: check all keys, some of the are wrong
static uint16 matrix[13][8] =
{
{ AK(ESCAPE),AK(SPACE),AK(LMENU),AK(LCONTROL),AK(LSHIFT),AK(GRAVE),AK(TAB),AK(CAPITAL) },
{ AK(F6),AK(F7),AK(F5),AK(F4),AK(F8),AK(F2),AK(F1),AK(F3) },
{ AK(EQUALS), AK(NUMPAD0),AK(PERIOD),AK(A),AK(RETURN),AK(1),AK(Q),AK(Z) },
{ 0, AK(NUMPAD3),AK(NUMPAD6),AK(S),AK(NUMPAD9),AK(2),AK(W),AK(X) },
{ AK(SLASH), AK(NUMPAD2),AK(NUMPAD5),AK(D),AK(NUMPAD8),AK(3),AK(E),AK(C) },
{ AK(BREAK), AK(NUMPAD1),AK(NUMPAD4),AK(F),AK(NUMPAD7),AK(4),AK(R),AK(V) },
{ AK(BACK),AK(BACKSLASH),AK(GRETURN),AK(G),AK(RBRACKET),AK(5),AK(T),AK(B) },
{ AK(9),AK(PERIOD),AK(L),AK(K),AK(O),AK(8),AK(I),AK(COMMA) },
{ AK(0),AK(SLASH),AK(SEMICOLON),AK(J),AK(P),AK(7),AK(U),AK(M) },
{ AK(MINUS),AK(MINUS),AK(APOSTROPHE),AK(H),AK(LBRACKET),AK(6),AK(Y),AK(N) },
{ AK(F11),AK(F12),AK(F10),0,AK(MINUS),AK(F9),0,0 },
{ AK(UP),AK(RIGHT),AK(DOWN),AK(DIVIDE),AK(LEFT),AK(MULTIPLY),AK(SUBTRACT),AK(ADD) },
{ AK(INSERT),AK(NUMPAD1),AK(HOME),AK(PRIOR),AK(DELETE),AK(END),AK(NEXT),AK(NUMLOCK) },
};
static void PEC586KB_Write(uint8 v) {
if (((kstrobe & 7) == 1) && ((v & 7) == 2)) {
kspos = 0;
ksindex = 0;
} else if (((kstrobe & 7) == 7) && ((v & 3) == 2)) {
kspos++;
kspos %= 13;
ksindex = 0;
}
kstrobe = v;
}
static uint8 PEC586KB_Read(int w, uint8 ret) {
#ifdef FCEUDEF_DEBUGGER
if (!fceuindbg) {
#endif
if (w) {
ret &= ~2;
if(matrix[kspos][7-ksindex] < (88 + 16)) {
if(bufit[matrix[kspos][7-ksindex]])
ret |= 2;
ksindex++;
ksindex&=7;
}
}
#ifdef FCEUDEF_DEBUGGER
}
#endif
return(ret);
}
static void PEC586KB_Strobe(void) {
kstrobe = 0;
ksindex = 0;
}
static void PEC586KB_Update(void *data, int arg) {
memcpy(bufit + 1, data, sizeof(bufit) - 1);
}
static INPUTCFC PEC586KB = { PEC586KB_Read, PEC586KB_Write, PEC586KB_Strobe, PEC586KB_Update, 0, 0 };
INPUTCFC *FCEU_InitPEC586KB(void) {
memset(bufit, 0, sizeof(bufit));
kspos = ksindex = kstrobe = 0;
return(&PEC586KB);
}

View File

@ -1,14 +1,32 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include "share.h"
#include "suborkb.h"
#define AK2(x,y) ( (FKB_##x) | (FKB_##y <<8) )
#define AK(x) FKB_ ## x
static uint8 bufit[0x61];
static uint8 bufit[0x66];
static uint8 ksmode;
static uint8 ksindex;
static uint16 matrix[13][2][4] =
{
{ { AK(4), AK(G), AK(F), AK(C) },
@ -39,55 +57,40 @@ static uint16 matrix[13][2][4]=
{ AK(F9), AK(NUMPAD3), AK(DECIMAL), AK(NUMPAD0) } },
};
static void SuborKB_Write(uint8 v)
{
static void SuborKB_Write(uint8 v) {
v >>= 1;
if(v&2)
{
if (v & 2) {
if ((ksmode & 1) && !(v & 1))
ksindex = (ksindex + 1) % 13;
}
ksmode = v;
}
static uint8 SuborKB_Read(int w, uint8 ret)
{
if(w)
{
static uint8 SuborKB_Read(int w, uint8 ret) {
if (w) {
int x;
ret &= ~0x1E;
// if(ksindex==9)
// {
// if(ksmode&1)
// ret|=2;
// }
// else
// {
for (x = 0; x < 4; x++)
if(bufit[matrix[ksindex][ksmode&1][x]&0xFF]||bufit[matrix[ksindex][ksmode&1][x]>>8])
if (bufit[matrix[ksindex][ksmode & 1][x]])
ret |= 1 << (x + 1);
// }
ret ^= 0x1E;
}
return(ret);
}
static void SuborKB_Strobe(void)
{
static void SuborKB_Strobe(void) {
ksmode = 0;
ksindex = 0;
}
static void SuborKB_Update(void *data, int arg)
{
memcpy(bufit+1,data,0x60);
static void SuborKB_Update(void *data, int arg) {
memcpy(bufit + 1, data, sizeof(bufit) - 1);
}
static INPUTCFC SuborKB = { SuborKB_Read, SuborKB_Write, SuborKB_Strobe, SuborKB_Update, 0, 0 };
INPUTCFC *FCEU_InitSuborKB(void)
{
INPUTCFC *FCEU_InitSuborKB(void) {
memset(bufit, 0, sizeof(bufit));
ksmode = ksindex = 0;
return(&SuborKB);

View File

@ -93,4 +93,10 @@
#define FKB_RIGHT 0x5D
#define FKB_NUMPAD0 0x5E
#define FKB_DECIMAL 0x5F
#define FKB_RSHIFT 0x60
#define FKB_RMENU 0x61
#define FKB_RCONTROL 0x62
#define FKB_BREAK 0x63
#define FKB_RESET 0x64
#define FKB_GRETURN 0x65

View File

@ -596,6 +596,7 @@
<ClCompile Include="..\src\input\mahjong.cpp" />
<ClCompile Include="..\src\input\mouse.cpp" />
<ClCompile Include="..\src\input\oekakids.cpp" />
<ClCompile Include="..\src\input\pec586kb.cpp" />
<ClCompile Include="..\src\input\powerpad.cpp" />
<ClCompile Include="..\src\input\quiz.cpp" />
<ClCompile Include="..\src\input\shadow.cpp" />
@ -963,6 +964,7 @@
<ClInclude Include="..\src\ines-correct.h" />
<ClInclude Include="..\src\ines.h" />
<ClInclude Include="..\src\input.h" />
<ClInclude Include="..\src\input\fkb.h" />
<ClInclude Include="..\src\input\share.h" />
<ClInclude Include="..\src\input\suborkb.h" />
<ClInclude Include="..\src\movie.h" />

View File

@ -958,6 +958,9 @@
<ClCompile Include="..\src\boards\mihunche.cpp">
<Filter>boards</Filter>
</ClCompile>
<ClCompile Include="..\src\input\pec586kb.cpp">
<Filter>input</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\drivers\common\args.h">
@ -1464,6 +1467,9 @@
<ClInclude Include="..\src\utils\ioapi.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="..\src\input\fkb.h">
<Filter>input</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\src\drivers\win\res.rc">