diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index ef075ee76..5eba45376 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -192,42 +192,64 @@ u16 fadeOutColors[17][0x8000]; // INITIALIZATION /*****************************************************************************/ +static void GPU_InitFadeColors() +{ + /* + NOTE: gbatek (in the reference above) seems to expect 6bit values + per component, but as desmume works with 5bit per component, + we use 31 as top, instead of 63. Testing it on a few games, + using 63 seems to give severe color wraping, and 31 works + nicely, so for now we'll just that, until proven wrong. + + i have seen pics of pokemon ranger getting white with 31, with 63 it is nice. + it could be pb of alpha or blending or... + + MightyMax> created a test NDS to check how the brightness values work, + and 31 seems to be correct. FactorEx is a override for max brighten/darken + See: http://mightymax.org/gfx_test_brightness.nds + The Pokemon Problem could be a problem with 8/32 bit writes not recognized yet, + i'll add that so you can check back. + + */ + + for(int i = 0; i <= 16; i++) + { + for(int j = 0x8000; j < 0x10000; j++) + { + COLOR cur; + + cur.val = j; + cur.bits.red = (cur.bits.red + ((31 - cur.bits.red) * i / 16)); + cur.bits.green = (cur.bits.green + ((31 - cur.bits.green) * i / 16)); + cur.bits.blue = (cur.bits.blue + ((31 - cur.bits.blue) * i / 16)); + fadeInColors[i][j & 0x7FFF] = cur.val; + + cur.val = j; + cur.bits.red = (cur.bits.red - (cur.bits.red * i / 16)); + cur.bits.green = (cur.bits.green - (cur.bits.green * i / 16)); + cur.bits.blue = (cur.bits.blue - (cur.bits.blue * i / 16)); + fadeOutColors[i][j & 0x7FFF] = cur.val; + } + } +} + + + GPU * GPU_Init(u8 l) { - int i, j; + GPU * g; - GPU * g; + if ((g = (GPU *) malloc(sizeof(GPU))) == NULL) + return NULL; - if ((g = (GPU *) malloc(sizeof(GPU))) == NULL) - return NULL; + GPU_Reset(g, l); + GPU_InitFadeColors(); - GPU_Reset(g, l); + g->setFinalColorBck = setFinalBGColorSpecialNone; + g->setFinalColorSpr = setFinalBGColorSpecialNone; + g->setFinalColor3D = setFinal3DColorSpecialNone; - for(i = 0; i <= 16; i++) - { - for(j = 0x8000; j < 0x10000; j++) - { - COLOR cur; - - cur.val = j; - cur.bits.red = (cur.bits.red + ((31 - cur.bits.red) * i / 16)); - cur.bits.green = (cur.bits.green + ((31 - cur.bits.green) * i / 16)); - cur.bits.blue = (cur.bits.blue + ((31 - cur.bits.blue) * i / 16)); - fadeInColors[i][j & 0x7FFF] = cur.val; - - cur.val = j; - cur.bits.red = (cur.bits.red - (cur.bits.red * i / 16)); - cur.bits.green = (cur.bits.green - (cur.bits.green * i / 16)); - cur.bits.blue = (cur.bits.blue - (cur.bits.blue * i / 16)); - fadeOutColors[i][j & 0x7FFF] = cur.val; - } - } - - g->setFinalColorBck = setFinalBGColorSpecialNone; - g->setFinalColorSpr = setFinalBGColorSpecialNone; - g->setFinalColor3D = setFinal3DColorSpecialNone; - - return g; + return g; } void GPU_Reset(GPU *g, u8 l) @@ -2387,50 +2409,8 @@ void GPU_set_DISPCAPCNT(u32 val) gpu->dispCapCnt.capSrc, gpu->dispCapCnt.dst - ARM9Mem.ARM9_LCD, gpu->dispCapCnt.src - ARM9Mem.ARM9_LCD, gpu->dispCapCnt.srcA, gpu->dispCapCnt.srcB);*/ } - -// trade off for speed is 1MB -u16 bright_more_colors[16][0x8000]; -u16 bright_less_colors[16][0x8000]; -BOOL bright_init=FALSE; - -// comment this if want to use formulas instead // #define BRIGHT_TABLES -#ifdef BRIGHT_TABLES -static void calc_bright_colors() { - int base = 31 ; - int factor; - u16 red, green, blue; - COLOR color_more, color_less, color_ref; - -#define FORMULA_MORE(x) x + ((base-x)*factor)/16 -#define FORMULA_LESS(x) x - (x*factor)/16 - - if (bright_init) return; - for (factor=0; factor<16; factor++) - for (red =0; red <32; red++) { - color_ref.bits.red = red; - color_more.bits.red = FORMULA_MORE(red); - color_less.bits.red = FORMULA_LESS(red); - for (green=0; green<32; green++) { - color_ref.bits.green = green; - color_more.bits.green = FORMULA_MORE(green); - color_less.bits.green = FORMULA_LESS(green); - for (blue =0; blue <32; blue++) { - color_ref.bits.blue = blue; - color_more.bits.blue = FORMULA_MORE(blue); - color_less.bits.blue = FORMULA_LESS(blue); - bright_more_colors[factor][color_ref.bitx.bgr] = color_more.val; - bright_less_colors[factor][color_ref.bitx.bgr] = color_less.val; - } - } - } - bright_init=TRUE; - -#undef FORMULA_MORE -#undef FORMULA_LESS -} -#endif static void GPU_ligne_layer(NDS_Screen * screen, u16 l) { @@ -2523,8 +2503,8 @@ static void GPU_ligne_layer(NDS_Screen * screen, u16 l) u16 line3Dcolor[256]; u8 line3Dalpha[256]; - memset(line3Dcolor, 0, sizeof(line3Dcolor)); - memset(line3Dalpha, 0, sizeof(line3Dalpha)); + memset(line3Dcolor, 0, sizeof(line3Dcolor)); + memset(line3Dalpha, 0, sizeof(line3Dalpha)); //determine the 3d range to grab BGxOFS * bgofs = &gpu->dispx_st->dispx_BGxOFS[i16]; s16 hofs = (s16)T1ReadWord((u8 *)&bgofs->BGxHOFS, 0); @@ -2698,17 +2678,11 @@ static void GPU_ligne_DispCapture(u16 l) static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l) { GPU * gpu = screen->gpu; -#ifndef HAVE_LIBGDKGLEXT_X11_1_0 + u8 * dst = GPU_screen + (screen->offset + l) * 512; u16 i16; -#endif + if (!gpu->MasterBrightFactor) return; -#ifndef HAVE_LIBGDKGLEXT_X11_1_0 -// damdoum : -// brightness done with opengl -// test are ok (gfx_test_brightness) -// now, if we are going to support 3D, this becomes dead code -// because it is obvious we'll use openGL / mesa3D #ifdef BRIGHT_TABLES calc_bright_colors(); @@ -2728,36 +2702,11 @@ static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l) // Bright up case 1: { -#if 0 - COLOR dstColor; - unsigned int masterBrightFactor = gpu->MasterBrightFactor; - u16 * colors = bright_more_colors[masterBrightFactor]; -#endif - - /* when we wont do anything, we dont need to loop */ + // when we wont do anything, we dont need to loop if (!(gpu->MasterBrightFactor)) break ; for(i16 = 0; i16 < 256; ++i16) { -#if 0 -#ifndef BRIGHT_TABLES - u8 base ; - u8 r,g,b; // get components, 5bit each - dstColor.val = *((u16 *) (dst + (i16 << 1))); - r = dstColor.bits.red; - g = dstColor.bits.green; - b = dstColor.bits.blue; - // Bright up and clamp to 5bit <-- automatic - base = 31 ; - dstColor.bits.red = r + ((base-r)*masterBrightFactor)/16; - dstColor.bits.green = g + ((base-g)*masterBrightFactor)/16; - dstColor.bits.blue = b + ((base-b)*masterBrightFactor)/16; -#else - dstColor.val = T1ReadWord(dst, i16 << 1); - dstColor.bitx.bgr = colors[dstColor.bitx.bgr]; -#endif - *((u16 *) (dst + (i16 << 1))) = dstColor.val; -#endif ((u16*)dst)[i16] = fadeInColors[gpu->MasterBrightFactor][((u16*)dst)[i16]&0x7FFF]; } break; @@ -2766,51 +2715,11 @@ static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l) // Bright down case 2: { -/* - NOTE: gbatek (in the reference above) seems to expect 6bit values - per component, but as desmume works with 5bit per component, - we use 31 as top, instead of 63. Testing it on a few games, - using 63 seems to give severe color wraping, and 31 works - nicely, so for now we'll just that, until proven wrong. - - i have seen pics of pokemon ranger getting white with 31, with 63 it is nice. - it could be pb of alpha or blending or... - - MightyMax> created a test NDS to check how the brightness values work, - and 31 seems to be correct. FactorEx is a override for max brighten/darken - See: http://mightymax.org/gfx_test_brightness.nds - The Pokemon Problem could be a problem with 8/32 bit writes not recognized yet, - i'll add that so you can check back. - -*/ -#if 0 - COLOR dstColor; - unsigned int masterBrightFactor = gpu->MasterBrightFactor; - u16 * colors = bright_less_colors[masterBrightFactor]; -#endif - - /* when we wont do anything, we dont need to loop */ + // when we wont do anything, we dont need to loop if (!gpu->MasterBrightFactor) break; for(i16 = 0; i16 < 256; ++i16) { -#if 0 -#ifndef BRIGHT_TABLES - u8 r,g,b; - dstColor.val = *((u16 *) (dst + (i16 << 1))); - r = dstColor.bits.red; - g = dstColor.bits.green; - b = dstColor.bits.blue; - // Bright up and clamp to 5bit <- automatic - dstColor.bits.red = r - (r*masterBrightFactor)/16; - dstColor.bits.green = g - (g*masterBrightFactor)/16; - dstColor.bits.blue = b - (b*masterBrightFactor)/16; -#else - dstColor.val = T1ReadWord(dst, i16 << 1); - dstColor.bitx.bgr = colors[dstColor.bitx.bgr]; -#endif - *((u16 *) (dst + (i16 << 1))) = dstColor.val; -#endif ((u16*)dst)[i16] = fadeOutColors[gpu->MasterBrightFactor][((u16*)dst)[i16]&0x7FFF]; } break; @@ -2820,7 +2729,7 @@ static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l) case 3: break; } -#endif + } void GPU_ligne(NDS_Screen * screen, u16 l) diff --git a/desmume/src/windows/inputdx.cpp b/desmume/src/windows/inputdx.cpp index 3166d9772..75a2cce1c 100644 --- a/desmume/src/windows/inputdx.cpp +++ b/desmume/src/windows/inputdx.cpp @@ -33,8 +33,8 @@ // ==================================================== emu input // ======================================================================= -#define IDD_INPUT_TIMER 1000000 - +#define IDD_INPUT_TIMER 1000000 + const char *DIkeysNames[0xEF] = { "N/A", @@ -172,9 +172,9 @@ const char *DIkeysNames[0xEF] = "Web Search", "Web Favorites", "Web Refresh", "Web Stop", "Web Forward", "Web Back", "My Computer", "Mail", "Media Select" // 0xEE -}; -const char *DIJoyNames[0x04] = { "JUp", "JDown", "JLeft", "JRight" }; - +}; +const char *DIJoyNames[0x04] = { "JUp", "JDown", "JLeft", "JRight" }; + #define KEY_A 0 #define KEY_B 1 #define KEY_SELECT 2 @@ -190,115 +190,115 @@ const char *DIJoyNames[0x04] = { "JUp", "JDown", "JLeft", "JRight" }; #define KEY_DEBUG 12 #define KEY_FOLD 13 #define KEY_POWER 14 - - -char *keyPadNames [MAXKEYPAD] = { "A", "B", "SELECT", "START", - "RIGHT", "LEFT", "UP", "DOWN", - "R", "L", "X", "Y", "DEBUG", "FOLD", "POWER" }; - + + +char *keyPadNames [MAXKEYPAD] = { "A", "B", "SELECT", "START", + "RIGHT", "LEFT", "UP", "DOWN", + "R", "L", "X", "Y", "DEBUG", "FOLD", "POWER" }; + u16 keyPadDefs[MAXKEYPAD] = {DIK_X, DIK_Z, DIK_RSHIFT, DIK_RETURN, DIK_RIGHT, DIK_LEFT, DIK_UP, DIK_DOWN, DIK_W, DIK_Q, - DIK_S, DIK_A, 0x00, DIK_BACKSPACE, DIK_PAUSE}; - -const int inputIDs[15]={ IDC_EDIT06, IDC_EDIT05, IDC_EDIT11, IDC_EDIT12, IDC_EDIT03, IDC_EDIT02, IDC_EDIT01, - IDC_EDIT04, IDC_EDIT10, IDC_EDIT09, IDC_EDIT08, IDC_EDIT07, IDC_EDIT14, IDC_EDIT13, - IDC_EDIT15}; - - + DIK_S, DIK_A, 0x00, DIK_BACKSPACE, DIK_PAUSE}; + +const int inputIDs[15]={ IDC_EDIT06, IDC_EDIT05, IDC_EDIT11, IDC_EDIT12, IDC_EDIT03, IDC_EDIT02, IDC_EDIT01, + IDC_EDIT04, IDC_EDIT10, IDC_EDIT09, IDC_EDIT08, IDC_EDIT07, IDC_EDIT14, IDC_EDIT13, + IDC_EDIT15}; + + u16 keyPad[15]; extern INPUTCLASS *input; - -// ==================================================== Config Input -INPUTCLASS *inputCfg = NULL; -HWND g_hWnd = NULL; -static int pressed; -static bool tab; -u16 tempKeyPad[MAXKEYPAD]; - -void InputConfigDIProc(BOOL paused, LPSTR buf) -{ - int t; - int i; - - if (pressed == 0) - { - for (t=0; t<512; t++) - { - if (t == DIK_ESCAPE) continue; - if (t == DIK_TAB) continue; - if (t == DIK_LMENU) continue; - if (t == DIK_F1) continue; - if (t == DIK_F2) continue; - if (t == DIK_F3) continue; - if (t == DIK_F4) continue; - if (t == DIK_F5) continue; - if (t == DIK_F6) continue; - if (t == DIK_F7) continue; - if (t == DIK_F8) continue; - if (t == DIK_F9) continue; - if (t == DIK_F10) continue; - if (t == DIK_F11) continue; - if (t == DIK_F12) continue; - if (t == DIK_NUMLOCK) continue; - - if (buf[t] & 0x80) - { - pressed = t; - break; - } - } - } - else - { - if ((pressed == DIK_LSHIFT) && ((buf[DIK_TAB] & 0x80))) tab = true; - if ((pressed == DIK_RSHIFT) && ((buf[DIK_TAB] & 0x80))) tab = true; - - if (!(buf[pressed] & 0x80)) - { - if (!tab) - { - if (pressed>255) - { - if (pressed>255 && pressed<260) - { - SetWindowText(GetFocus(), DIJoyNames[pressed-256]); - } - else - { - char buf[20]; - memset(buf, 0, sizeof(buf)); - wsprintf(buf, "JB%02i", pressed-259); - SetWindowText(GetFocus(), buf); - } - } - else - { - SetWindowText(GetFocus(), DIkeysNames[pressed]); - } - for (i=0; i255) + { + if (pressed>255 && pressed<260) + { + SetWindowText(GetFocus(), DIJoyNames[pressed-256]); + } + else + { + char buf[20]; + memset(buf, 0, sizeof(buf)); + wsprintf(buf, "JB%02i", pressed-259); + SetWindowText(GetFocus(), buf); + } + } + else + { + SetWindowText(GetFocus(), DIkeysNames[pressed]); + } + for (i=0; i255) { - if (tempKeyPad[i]>255 && tempKeyPad[i]<260) - { - SetWindowText(GetDlgItem(hDlg, inputIDs[i]), DIJoyNames[tempKeyPad[i]-256]); - } - else - { - char buf[20]; - memset(buf, 0, sizeof(buf)); - wsprintf(buf, "JB%02i", tempKeyPad[i]-259); - SetWindowText(GetDlgItem(hDlg, inputIDs[i]), buf); + if (tempKeyPad[i]>255 && tempKeyPad[i]<260) + { + SetWindowText(GetDlgItem(hDlg, inputIDs[i]), DIJoyNames[tempKeyPad[i]-256]); + } + else + { + char buf[20]; + memset(buf, 0, sizeof(buf)); + wsprintf(buf, "JB%02i", tempKeyPad[i]-259); + SetWindowText(GetDlgItem(hDlg, inputIDs[i]), buf); } } else @@ -338,10 +338,10 @@ BOOL CALLBACK InputConfigDlgProc( HWND hDlg, case IDOK: if (GetFocus() == GetDlgItem(hDlg, IDOK)) { - for (int t=0; t255) - { - if (!input->JoystickEnabled()) - { - keyPad[i] = keyPadDefs[i]; - } - } + keyPad[i] = GetPrivateProfileInt("NDS_Input",buf,keyPadDefs[i], IniName); + if (keyPad[i]>255) + { + if (!input->JoystickEnabled()) + { + keyPad[i] = keyPadDefs[i]; + } + } } } -void NDS_inputPost(BOOL paused, LPSTR buf) -{ - if (paused) return; - - bool R = (buf[keyPad[KEY_RIGHT]] & 0x80)!=0; - bool L = (buf[keyPad[KEY_LEFT]] & 0x80)!=0; - bool D = (buf[keyPad[KEY_DOWN]] & 0x80)!=0; - bool U = (buf[keyPad[KEY_UP]] & 0x80)!=0; - bool T = (buf[keyPad[KEY_START]] & 0x80)!=0; - bool S = (buf[keyPad[KEY_SELECT]] & 0x80)!=0; - bool B = (buf[keyPad[KEY_B]] & 0x80)!=0; - bool A = (buf[keyPad[KEY_A]] & 0x80)!=0; - bool Y = (buf[keyPad[KEY_Y]] & 0x80)!=0; - bool X = (buf[keyPad[KEY_X]] & 0x80)!=0; - bool W = (buf[keyPad[KEY_L]] & 0x80)!=0; - bool E = (buf[keyPad[KEY_R]] & 0x80)!=0; - bool G = (buf[keyPad[KEY_DEBUG]] & 0x80)!=0; - bool F = (buf[keyPad[KEY_FOLD]] & 0x80)!=0; - - NDS_setPad( R, L, D, U, T, S, B, A, Y, X, W, E, G, F); +void NDS_inputPost(BOOL paused, LPSTR buf) +{ + if (paused) return; + + bool R = (buf[keyPad[KEY_RIGHT]] & 0x80)!=0; + bool L = (buf[keyPad[KEY_LEFT]] & 0x80)!=0; + bool D = (buf[keyPad[KEY_DOWN]] & 0x80)!=0; + bool U = (buf[keyPad[KEY_UP]] & 0x80)!=0; + bool T = (buf[keyPad[KEY_START]] & 0x80)!=0; + bool S = (buf[keyPad[KEY_SELECT]] & 0x80)!=0; + bool B = (buf[keyPad[KEY_B]] & 0x80)!=0; + bool A = (buf[keyPad[KEY_A]] & 0x80)!=0; + bool Y = (buf[keyPad[KEY_Y]] & 0x80)!=0; + bool X = (buf[keyPad[KEY_X]] & 0x80)!=0; + bool W = (buf[keyPad[KEY_L]] & 0x80)!=0; + bool E = (buf[keyPad[KEY_R]] & 0x80)!=0; + bool G = (buf[keyPad[KEY_DEBUG]] & 0x80)!=0; + bool F = (buf[keyPad[KEY_FOLD]] & 0x80)!=0; + + NDS_setPad( R, L, D, U, T, S, B, A, Y, X, W, E, G, F); } // TODO @@ -491,8 +491,8 @@ BOOL INPUTCLASS::Init(HWND hParentWnd, INPUTPROC inputProc) if (!FAILED(IDirectInput8_CreateDevice(pDI,GUID_Joystick,&pJoystick,NULL))) { - if(!FAILED(IDirectInputDevice8_SetDataFormat(pJoystick,&c_dfDIJoystick2))) - { + if(!FAILED(IDirectInputDevice8_SetDataFormat(pJoystick,&c_dfDIJoystick2))) + { if(FAILED(IDirectInputDevice8_SetCooperativeLevel(pJoystick,hParentWnd,DISCL_FOREGROUND|DISCL_NONEXCLUSIVE))) { IDirectInputDevice8_Release(pJoystick); @@ -500,8 +500,8 @@ BOOL INPUTCLASS::Init(HWND hParentWnd, INPUTPROC inputProc) } else { - memset(&DIJoycap,0,sizeof(DIDEVCAPS)); - DIJoycap.dwSize=sizeof(DIDEVCAPS); + memset(&DIJoycap,0,sizeof(DIDEVCAPS)); + DIJoycap.dwSize=sizeof(DIDEVCAPS); IDirectInputDevice8_GetCapabilities(pJoystick,&DIJoycap); } } @@ -539,7 +539,7 @@ void INPUTCLASS::process() if (pKeyboard) { - hr=IDirectInputDevice8_GetDeviceState(pKeyboard,256,cDIBuf); + hr=IDirectInputDevice8_GetDeviceState(pKeyboard,256,cDIBuf); if (FAILED(hr)) { //LOG("DInput: keyboard acquire\n"); @@ -551,31 +551,31 @@ void INPUTCLASS::process() { DIJOYSTATE2 JoyStatus; - hr=IDirectInputDevice8_Poll(pJoystick); - if (FAILED(hr)) IDirectInputDevice8_Acquire(pJoystick); - else - { - hr=IDirectInputDevice8_GetDeviceState(pJoystick,sizeof(JoyStatus),&JoyStatus); - if (FAILED(hr)) hr=IDirectInputDevice8_Acquire(pJoystick); - else - { - memset(cDIBuf+255,0,sizeof(cDIBuf)-255); - //TODO: analog - //if (JoyStatus.lX<-1) cDIBuf[258]=-128; - //if (JoyStatus.lX>1) cDIBuf[259]=-128; - //if (JoyStatus.lY<-1) cDIBuf[256]=-128; - //if (JoyStatus.lY>1) cDIBuf[257]=-128; - - if (JoyStatus.rgdwPOV[0]==0) cDIBuf[256]=-128; - if (JoyStatus.rgdwPOV[0]==4500) { cDIBuf[256]=-128; cDIBuf[259]=-128;} - if (JoyStatus.rgdwPOV[0]==9000) cDIBuf[259]=-128; - if (JoyStatus.rgdwPOV[0]==13500) { cDIBuf[259]=-128; cDIBuf[257]=-128;} - if (JoyStatus.rgdwPOV[0]==18000) cDIBuf[257]=-128; - if (JoyStatus.rgdwPOV[0]==22500) { cDIBuf[257]=-128; cDIBuf[258]=-128;} - if (JoyStatus.rgdwPOV[0]==27000) cDIBuf[258]=-128; - if (JoyStatus.rgdwPOV[0]==31500) { cDIBuf[258]=-128; cDIBuf[256]=-128;} - memcpy(cDIBuf+260,JoyStatus.rgbButtons,sizeof(JoyStatus.rgbButtons)); - } + hr=IDirectInputDevice8_Poll(pJoystick); + if (FAILED(hr)) IDirectInputDevice8_Acquire(pJoystick); + else + { + hr=IDirectInputDevice8_GetDeviceState(pJoystick,sizeof(JoyStatus),&JoyStatus); + if (FAILED(hr)) hr=IDirectInputDevice8_Acquire(pJoystick); + else + { + memset(cDIBuf+255,0,sizeof(cDIBuf)-255); + //TODO: analog + //if (JoyStatus.lX<-1) cDIBuf[258]=-128; + //if (JoyStatus.lX>1) cDIBuf[259]=-128; + //if (JoyStatus.lY<-1) cDIBuf[256]=-128; + //if (JoyStatus.lY>1) cDIBuf[257]=-128; + + if (JoyStatus.rgdwPOV[0]==0) cDIBuf[256]=-128; + if (JoyStatus.rgdwPOV[0]==4500) { cDIBuf[256]=-128; cDIBuf[259]=-128;} + if (JoyStatus.rgdwPOV[0]==9000) cDIBuf[259]=-128; + if (JoyStatus.rgdwPOV[0]==13500) { cDIBuf[259]=-128; cDIBuf[257]=-128;} + if (JoyStatus.rgdwPOV[0]==18000) cDIBuf[257]=-128; + if (JoyStatus.rgdwPOV[0]==22500) { cDIBuf[257]=-128; cDIBuf[258]=-128;} + if (JoyStatus.rgdwPOV[0]==27000) cDIBuf[258]=-128; + if (JoyStatus.rgdwPOV[0]==31500) { cDIBuf[258]=-128; cDIBuf[256]=-128;} + memcpy(cDIBuf+260,JoyStatus.rgbButtons,sizeof(JoyStatus.rgbButtons)); + } } }