void MDFN_VSUniInstallRWHooks(void) { assert(NESIsVSUni); if(secptr) SetReadHandler(0x5e00,0x5e01,VSSecRead); if(curppu == RC2C05_04) { OldReadPPU = GetReadHandler(0x2002); SetReadHandler(0x2002, 0x2002, A2002_Topgun); } else if(curppu == RC2C05_03) { OldReadPPU = GetReadHandler(0x2002); SetReadHandler(0x2002, 0x2002, A2002_Gumshoe); } else if(curppu == RC2C05_02) { OldReadPPU = GetReadHandler(0x2002); SetReadHandler(0x2002, 0x2002, A2002_MBJ); } if(curppu == RC2C05_04 || curppu == RC2C05_01 || curppu == RC2C05_03 || curppu == RC2C05_02) { OldWritePPU[0] = GetWriteHandler(0x2000); OldWritePPU[1] = GetWriteHandler(0x2001); SetWriteHandler(0x2000, 0x2001, B2000_2001_2C05); } if(curmd5 == 0x2d396247cf58f9faLL) /* Super Xevious */ { SetReadHandler(0x5400,0x57FF,XevRead); } }
void FCEU_VSUniPower(void) { coinon = 0; VSindex = 0; if(secptr) SetReadHandler(0x5e00,0x5e01,VSSecRead); if(curppu == RC2C05_04) { OldReadPPU = GetReadHandler(0x2002); SetReadHandler(0x2002, 0x2002, A2002_Topgun); } else if(curppu == RC2C05_03) { OldReadPPU = GetReadHandler(0x2002); SetReadHandler(0x2002, 0x2002, A2002_Gumshoe); } else if(curppu == RC2C05_02) { OldReadPPU = GetReadHandler(0x2002); SetReadHandler(0x2002, 0x2002, A2002_MBJ); } if(curppu == RC2C05_04 || curppu == RC2C05_01 || curppu == RC2C05_03 || curppu == RC2C05_02) { OldWritePPU[0] = GetWriteHandler(0x2000); OldWritePPU[1] = GetWriteHandler(0x2001); SetWriteHandler(0x2000, 0x2001, B2000_2001_2C05); } if(curmd5 == 0x2d396247cf58f9faLL) /* Super Xevious */ { SetReadHandler(0x5400,0x57FF,XevRead); } }
void Socket::ReadData() { if (buffer_.Free() < 1) { BB_ERROR_LOG("socket[%d] read buffer is full????", GetId()); Close(); return; } auto self = shared_from_this(); async_read_some(boost::asio::buffer(buffer_.Tail(), buffer_.Free()), [this, self](const boost::system::error_code& ec, std::size_t rd) { if (ec) { BB_ERROR_LOG("socket[%d] read data ec:%s", GetId(), ec.message().c_str()); Close(); return; } buffer_.Skip(rd, bamboo::buffer::SkipType::WRITE); auto& handler = GetReadHandler(); if (handler) { std::size_t read = handler(buffer_.Head(), buffer_.Size()); buffer_.Skip(read, bamboo::buffer::SkipType::READ); } else { buffer_.Skip(rd, bamboo::buffer::SkipType::READ); } ReadData(); }); }