Page 147 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 通常モードに戻る ┃ INDEX ┃ ≪前へ │ 次へ≫ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ▼Super Glove Ball Feather 03/11/15(土) 23:09 ─────────────────────────────────────── ■題名 : Super Glove Ball ■名前 : Feather ■日付 : 03/11/15(土) 23:09 -------------------------------------------------------------------------
Info: Patches VirtuaNES 0.86a for use with the power glove. Usage: LMB catches/releases balls. RMB shoots pellets. Select moves between rooms when a wall is cleared. Start pauses/unpauses. Mouse moves glove along x/y axis. B/A moves glove into/out of screen. Note: "Edit->Advanced->Untabify Selection" used Patch: [NES/PadEX/EXPAD_SuperGloveBall.cpp] ////////////////////////////////////////////////////////////////////////// // Super Glove Ball // // Thanks to sci.virtual-worlds for the power glove information ////////////////////////////////////////////////////////////////////////// void EXPAD_SuperGloveBall::Reset() { latch_reg=0; latch_writes=-1; glove_hires=0; glove_data=0; glove_bits=0; x=0; y=0; z=0; rot=0; fingers=0; keys=0; } void EXPAD_SuperGloveBall::Strobe() { // turn off any joypad interference nes->pad->pad1bit &= ~0xFF; nes->pad->pad2bit &= ~0xFF; nes->pad->pad3bit &= ~0xFF; nes->pad->pad4bit &= ~0xFF; } void EXPAD_SuperGloveBall::Sync() { LONG px,py; // check glove keypads keys = 0xFF; // no keys pressed if( Config.ButtonCheck( 0, 8 ) ) keys = 0x83; // select if( Config.ButtonCheck( 0, 9 ) ) keys = 0x82; // start // handle gestures fingers = 0x00; if( ::GetAsyncKeyState(VK_LBUTTON)&0x8000 ) // fist (11 11 11 11) fingers = 0xFF; else if( ::GetAsyncKeyState(VK_RBUTTON)&0x8000 ) // finger w/ thumb (00 00 11 11) fingers = 0x0F; else fingers = 0x00; // open hand (00 00 00 00) // process coordinates // // y // ^ -z // | / // |/ // -----> x // nes->GetZapperPos( px, py ); x = (px-129)/ 1.8375; y = (py-101)/-1.8375; if( Config.ButtonCheck( 0, 4 ) && z!=0 ) z++; // move out (A) if( Config.ButtonCheck( 0, 5 ) && z!=-16*2 ) z--; // move in (B) // wrist rotation (no effect) rot=0; } BYTE EXPAD_SuperGloveBall::Read4016() { BYTE data_out = 0x00; // send 10-12 byte packets if( glove_hires > 0 ) { // select next data byte if( glove_bits == 0 ) { switch( glove_hires ) { case 1: glove_data = 0xA0; break; // begin packet case 2: glove_data = x; break; // x position case 3: glove_data = y; break; // y position case 4: glove_data = z/2; break; // distance case 5: glove_data = rot; break; // rotation case 6: glove_data = fingers; break; // hand gestures case 7: glove_data = keys; break; // glove keypads case 8: glove_data = 0x00; break; case 9: glove_data = 0x00; break; case 10: glove_data = 0x3F; break; // end packet case 11: glove_data = 0xFF; break; // no data case 12: glove_data = 0xFF; break; // no data } glove_data ^= 0xFF; } // send out MSB first data_out = (glove_data & 0x80) >> 7; glove_data <<= 1; glove_bits++; // advance byte if( glove_bits == 8 ) { // send new packet glove_bits = 0; glove_hires++; #if 1 // speed up reads if( glove_hires == 11 ) { #else // normal packet if( glove_hires == 13 ) { #endif glove_hires = 1; } } } // send data via shift register return data_out; } void EXPAD_SuperGloveBall::Write4016( BYTE data ) { // monitor bytes being sent to the glove latch_reg <<= 1; latch_reg |= data; // start hires mode: 06 C1 08 00 02 FF 01 if( latch_reg == 0x06 && latch_writes == -1 ) { glove_hires = -1; } // prepare to enter hires else if( latch_reg == 0xFF ) { glove_hires = 0; latch_writes = 0; } // count number of latch writes else if( latch_writes >= 0 ) { latch_writes++; // ready to send data (8 code bits + 3 read inits) if( latch_writes == 8+3 ) { glove_hires = 1; glove_bits = 0; latch_writes = -1; } } } void EXPAD_SuperGloveBall::SetSyncData( INT type, LONG data ) { if( type == 0 ) { x = data; } else if( type == 1 ) { y = data; } else if( type == 2 ) { z = ((SBYTE)( data &0x000000FF)); rot = (( BYTE)((data>> 8)&0x000000FF)); fingers = (( BYTE)((data>>16)&0x000000FF)); keys = (BYTE)(data>>24); } else if( type == 3 ) { glove_hires = ((BYTE)( data &0x000000FF)); glove_data = ((BYTE)((data>> 8)&0x000000FF)); glove_bits = ((BYTE)((data>>16)&0x000000FF)); latch_writes = (BYTE)(data>>24); } } LONG EXPAD_SuperGloveBall::GetSyncData( INT type ) { LONG data = 0; if( type == 0 ) { data = x; } else if( type == 1 ) { data = y; } else if( type == 2 ) { data = (z&0xFF)| ((rot&0xFF)<< 8)| ((fingers&0xFF)<<16)| (keys<<24); } else if( type == 3 ) { data = (glove_hires&0xFF)| ((glove_data&0xFF)<< 8)| ((glove_bits&0xFF)<<16)| (latch_writes<<24); } return data; } -------------------------------------------------------- [NES/PadEX/EXPAD_SuperGloveBall.h] ////////////////////////////////////////////////////////////////////////// // Super Glove Ball // ////////////////////////////////////////////////////////////////////////// class EXPAD_SuperGloveBall : public EXPAD { public: EXPAD_SuperGloveBall( NES* parent ) : EXPAD( parent ) {} void Reset(); void Strobe(); BYTE Read4016(); void Write4016( BYTE data ); void Sync(); void SetSyncData( INT type, LONG data ); LONG GetSyncData( INT type ); protected: BYTE latch_reg; SBYTE latch_writes; SBYTE glove_hires; BYTE glove_data; BYTE glove_bits; SBYTE x,y,z; BYTE rot,fingers,keys; private: }; -------------------------------------------------------- [NES/PAD.cpp] (line 173) if( crc == 0xefcf375d ) { // Super Glove Ball (U) SetExController( EXCONTROLLER_SUPERGLOVEBALL ); } (line 244) case EXCONTROLLER_SUPERGLOVEBALL: expad = new EXPAD_SuperGloveBall( nes ); DirectDraw.SetZapperMode( TRUE ); break; |