void pannel_spectra_vs_centrality( string energy = "14.5" ){ gStyle->SetTitleSize( 0.25, "t" ); gStyle->SetTitleX( 0.92 ); Reporter rp( "_tmp.pdf", 1100, 800 ); rp.newPage( 3, 2, 0, 0 ); rp.cd( 1, 1 ); for ( string charge : { "p", "n" } ){ for ( string plc : { "Pi", "K", "P" } ){ if ( "Pi" == plc ){ gPad->SetLeftMargin( 0.19 ); } if ( "n" == charge ){ gPad->SetBottomMargin( 0.19 ); } draw_spectra_vs_centrality( energy, plc, charge ); if ( plc == "P" && charge == "n" ) rp.saveImage( "img/pannel_spectra_" + energy + ".pdf" ); rp.next(); } } }
void ScriptResolver::handleMsg( const QByteArray& msg ) { qDebug() << Q_FUNC_INFO << msg.size() << QString::fromAscii(msg); bool ok; QVariant v = m_parser.parse( msg, &ok ); if( !ok || v.type() != QVariant::Map ) { Q_ASSERT(false); return; } QVariantMap m = v.toMap(); const QString& msgtype = m.value( "_msgtype" ).toString(); if( msgtype == "settings" ) { doSetup( m ); return; } if( msgtype == "results" ) { QList< Tomahawk::result_ptr > results; const QString& qid = m.value( "qid" ).toString(); const QVariantList& reslist = m.value( "results" ).toList(); Tomahawk::collection_ptr coll = SourceList::instance()->getLocal()->collection(); foreach( const QVariant& rv, reslist ) { qDebug() << "RES" << rv; Tomahawk::result_ptr rp( new Tomahawk::Result() ); rp->setCollection( coll ); results << rp; }
void Module::Interface::StopCommunication(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x04, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_NFC, "(STUBBED) called"); }
void SignalRouter::spawn_and_register(StartableSignalReceiver &recv, const sigset_t &mask, const vector<int> &signals) { sigset_t block_mask; int lerror; if (sigfillset(&block_mask)) throw new LoximException(errno); shared_ptr<Receiver> r(new Receiver(recv, mask, signals)); auto_ptr<shared_ptr<Receiver> > rp(new shared_ptr<Receiver>(r)); Mutex::Locker l(r->mutex); { Masker m(block_mask); if ((lerror = pthread_create(&(recv.get_thread()), NULL, SignalRouter::starter, rp.get()))) { throw LoximException(lerror); } } l.wait(r->cond); if (r->error) throw LoximException(r->error); }
void bv_simplifier_params::updt_params(params_ref const & _p) { bv_simplifier_params_helper p(_p); bv_rewriter_params rp(_p); m_hi_div0 = rp.hi_div0(); m_bv2int_distribute = p.bv_bv2int_distribute(); }
void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x13, 1, 2); u32 flags = rp.Pop<u32>(); auto interrupt_event = rp.PopObject<Kernel::Event>(); // TODO(mailwl): return right error code instead assert ASSERT_MSG((interrupt_event != nullptr), "handle is not valid!"); interrupt_event->SetName("GSP_GSP_GPU::interrupt_event"); SessionData* session_data = GetSessionData(ctx.Session()); session_data->interrupt_event = std::move(interrupt_event); session_data->registered = true; IPC::RequestBuilder rb = rp.MakeBuilder(2, 2); if (first_initialization) { // This specific code is required for a successful initialization, rather than 0 first_initialization = false; rb.Push(RESULT_FIRST_INITIALIZATION); } else { rb.Push(RESULT_SUCCESS); } rb.Push(session_data->thread_id); rb.PushCopyObjects(shared_memory); LOG_DEBUG(Service_GSP, "called, flags=0x{:08X}", flags); }
void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x4, 2, 0); u32 reg_addr = rp.Pop<u32>(); u32 input_size = rp.Pop<u32>(); static constexpr u32 MaxReadSize = 0x80; u32 size = std::min(input_size, MaxReadSize); if ((reg_addr % 4) != 0 || reg_addr >= 0x420000) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(ERR_REGS_OUTOFRANGE_OR_MISALIGNED); LOG_ERROR(Service_GSP, "Invalid address 0x{:08x}", reg_addr); return; } // size should be word-aligned if ((size % 4) != 0) { IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(ERR_REGS_MISALIGNED); LOG_ERROR(Service_GSP, "Invalid size 0x{:08x}", size); return; } std::vector<u8> buffer(size); for (u32 offset = 0; offset < size; ++offset) { HW::Read<u8>(buffer[offset], REGS_BEGIN + reg_addr + offset); } IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); rb.PushStaticBuffer(std::move(buffer), 0); }
void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx) { const std::size_t scrambled_friend_code_size = 12; const std::size_t friend_code_size = 8; IPC::RequestParser rp(ctx, 0x1C, 1, 2); const u32 friend_code_count = rp.Pop<u32>(); std::vector<u8> scrambled_friend_codes = rp.PopStaticBuffer(); ASSERT_MSG(scrambled_friend_codes.size() == (friend_code_count * scrambled_friend_code_size), "Wrong input buffer size"); std::vector<u8> unscrambled_friend_codes(friend_code_count * friend_code_size, 0); // TODO(B3N30): Unscramble the codes and compare them against the friend list // Only write 0 if the code isn't in friend list, otherwise write the // unscrambled one // // Code for unscrambling (should be compared to HW): // std::array<u16, 6> scambled_friend_code; // Memory::ReadBlock(scrambled_friend_codes+(current*scrambled_friend_code_size), // scambled_friend_code.data(), scrambled_friend_code_size); std::array<u16, 4> // unscrambled_friend_code; unscrambled_friend_code[0] = scambled_friend_code[0] ^ // scambled_friend_code[5]; unscrambled_friend_code[1] = scambled_friend_code[1] ^ // scambled_friend_code[5]; unscrambled_friend_code[2] = scambled_friend_code[2] ^ // scambled_friend_code[5]; unscrambled_friend_code[3] = scambled_friend_code[3] ^ // scambled_friend_code[5]; LOG_WARNING(Service_FRD, "(STUBBED) called"); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); rb.PushStaticBuffer(unscrambled_friend_codes, 0); }
LRESULT CHistoryWindow::OnViewBBCode(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { TreeItem* item = m_treeView.selectedItem(); if(!item) return 0; CAtlArray<CUrlListItem> items; if(item->level()==0) { CHistorySession* ses = reinterpret_cast<CHistorySession*>(item->userData()); for(int i=0; i<ses->entriesCount(); i++) { CUrlListItem it =fromHistoryItem(ses->entry(i)); items.Add(it); } } else { HistoryItem* hit = reinterpret_cast<HistoryItem*>(item->userData()); CUrlListItem it = fromHistoryItem(*hit); items.Add(it); } CResultsWindow rp( pWizardDlg, items,false); rp.DoModal(m_hWnd); return 0; }
bool KeyToKey::call_remap_with_VK_PSEUDO_KEY(EventType eventType) { bool result = false; // ---------------------------------------- if (eventType == EventType::DOWN) { FlagStatus::globalFlagStatus().lazy_enable(); } else { FlagStatus::globalFlagStatus().lazy_disable_if_off(); } // ---------------------------------------- Params_KeyboardEventCallBack::auto_ptr ptr(Params_KeyboardEventCallBack::alloc(eventType, FlagStatus::globalFlagStatus().makeFlags(), KeyCode::VK_PSEUDO_KEY, CommonData::getcurrent_keyboardType(), false)); if (! ptr) return false; Params_KeyboardEventCallBack& params = *ptr; ParamsUnion paramsUnion(params); RemapParams rp(paramsUnion); result = remap(rp); return result; }
void SpectralStatistics(std::vector<PointSet> &sets, int npoints, Statistics *stats) { // We need the full radial power spectrum, so for performance reasons, we // derive the radial power spectrum directly from full RDFs here const int nsets = (int) sets.size(); const int nbins = 100 * sqrtf(npoints); Curve avgrp(nbins, 0, 0.5f * npoints); Curve rdf(nbins, 0, 0.5f); Curve rp(nbins, 0, 0.5f * npoints); if (nsets > 1) PrintProgress("Stats", 0); for (int i = 0; i < nsets; ++i) { rdf.SetZero(); sets[i].RDF(&rdf); rp.SetZero(); RDFtoRP(rdf, npoints, &rp); avgrp.Accumulate(rp); if (nsets > 1) PrintProgress("Stats", (i+1) / (float) nsets); } avgrp.Divide(sets.size()); if (nsets > 1) std::cout << std::endl; stats->effnyquist = EffectiveNyquist(avgrp, npoints); stats->oscillations = OscillationsMetric(avgrp, npoints); }
BitmapData* BitmapData::diff(const BitmapData* a, const BitmapData* b) { if (a->w != b->w || a->h != b->h) return NULL; BitmapData* result = lmNew(NULL) BitmapData( (size_t)a->w, (size_t)a->h ); if (result == NULL) { lmLogError(gGFXLogGroup, "Unable to allocate memory for BitmapData diff result"); return NULL; } rgba_t* pixelptr_a = reinterpret_cast<rgba_t*>(a->data); rgba_t* pixelptr_b = reinterpret_cast<rgba_t*>(b->data); rgba_t* resultptr = reinterpret_cast<rgba_t*>(result->data); for (size_t i = 0; i < a->w * a->h; i++) { Color ap(convertHostToBEndian(pixelptr_a[i])); Color bp(convertHostToBEndian(pixelptr_b[i])); Color rp(fabsf(ap.r - bp.r), fabsf(ap.g - bp.g), fabsf(ap.b - bp.b), 1.0f); rgba_t a = rp.getHex(); resultptr[i] = convertBEndianToHost(a); } return result; }
void Module::Interface::CommunicationGetStatus(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0F, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); rb.PushEnum(nfc->nfc_status); LOG_DEBUG(Service_NFC, "(STUBBED) called"); }
void Module::Interface::GetTagState(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0D, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); rb.PushEnum(nfc->nfc_tag_state); LOG_DEBUG(Service_NFC, "(STUBBED) called"); }
void Module::Interface::GetTagOutOfRangeEvent(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x0C, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); rb.Push(RESULT_SUCCESS); rb.PushCopyObjects(nfc->tag_out_of_range_event); LOG_WARNING(Service_NFC, "(STUBBED) called"); }
void GSP_GPU::SetBufferSwap(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x5, 8, 0); u32 screen_id = rp.Pop<u32>(); auto fb_info = rp.PopRaw<FrameBufferInfo>(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(GSP::SetBufferSwap(screen_id, fb_info)); }
static void SetDitheringWeightParams(Interface* self) { IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x24, 8, 0); // 0x240200 rp.PopRaw(dithering_weight_params); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); LOG_DEBUG(Service_Y2R, "called"); }
void run() { ReplPair rp( "a", "b" ); rp.setMaster( ReplPair::State_CantArb, "foo" ); ASSERT( rp.state == ReplPair::State_CantArb ); ASSERT_EQUALS( rp.info , "foo" ); rp.setMaster( ReplPair::State_Confused, "foo" ); ASSERT( rp.state == ReplPair::State_Confused ); }
void Module::Interface::GetMyFriendKey(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x5, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(5, 0); rb.Push(RESULT_SUCCESS); rb.PushRaw(frd->my_friend_key); LOG_WARNING(Service_FRD, "(STUBBED) called"); }
void ScriptEngine::resolve( const Tomahawk::query_ptr& query ) { qDebug() << Q_FUNC_INFO << query->toString(); QString eval = QString( "resolve( '%1', '%2', '%3', '%4' );" ) .arg( query->id().replace( "'", "\\'" ) ) .arg( query->artist().replace( "'", "\\'" ) ) .arg( query->album().replace( "'", "\\'" ) ) .arg( query->track().replace( "'", "\\'" ) ); QList< Tomahawk::result_ptr > results; QVariantMap m = mainFrame()->evaluateJavaScript( eval ).toMap(); qDebug() << "JavaScript Result:" << m; const QString qid = query->id(); const QVariantList reslist = m.value( "results" ).toList(); foreach( const QVariant& rv, reslist ) { QVariantMap m = rv.toMap(); qDebug() << "RES" << m; Tomahawk::result_ptr rp( new Tomahawk::Result() ); Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString() ); rp->setArtist( ap ); rp->setAlbum( Tomahawk::Album::get( 0, m.value( "album" ).toString(), ap ) ); rp->setTrack( m.value( "track" ).toString() ); rp->setBitrate( m.value( "bitrate" ).toUInt() ); rp->setUrl( m.value( "url" ).toString() ); rp->setSize( m.value( "size" ).toUInt() ); rp->setScore( m.value( "score" ).toFloat() * ( (float)m_parent->weight() / 100.0 ) ); rp->setRID( uuid() ); rp->setFriendlySource( m_parent->name() ); if ( m.contains( "year" ) ) { QVariantMap attr; attr[ "releaseyear" ] = m.value( "year" ); rp->setAttributes( attr ); } rp->setDuration( m.value( "duration", 0 ).toUInt() ); if ( rp->duration() <= 0 && m.contains( "durationString" ) ) { QTime time = QTime::fromString( m.value( "durationString" ).toString(), "hh:mm:ss" ); rp->setDuration( time.secsTo( QTime( 0, 0 ) ) * -1 ); } rp->setMimetype( m.value( "mimetype" ).toString() ); if ( rp->mimetype().isEmpty() ) { rp->setMimetype( TomahawkUtils::extensionToMimetype( m.value( "extension" ).toString() ) ); Q_ASSERT( !rp->mimetype().isEmpty() ); } results << rp; }
void Module::Interface::LoadAmiiboData(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x07, 0, 0); nfc->nfc_tag_state = TagState::TagDataLoaded; IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_NFC, "(STUBBED) called"); }
void Module::Interface::GetTotalStepCount(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0xC, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); rb.Push<u32>(0); LOG_WARNING(Service_PTM, "(STUBBED) called"); }
void Module::Interface::GetPedometerState(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x9, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); rb.Push(ptm->pedometer_is_counting); LOG_WARNING(Service_PTM, "(STUBBED) called"); }
void Module::Interface::GetBatteryChargeState(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x8, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); rb.Push(ptm->battery_is_charging); LOG_WARNING(Service_PTM, "(STUBBED) called"); }
void Module::Interface::GetBatteryLevel(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x7, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); rb.Push(static_cast<u32>(ChargeLevels::CompletelyFull)); // Set to a completely full battery LOG_WARNING(Service_PTM, "(STUBBED) called"); }
void Module::Interface::GetSoftwareClosedFlag(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x80F, 0, 0); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); rb.Push(RESULT_SUCCESS); rb.Push(false); LOG_WARNING(Service_PTM, "(STUBBED) called"); }
void GSP_GPU::WriteHWRegs(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x1, 2, 2); u32 reg_addr = rp.Pop<u32>(); u32 size = rp.Pop<u32>(); std::vector<u8> src_data = rp.PopStaticBuffer(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(GSP::WriteHWRegs(reg_addr, size, src_data)); }
void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x10, 1, 0); u32 mode = rp.Pop<u32>(); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); LOG_DEBUG(Service_GSP, "(STUBBED) called mode=0x{:08X}", mode); }
void TestResourceManager::koShapeResource() { KPathShape * shape = new KPathShape(); int key = 9001; KResourceManager rp( 0 ); rp.setResource( key, shape ); QVERIFY( shape == rp.koShapeResource( key ) ); }
void Module::Interface::ResetTagScanState(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp(ctx, 0x08, 0, 0); nfc->nfc_tag_state = TagState::NotScanning; IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); rb.Push(RESULT_SUCCESS); LOG_WARNING(Service_NFC, "(STUBBED) called"); }