void CCharacterPhysicsSupport:: destroy_animation_collision ( ) { xr_delete( m_physics_shell_animated ); m_physics_shell_animated_time_destroy = u32(-1); }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void CSReporter::testCaseEnded(const Catch::TestCaseStats& in_testCaseStats) noexcept { StreamingReporterBase::testCaseEnded(in_testCaseStats); if (m_currentFailedSections.empty() == false) { m_currentFailedTestCases.push_back(FailedTestCase(in_testCaseStats.testInfo.name, m_sectionsPerTestCaseCount, u32(in_testCaseStats.totals.assertions.total()), m_currentFailedSections)); m_currentFailedSections.clear(); m_sectionsPerTestCaseCount = 0; } }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void CSReporter::sectionEnded(const Catch::SectionStats& in_sectionStats) noexcept { StreamingReporterBase::sectionEnded(in_sectionStats); ++m_sectionsPerTestCaseCount; ++m_totalSectionCount; if (m_currentFailedAssertions.empty() == false) { m_currentFailedSections.push_back(FailedSection(in_sectionStats.sectionInfo.name, u32(in_sectionStats.assertions.total()), m_currentFailedAssertions)); m_currentFailedAssertions.clear(); } }
// return new out_buf else error text std::string new_from_zip(const uint8_t* const in_buf, const size_t in_size, const size_t in_offset, uint8_t** out_buf, size_t* out_size) { // pointer to the output buffer that will be created using new *out_buf = NULL; *out_size = 0; // validate the buffer range if (in_size < in_offset + 30) { // nothing to do return "zip region too small"; } const uint8_t* const b = in_buf + in_offset; const uint32_t compr_size=u32(b+18); const uint32_t uncompr_size=u32(b+22); const uint16_t name_len=u16(b+26); const uint16_t extra_field_len=u16(b+28); // validate name length if (name_len == 0 || name_len > zip_name_len_max) { return "invalid zip metadata"; } // calculate offset to compressed data uint32_t compressed_offset = in_offset + 30 + name_len + extra_field_len; // offset must be inside the buffer if (compressed_offset >= in_size) { return "zip read request outside data range"; } // size of compressed data const uint32_t compressed_size = (compr_size == 0 || compressed_offset + compr_size > in_size) ? in_size - compressed_offset : compr_size; // size of uncompressed data const uint32_t potential_uncompressed_size = (compr_size == 0 || compr_size > uncompressed_size_max) ? uncompressed_size_max : uncompr_size; // skip if uncompressed size is too small if (potential_uncompressed_size < uncompressed_size_min) { return "zip uncompress size too small"; } // create the uncompressed buffer *out_buf = new (std::nothrow) uint8_t[potential_uncompressed_size](); if (*out_buf == NULL) { // comment that the buffer acquisition request failed hashdb::tprint(std::cout, "# bad memory allocation in zip uncompression"); return "bad memory allocation in zip uncompression"; } // set up zlib data z_stream zs; memset(&zs, 0, sizeof(zs)); zs.next_in = const_cast<Bytef *>(reinterpret_cast<const Bytef *>( in_buf + compressed_offset)); zs.avail_in = compressed_size; zs.next_out = *out_buf; zs.avail_out = potential_uncompressed_size; // initialize zlib for this decompression int r = inflateInit2(&zs, -15); if (r == 0) { // inflate inflate(&zs, Z_SYNC_FLUSH); // set out_size *out_size = zs.total_out; // close zlib inflateEnd(&zs); return ""; } else { // inflate failed delete[] *out_buf; *out_buf = NULL; return "zip zlib inflate failed"; } }
u32 CLevel::GetGameDayTimeMS() { return (u32(s64(GetGameTime() % (24*60*60*1000)))); }
void CKinematics::Load(const char* N, IReader *data, u32 dwFlags) { //Msg ("skeleton: %s",N); inherited::Load (N, data, dwFlags); pUserData = NULL; m_lod = NULL; // loading lods IReader* LD = data->open_chunk(OGF_S_LODS); if (LD) { string_path short_name; strcpy_s (short_name,sizeof(short_name),N); if (strext(short_name)) *strext(short_name)=0; // From stream { string_path lod_name; LD->r_string (lod_name, sizeof(lod_name)); //. strconcat (sizeof(name_load),name_load, short_name, ":lod:", lod_name.c_str()); m_lod = (dxRender_Visual*) ::Render->model_CreateChild(lod_name, NULL); if ( CKinematics* lod_kinematics = dynamic_cast<CKinematics*>(m_lod) ) { lod_kinematics->m_is_original_lod = true; } VERIFY3(m_lod,"Cant create LOD model for", N); //. VERIFY2 (m_lod->Type==MT_HIERRARHY || m_lod->Type==MT_PROGRESSIVE || m_lod->Type==MT_NORMAL,lod_name.c_str()); /* strconcat (name_load, short_name, ":lod:1"); m_lod = ::Render->model_CreateChild(name_load,LD); VERIFY (m_lod->Type==MT_SKELETON_GEOMDEF_PM || m_lod->Type==MT_SKELETON_GEOMDEF_ST); */ } LD->close (); } #ifndef _EDITOR // User data IReader* UD = data->open_chunk(OGF_S_USERDATA); pUserData = UD?new CInifile(UD,FS.get_path("$game_config$")->m_Path):0; if (UD) UD->close(); #endif // Globals bone_map_N = new accel(); bone_map_P = new accel(); bones = new vecBones(); bone_instances = NULL; // Load bones #pragma todo("container is created in stack!") xr_vector<shared_str> L_parents; R_ASSERT (data->find_chunk(OGF_S_BONE_NAMES)); visimask.zero (); int dwCount = data->r_u32(); // Msg ("! %d bones",dwCount); // if (dwCount >= 64) Msg ("! More than 64 bones is a crazy thing! (%d), %s",dwCount,N); VERIFY3 (dwCount < 64, "More than 64 bones is a crazy thing!",N); for (; dwCount; dwCount--) { string256 buf; // Bone u16 ID = u16(bones->size()); data->r_stringZ (buf,sizeof(buf)); strlwr(buf); CBoneData* pBone = CreateBoneData(ID); pBone->name = shared_str(buf); pBone->child_faces.resize (children.size()); bones->push_back (pBone); bone_map_N->push_back (mk_pair(pBone->name,ID)); bone_map_P->push_back (mk_pair(pBone->name,ID)); // It's parent data->r_stringZ (buf,sizeof(buf)); strlwr(buf); L_parents.push_back (buf); data->r (&pBone->obb,sizeof(Fobb)); visimask.set (u64(1)<<ID,TRUE); } std::sort (bone_map_N->begin(),bone_map_N->end(),pred_sort_N); std::sort (bone_map_P->begin(),bone_map_P->end(),pred_sort_P); // Attach bones to their parents iRoot = BI_NONE; for (u32 i=0; i<bones->size(); i++) { shared_str P = L_parents[i]; CBoneData* B = (*bones)[i]; if (!P||!P[0]) { // no parent - this is root bone R_ASSERT (BI_NONE==iRoot); iRoot = u16(i); B->SetParentID(BI_NONE); continue; } else { u16 ID = LL_BoneID(P); R_ASSERT (ID!=BI_NONE); (*bones)[ID]->children.push_back(B); B->SetParentID(ID); } } R_ASSERT (BI_NONE != iRoot); // Free parents L_parents.clear(); // IK data IReader* IKD = data->open_chunk(OGF_S_IKDATA); if (IKD){ for (u32 i=0; i<bones->size(); i++) { CBoneData* B = (*bones)[i]; u16 vers = (u16)IKD->r_u32(); IKD->r_stringZ (B->game_mtl_name); IKD->r (&B->shape,sizeof(SBoneShape)); B->IK_data.Import(*IKD,vers); Fvector vXYZ,vT; IKD->r_fvector3 (vXYZ); IKD->r_fvector3 (vT); B->bind_transform.setXYZi(vXYZ); B->bind_transform.translate_over(vT); B->mass = IKD->r_float(); IKD->r_fvector3 (B->center_of_mass); } // calculate model to bone converting matrix (*bones)[LL_GetBoneRoot()]->CalculateM2B(Fidentity); IKD->close(); } // after load process { for (u16 child_idx=0; child_idx<(u16)children.size(); child_idx++) LL_GetChild(child_idx)->AfterLoad (this,child_idx); } // unique bone faces { for (u32 bone_idx=0; bone_idx<bones->size(); bone_idx++) { CBoneData* B = (*bones)[bone_idx]; for (u32 child_idx=0; child_idx<children.size(); child_idx++){ CBoneData::FacesVec faces = B->child_faces[child_idx]; std::sort (faces.begin(),faces.end()); CBoneData::FacesVecIt new_end = std::unique(faces.begin(),faces.end()); faces.erase (new_end,faces.end()); B->child_faces[child_idx].clear_and_free(); B->child_faces[child_idx] = faces; } } } // reset update_callback Update_Callback = NULL; // reset update frame wm_frame = u32(-1); LL_Validate (); }
u32 CInifileEx::r_u32(LPCSTR S, LPCSTR L) { LPCSTR C = r_string(S,L); return u32(atoi(C)); }
int i32(expr* e) { return static_cast<int>(u32(e)); }
void CBaseMonster::debug_fsm() { if (!g_Alive()) return; if (!psAI_Flags.test(aiMonsterDebug)) { DBG().object_info(this,this).clear (); return; } EMonsterState state = StateMan->get_state_type(); string128 st; switch (state) { case eStateRest_WalkGraphPoint: sprintf(st,"Rest :: Walk Graph"); break; case eStateRest_Idle: sprintf(st,"Rest :: Idle"); break; case eStateRest_Fun: sprintf(st,"Rest :: Fun"); break; case eStateRest_Sleep: sprintf(st,"Rest :: Sleep"); break; case eStateRest_MoveToHomePoint: sprintf(st,"Rest :: MoveToHomePoint"); break; case eStateRest_WalkToCover: sprintf(st,"Rest :: WalkToCover"); break; case eStateRest_LookOpenPlace: sprintf(st,"Rest :: LookOpenPlace"); break; case eStateEat_CorpseApproachRun: sprintf(st,"Eat :: Corpse Approach Run"); break; case eStateEat_CorpseApproachWalk: sprintf(st,"Eat :: Corpse Approach Walk"); break; case eStateEat_CheckCorpse: sprintf(st,"Eat :: Check Corpse"); break; case eStateEat_Eat: sprintf(st,"Eat :: Eating"); break; case eStateEat_WalkAway: sprintf(st,"Eat :: Walk Away"); break; case eStateEat_Rest: sprintf(st,"Eat :: Rest After Meal"); break; case eStateEat_Drag: sprintf(st,"Eat :: Drag"); break; case eStateAttack_Run: sprintf(st,"Attack :: Run"); break; case eStateAttack_Melee: sprintf(st,"Attack :: Melee"); break; case eStateAttack_RunAttack: sprintf(st,"Attack :: Run Attack"); break; case eStateAttack_RunAway: sprintf(st,"Attack :: Run Away"); break; case eStateAttack_FindEnemy: sprintf(st,"Attack :: Find Enemy"); break; case eStateAttack_Steal: sprintf(st,"Attack :: Steal"); break; case eStateAttack_AttackHidden: sprintf(st,"Attack :: Attack Hidden"); break; case eStateAttackCamp_Hide: sprintf(st,"Attack Camp:: Hide"); break; case eStateAttackCamp_Camp: sprintf(st,"Attack Camp:: Camp"); break; case eStateAttackCamp_StealOut: sprintf(st,"Attack Camp:: Steal Out"); break; case eStateAttack_HideInCover: sprintf(st,"Attack :: Hide In Cover"); break; case eStateAttack_MoveOut: sprintf(st,"Attack :: Move Out From Cover");break; case eStateAttack_CampInCover: sprintf(st,"Attack :: Camp In Cover"); break; case eStateAttack_Psy: sprintf(st,"Attack :: Psy"); break; case eStateAttack_MoveToHomePoint: sprintf(st,"Attack :: Move To Home Point"); break; case eStateAttack_HomePoint_Hide: sprintf(st,"Attack :: Home Point :: Hide"); break; case eStateAttack_HomePoint_Camp: sprintf(st,"Attack :: Home Point :: Camp"); break; case eStateAttack_HomePoint_LookOpenPlace: sprintf(st,"Attack :: Home Point :: Look Open Place"); break; case eStatePanic_Run: sprintf(st,"Panic :: Run Away"); break; case eStatePanic_FaceUnprotectedArea: sprintf(st,"Panic :: Face Unprotected Area"); break; case eStatePanic_HomePoint_Hide: sprintf(st,"Panic :: Home Point :: Hide"); break; case eStatePanic_HomePoint_LookOpenPlace: sprintf(st,"Panic :: Home Point :: Look Open Place"); break; case eStatePanic_HomePoint_Camp: sprintf(st,"Panic :: Home Point :: Camp"); break; case eStateHitted_Hide: sprintf(st,"Hitted :: Hide"); break; case eStateHitted_MoveOut: sprintf(st,"Hitted :: MoveOut"); break; case eStateHitted_Home: sprintf(st,"Hitted :: Home"); break; case eStateHearDangerousSound_Hide: sprintf(st,"Dangerous Snd :: Hide"); break; case eStateHearDangerousSound_FaceOpenPlace: sprintf(st,"Dangerous Snd :: FaceOpenPlace"); break; case eStateHearDangerousSound_StandScared: sprintf(st,"Dangerous Snd :: StandScared"); break; case eStateHearDangerousSound_Home: sprintf(st,"Dangerous Snd :: Home"); break; case eStateHearInterestingSound_MoveToDest: sprintf(st,"Interesting Snd :: MoveToDest"); break; case eStateHearInterestingSound_LookAround: sprintf(st,"Interesting Snd :: LookAround"); break; case eStateHearHelpSound: sprintf(st,"Hear Help Sound"); break; case eStateHearHelpSound_MoveToDest: sprintf(st,"Hear Help Sound :: MoveToDest"); break; case eStateHearHelpSound_LookAround: sprintf(st,"Hear Help Sound :: LookAround"); break; case eStateControlled_Follow_Wait: sprintf(st,"Controlled :: Follow : Wait"); break; case eStateControlled_Follow_WalkToObject: sprintf(st,"Controlled :: Follow : WalkToObject"); break; case eStateControlled_Attack: sprintf(st,"Controlled :: Attack"); break; case eStateThreaten: sprintf(st,"Threaten :: "); break; case eStateFindEnemy_Run: sprintf(st,"Find Enemy :: Run"); break; case eStateFindEnemy_LookAround_MoveToPoint: sprintf(st,"Find Enemy :: Look Around : Move To Point"); break; case eStateFindEnemy_LookAround_LookAround: sprintf(st,"Find Enemy :: Look Around : Look Around"); break; case eStateFindEnemy_LookAround_TurnToPoint: sprintf(st,"Find Enemy :: Look Around : Turn To Point"); break; case eStateFindEnemy_Angry: sprintf(st,"Find Enemy :: Angry"); break; case eStateFindEnemy_WalkAround: sprintf(st,"Find Enemy :: Walk Around"); break; case eStateSquad_Rest_Idle: sprintf(st,"Squad :: Rest : Idle"); break; case eStateSquad_Rest_WalkAroundLeader: sprintf(st,"Squad :: Rest : WalkAroundLeader"); break; case eStateSquad_RestFollow_Idle: sprintf(st,"Squad :: Follow Leader : Idle"); break; case eStateSquad_RestFollow_WalkToPoint: sprintf(st,"Squad :: Follow Leader : WalkToPoint"); break; case eStateCustom_Vampire: sprintf(st,"Attack :: Vampire"); break; case eStateVampire_ApproachEnemy: sprintf(st,"Vampire :: Approach to enemy"); break; case eStateVampire_Execute: sprintf(st,"Vampire :: Hit"); break; case eStateVampire_RunAway: sprintf(st,"Vampire :: Run Away"); break; case eStateVampire_Hide: sprintf(st,"Vampire :: Hide"); break; case eStatePredator: sprintf(st,"Predator"); break; case eStatePredator_MoveToCover: sprintf(st,"Predator :: MoveToCover"); break; case eStatePredator_LookOpenPlace: sprintf(st,"Predator :: Look Open Place"); break; case eStatePredator_Camp: sprintf(st,"Predator :: Camp"); break; case eStateBurerAttack_Tele: sprintf(st,"Attack :: Telekinesis"); break; case eStateBurerAttack_Gravi: sprintf(st,"Attack :: Gravi Wave"); break; case eStateBurerAttack_RunAround: sprintf(st,"Attack :: Run Around"); break; case eStateBurerAttack_FaceEnemy: sprintf(st,"Attack :: Face Enemy"); break; case eStateBurerAttack_Melee: sprintf(st,"Attack :: Melee"); break; case eStateBurerScanning: sprintf(st,"Attack :: Scanning"); break; case eStateCustomMoveToRestrictor: sprintf(st,"Moving To Restrictor :: Position not accessible"); break; case eStateSmartTerrainTask: sprintf(st,"ALIFE"); break; case eStateSmartTerrainTaskGamePathWalk: sprintf(st,"ALIFE :: Game Path Walk"); break; case eStateSmartTerrainTaskLevelPathWalk: sprintf(st,"ALIFE :: Level Path Walk"); break; case eStateSmartTerrainTaskWaitCapture: sprintf(st,"ALIFE :: Wait till smart terrain will capture me"); break; case eStateUnknown: sprintf(st,"Unknown State :: "); break; default: sprintf(st,"Undefined State ::"); break; } DBG().object_info(this,this).remove_item (u32(0)); DBG().object_info(this,this).remove_item (u32(1)); DBG().object_info(this,this).remove_item (u32(2)); DBG().object_info(this,this).add_item (*cName(), D3DCOLOR_XRGB(255,0,0), 0); DBG().object_info(this,this).add_item (st, D3DCOLOR_XRGB(255,0,0), 1); sprintf(st, "Team[%u]Squad[%u]Group[%u]", g_Team(), g_Squad(), g_Group()); DBG().object_info(this,this).add_item (st, D3DCOLOR_XRGB(255,0,0), 2); CEntityAlive *entity = smart_cast<CEntityAlive *>(Level().CurrentEntity()); if (entity && entity->character_physics_support()->movement()) { sprintf(st,"VELOCITY [%f,%f,%f] Value[%f]",VPUSH(entity->character_physics_support()->movement()->GetVelocity()),entity->character_physics_support()->movement()->GetVelocityActual()); DBG().text(this).clear(); DBG().text(this).add_item(st,200,100,COLOR_GREEN,100); } }
/* * Entered into mmc structure during driver init * * Sends a command out on the bus and deals with the block data. * Takes the mmc pointer, a command pointer, and an optional data pointer. */ static int mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) { atmel_mci_t *mci = (atmel_mci_t *)mmc->priv; u32 cmdr; u32 error_flags = 0; u32 status; if (!initialized) { puts ("MCI not initialized!\n"); return COMM_ERR; } /* Figure out the transfer arguments */ cmdr = mci_encode_cmd(cmd, data, &error_flags); /* For multi blocks read/write, set the block register */ if ((cmd->cmdidx == MMC_CMD_READ_MULTIPLE_BLOCK) || (cmd->cmdidx == MMC_CMD_WRITE_MULTIPLE_BLOCK)) writel(data->blocks | MMCI_BF(BLKLEN, mmc->read_bl_len), &mci->blkr); /* Send the command */ writel(cmd->cmdarg, &mci->argr); writel(cmdr, &mci->cmdr); #ifdef DEBUG dump_cmd(cmdr, cmd->cmdarg, 0, "DEBUG"); #endif /* Wait for the command to complete */ while (!((status = readl(&mci->sr)) & MMCI_BIT(CMDRDY))); if (status & error_flags) { dump_cmd(cmdr, cmd->cmdarg, status, "Command Failed"); return COMM_ERR; } /* Copy the response to the response buffer */ if (cmd->resp_type & MMC_RSP_136) { cmd->response[0] = readl(&mci->rspr); cmd->response[1] = readl(&mci->rspr1); cmd->response[2] = readl(&mci->rspr2); cmd->response[3] = readl(&mci->rspr3); } else cmd->response[0] = readl(&mci->rspr); /* transfer all of the blocks */ if (data) { u32 word_count, block_count; u32* ioptr; u32 sys_blocksize, dummy, i; u32 (*mci_data_op) (atmel_mci_t *mci, u32* data, u32 error_flags); if (data->flags & MMC_DATA_READ) { mci_data_op = mci_data_read; sys_blocksize = mmc->read_bl_len; ioptr = (u32*)data->dest; } else { mci_data_op = mci_data_write; sys_blocksize = mmc->write_bl_len; ioptr = (u32*)data->src; } status = 0; for (block_count = 0; block_count < data->blocks && !status; block_count++) { word_count = 0; do { status = mci_data_op(mci, ioptr, error_flags); word_count++; ioptr++; } while (!status && word_count < (data->blocksize/4)); #ifdef DEBUG if (data->flags & MMC_DATA_READ) { printf("Read Data:\n"); print_buffer(0, data->dest, 1, word_count*4, 0); } #endif #ifdef DEBUG if (!status && word_count < (sys_blocksize / 4)) printf("filling rest of block...\n"); #endif /* fill the rest of a full block */ while (!status && word_count < (sys_blocksize / 4)) { status = mci_data_op(mci, &dummy, error_flags); word_count++; } if (status) { dump_cmd(cmdr, cmd->cmdarg, status, "Data Transfer Failed"); return COMM_ERR; } } /* Wait for Transfer End */ i = 0; do { status = readl(&mci->sr); if (status & error_flags) { dump_cmd(cmdr, cmd->cmdarg, status, "DTIP Wait Failed"); return COMM_ERR; } i++; } while ((status & MMCI_BIT(DTIP)) && i < 10000); if (status & MMCI_BIT(DTIP)) { dump_cmd(cmdr, cmd->cmdarg, status, "XFER DTIP never unset, ignoring"); } } return 0; }
sf::String GUI::Widget::stringFromUtf8(const std::string& s) { std::size_t l = sf::Utf<8>::count(s.begin(), s.end()); std::basic_string<sf::Uint32> u32(l, ' '); sf::Utf<8>::toUtf32(s.begin(), s.end(), u32.begin()); return sf::String(u32); }
u32 CUICaption::findIndexOf(const shared_str& key_) { u32 res = findIndexOf_(key_); R_ASSERT3(res!=u32(-1),"cannot find msg ",*key_); return res; }
#include "stdafx.h" #include "control_manager.h" #include "control_combase.h" #include "BaseMonster/base_monster.h" enum EActiveComAction { eRemove = u32(0), eAdd }; // DEBUG purpose only char *dbg_control_name_table[] = { "Control_Movement", "Control_Path", "Control_Dir", "Control_Animation", "Control_Sequencer", "Control_RotationJump", "Control_Animation_BASE", "Control_Movement_BASE", "Control_Path_BASE", "Control_Dir_BASE" }; CControl_Manager::CControl_Manager(CBaseMonster *obj) { m_object = obj; m_animation = xr_new<CControlAnimation> ();
void CSheduler::ProcessStep () { // Normal priority u32 dwTime = Device.dwTimeGlobal; CTimer eTimer; for (int i=0;!Items.empty() && Top().dwTimeForExecute < dwTime; ++i) { u32 delta_ms = dwTime - Top().dwTimeForExecute; // Update Item T = Top (); #ifdef DEBUG_SCHEDULER Msg ("SCHEDULER: process step [%s][%x][false]",*T.scheduled_name,T.Object); #endif // DEBUG_SCHEDULER u32 Elapsed = dwTime-T.dwTimeOfLastExecute; bool condition; condition = (NULL==T.Object || !T.Object->shedule_Needed()); if (condition) { // Erase element #ifdef DEBUG_SCHEDULER Msg ("SCHEDULER: process unregister [%s][%x][%s]",*T.scheduled_name,T.Object,"false"); #endif // DEBUG_SCHEDULER // if (T.Object) // Msg ("0x%08x UNREGISTERS because shedule_Needed() returned false",T.Object); // else // Msg ("UNREGISTERS unknown object"); Pop (); continue; } // Insert into priority Queue Pop (); // Real update call // Msg ("------- %d:",Device.dwFrame); #ifdef DEBUG T.Object->dbg_startframe = Device.dwFrame; eTimer.Start (); // LPCSTR _obj_name = T.Object->shedule_Name().c_str(); #endif // DEBUG // Calc next update interval u32 dwMin = _max(u32(30),T.Object->shedule.t_min); u32 dwMax = (1000+T.Object->shedule.t_max)/2; float scale = T.Object->shedule_Scale (); u32 dwUpdate = dwMin+iFloor(float(dwMax-dwMin)*scale); clamp (dwUpdate,u32(_max(dwMin,u32(20))),dwMax); m_current_step_obj = T.Object; // try { T.Object->shedule_Update (clampr(Elapsed,u32(1),u32(_max(u32(T.Object->shedule.t_max),u32(1000)))) ); if (!m_current_step_obj) { #ifdef DEBUG_SCHEDULER Msg ("SCHEDULER: process unregister (self unregistering) [%s][%x][%s]",*T.scheduled_name,T.Object,"false"); #endif // DEBUG_SCHEDULER continue; } // } catch (...) { #ifdef DEBUG // Msg ("! xrSheduler: object '%s' raised an exception", _obj_name); // throw ; #endif // DEBUG // } m_current_step_obj = NULL; #ifdef DEBUG // u32 execTime = eTimer.GetElapsed_ms (); #endif // DEBUG // Fill item structure Item TNext; TNext.dwTimeForExecute = dwTime+dwUpdate; TNext.dwTimeOfLastExecute = dwTime; TNext.Object = T.Object; TNext.scheduled_name = T.Object->shedule_Name(); ItemsProcessed.push_back (TNext); #ifdef DEBUG // u32 execTime = eTimer.GetElapsed_ms (); // VERIFY3 (T.Object->dbg_update_shedule == T.Object->dbg_startframe, "Broken sequence of calls to 'shedule_Update'", _obj_name ); if (delta_ms> 3*dwUpdate) { //Msg ("! xrSheduler: failed to shedule object [%s] (%dms)", _obj_name, delta_ms ); } // if (execTime> 15) { // Msg ("* xrSheduler: too much time consumed by object [%s] (%dms)", _obj_name, execTime ); // } #endif // DEBUG // if ((i % 3) != (3 - 1)) continue; if (Device.dwPrecacheFrame==0 && CPU::QPC() > cycles_limit) { // we have maxed out the load - increase heap psShedulerTarget += (psShedulerReaction * 3); break; } } // Push "processed" back while (ItemsProcessed.size()) { Push (ItemsProcessed.back()) ; ItemsProcessed.pop_back () ; } // always try to decrease target psShedulerTarget -= psShedulerReaction; }
void CCustomZone::Load(LPCSTR section) { inherited::Load(section); m_iDisableHitTime = pSettings->r_s32(section, "disable_time"); m_iDisableHitTimeSmall = pSettings->r_s32(section, "disable_time_small"); m_iDisableIdleTime = pSettings->r_s32(section, "disable_idle_time"); m_fHitImpulseScale = pSettings->r_float(section, "hit_impulse_scale"); m_fEffectiveRadius = pSettings->r_float(section, "effective_radius"); m_eHitTypeBlowout = ALife::g_tfString2HitType(pSettings->r_string(section, "hit_type")); m_zone_flags.set(eIgnoreNonAlive, pSettings->r_bool(section, "ignore_nonalive")); m_zone_flags.set(eIgnoreSmall, pSettings->r_bool(section, "ignore_small")); m_zone_flags.set(eIgnoreArtefact, pSettings->r_bool(section, "ignore_artefacts")); //загрузить времена для зоны m_StateTime[eZoneStateIdle] = -1; m_StateTime[eZoneStateAwaking] = pSettings->r_s32(section, "awaking_time"); m_StateTime[eZoneStateBlowout] = pSettings->r_s32(section, "blowout_time"); m_StateTime[eZoneStateAccumulate] = pSettings->r_s32(section, "accamulate_time"); ////////////////////////////////////////////////////////////////////////// ISpatial* self = smart_cast<ISpatial*> (this); if (self) self->spatial.type |= (STYPE_COLLIDEABLE|STYPE_SHAPE); ////////////////////////////////////////////////////////////////////////// LPCSTR sound_str = NULL; if(pSettings->line_exist(section,"idle_sound")) { sound_str = pSettings->r_string(section,"idle_sound"); m_idle_sound.create(sound_str, st_Effect,sg_SourceType); } if(pSettings->line_exist(section,"accum_sound")) { sound_str = pSettings->r_string(section,"accum_sound"); m_accum_sound.create(sound_str, st_Effect,sg_SourceType); } if(pSettings->line_exist(section,"awake_sound")) { sound_str = pSettings->r_string(section,"awake_sound"); m_awaking_sound.create(sound_str, st_Effect,sg_SourceType); } if(pSettings->line_exist(section,"blowout_sound")) { sound_str = pSettings->r_string(section,"blowout_sound"); m_blowout_sound.create(sound_str, st_Effect,sg_SourceType); } if(pSettings->line_exist(section,"hit_sound")) { sound_str = pSettings->r_string(section,"hit_sound"); m_hit_sound.create(sound_str, st_Effect,sg_SourceType); } if(pSettings->line_exist(section,"entrance_sound")) { sound_str = pSettings->r_string(section,"entrance_sound"); m_entrance_sound.create(sound_str, st_Effect,sg_SourceType); } if(pSettings->line_exist(section,"idle_particles")) m_sIdleParticles = pSettings->r_string(section,"idle_particles"); if(pSettings->line_exist(section,"blowout_particles")) m_sBlowoutParticles = pSettings->r_string(section,"blowout_particles"); m_bBlowoutOnce = FALSE; if (pSettings->line_exist(section, "blowout_once")) m_bBlowoutOnce = pSettings->r_bool(section,"blowout_once"); if(pSettings->line_exist(section,"accum_particles")) m_sAccumParticles = pSettings->r_string(section,"accum_particles"); if(pSettings->line_exist(section,"awake_particles")) m_sAwakingParticles = pSettings->r_string(section,"awake_particles"); if(pSettings->line_exist(section,"entrance_small_particles")) m_sEntranceParticlesSmall = pSettings->r_string(section,"entrance_small_particles"); if(pSettings->line_exist(section,"entrance_big_particles")) m_sEntranceParticlesBig = pSettings->r_string(section,"entrance_big_particles"); if(pSettings->line_exist(section,"hit_small_particles")) m_sHitParticlesSmall = pSettings->r_string(section,"hit_small_particles"); if(pSettings->line_exist(section,"hit_big_particles")) m_sHitParticlesBig = pSettings->r_string(section,"hit_big_particles"); if(pSettings->line_exist(section,"idle_small_particles")) m_sIdleObjectParticlesBig = pSettings->r_string(section,"idle_big_particles"); if(pSettings->line_exist(section,"idle_big_particles")) m_sIdleObjectParticlesSmall = pSettings->r_string(section,"idle_small_particles"); if(pSettings->line_exist(section,"idle_particles_dont_stop")) m_zone_flags.set(eIdleObjectParticlesDontStop, pSettings->r_bool(section,"idle_particles_dont_stop")); if(pSettings->line_exist(section,"postprocess")) { m_actor_effector = xr_new<CZoneEffector>(); m_actor_effector->Load (pSettings->r_string(section,"postprocess")); }; if(pSettings->line_exist(section,"bolt_entrance_particles")) { m_sBoltEntranceParticles = pSettings->r_string(section, "bolt_entrance_particles"); m_zone_flags.set (eBoltEntranceParticles, (m_sBoltEntranceParticles.size()!=0)); } if(pSettings->line_exist(section,"blowout_particles_time")) { m_dwBlowoutParticlesTime = pSettings->r_u32(section,"blowout_particles_time"); if (s32(m_dwBlowoutParticlesTime)>m_StateTime[eZoneStateBlowout]) { m_dwBlowoutParticlesTime=m_StateTime[eZoneStateBlowout]; #ifndef MASTER_GOLD Msg("! ERROR: invalid 'blowout_particles_time' in '%s'",section); #endif // #ifndef MASTER_GOLD } } else m_dwBlowoutParticlesTime = 0; if(pSettings->line_exist(section,"blowout_light_time")) { m_dwBlowoutLightTime = pSettings->r_u32(section,"blowout_light_time"); if (s32(m_dwBlowoutLightTime)>m_StateTime[eZoneStateBlowout]) { m_dwBlowoutLightTime=m_StateTime[eZoneStateBlowout]; #ifndef MASTER_GOLD Msg("! ERROR: invalid 'blowout_light_time' in '%s'",section); #endif // #ifndef MASTER_GOLD } } else m_dwBlowoutLightTime = 0; if(pSettings->line_exist(section,"blowout_sound_time")) { m_dwBlowoutSoundTime = pSettings->r_u32(section,"blowout_sound_time"); if (s32(m_dwBlowoutSoundTime)>m_StateTime[eZoneStateBlowout]) { m_dwBlowoutSoundTime=m_StateTime[eZoneStateBlowout]; #ifndef MASTER_GOLD Msg("! ERROR: invalid 'blowout_sound_time' in '%s'",section); #endif // #ifndef MASTER_GOLD } } else m_dwBlowoutSoundTime = 0; if(pSettings->line_exist(section,"blowout_explosion_time")) { m_dwBlowoutExplosionTime = pSettings->r_u32(section,"blowout_explosion_time"); if (s32(m_dwBlowoutExplosionTime)>m_StateTime[eZoneStateBlowout]) { m_dwBlowoutExplosionTime=m_StateTime[eZoneStateBlowout]; #ifndef MASTER_GOLD Msg("! ERROR: invalid 'blowout_explosion_time' in '%s'",section); #endif // #ifndef MASTER_GOLD } } else m_dwBlowoutExplosionTime = 0; m_zone_flags.set(eBlowoutWind, pSettings->r_bool(section,"blowout_wind")); if( m_zone_flags.test(eBlowoutWind) ){ m_dwBlowoutWindTimeStart = pSettings->r_u32(section,"blowout_wind_time_start"); m_dwBlowoutWindTimePeak = pSettings->r_u32(section,"blowout_wind_time_peak"); m_dwBlowoutWindTimeEnd = pSettings->r_u32(section,"blowout_wind_time_end"); R_ASSERT(m_dwBlowoutWindTimeStart < m_dwBlowoutWindTimePeak); R_ASSERT(m_dwBlowoutWindTimePeak < m_dwBlowoutWindTimeEnd); if((s32)m_dwBlowoutWindTimeEnd < m_StateTime[eZoneStateBlowout]){ m_dwBlowoutWindTimeEnd =u32( m_StateTime[eZoneStateBlowout]-1); #ifndef MASTER_GOLD Msg("! ERROR: invalid 'blowout_wind_time_end' in '%s'",section); #endif // #ifndef MASTER_GOLD } m_fBlowoutWindPowerMax = pSettings->r_float(section,"blowout_wind_power"); } //загрузить параметры световой вспышки от взрыва m_zone_flags.set(eBlowoutLight, pSettings->r_bool (section, "blowout_light")); if(m_zone_flags.test(eBlowoutLight) ){ sscanf(pSettings->r_string(section,"light_color"), "%f,%f,%f", &m_LightColor.r, &m_LightColor.g, &m_LightColor.b); m_fLightRange = pSettings->r_float(section,"light_range"); m_fLightTime = pSettings->r_float(section,"light_time"); m_fLightTimeLeft = 0; m_fLightHeight = pSettings->r_float(section,"light_height"); } //загрузить параметры idle подсветки m_zone_flags.set(eIdleLight, pSettings->r_bool (section, "idle_light")); if( m_zone_flags.test(eIdleLight) ) { m_fIdleLightRange = pSettings->r_float(section,"idle_light_range"); LPCSTR light_anim = pSettings->r_string(section,"idle_light_anim"); m_pIdleLAnim = LALib.FindItem(light_anim); m_fIdleLightHeight = pSettings->r_float(section,"idle_light_height"); m_zone_flags.set(eIdleLightVolumetric,pSettings->r_bool (section, "idle_light_volumetric") ); m_zone_flags.set(eIdleLightShadow,pSettings->r_bool (section, "idle_light_shadow") ); m_zone_flags.set(eIdleLightR1,pSettings->r_bool (section, "idle_light_r1") ); } bool use = !!READ_IF_EXISTS(pSettings, r_bool, section, "use_secondary_hit", false); m_zone_flags.set(eUseSecondaryHit, use); if(use) m_fSecondaryHitPower = pSettings->r_float(section,"secondary_hit_power"); m_ef_anomaly_type = pSettings->r_u32(section,"ef_anomaly_type"); m_ef_weapon_type = pSettings->r_u32(section,"ef_weapon_type"); m_zone_flags.set (eAffectPickDOF, pSettings->r_bool (section, "pick_dof_effector")); }
void debug_view_disasm::view_update() { const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); offs_t pc = source.device()->safe_pcbase(); offs_t pcbyte = source.m_space.address_to_byte(pc) & source.m_space.logbytemask(); // update our context; if the expression is dirty, recompute if (m_expression.dirty()) m_recompute = true; // if we're tracking a value, make sure it is visible u64 previous = m_expression.last_value(); u64 result = m_expression.value(); if (result != previous) { offs_t resultbyte = source.m_space.address_to_byte(result) & source.m_space.logbytemask(); // see if the new result is an address we already have u32 row; for (row = 0; row < m_byteaddress.size(); row++) if (m_byteaddress[row] == resultbyte) break; // if we didn't find it, or if it's really close to the bottom, recompute if (row == m_byteaddress.size() || row >= m_total.y - m_visible.y) m_recompute = true; // otherwise, if it's not visible, adjust the view so it is else if (row < m_topleft.y || row >= m_topleft.y + m_visible.y - 2) m_topleft.y = (row > 3) ? row - 3 : 0; } // if the opcode base has changed, rework things if (source.m_decrypted_space.direct().ptr() != m_last_direct_decrypted || source.m_space.direct().ptr() != m_last_direct_raw) m_recompute = true; // if the comments have changed, redo it if (m_last_change_count != source.device()->debug()->comment_change_count()) m_recompute = true; // if we need to recompute, do it bool recomputed_this_time = false; recompute: if (m_recompute) { // recompute the view if (!m_byteaddress.empty() && m_last_change_count != source.device()->debug()->comment_change_count()) { // smoosh us against the left column, but not the top row m_topleft.x = 0; // recompute from where we last recomputed! recompute(source.m_space.byte_to_address(m_byteaddress[0]), 0, m_total.y); } else { // determine the addresses of what we will display offs_t backpc = find_pc_backwards(u32(m_expression.value()), m_backwards_steps); // put ourselves back in the top left m_topleft.y = 0; m_topleft.x = 0; recompute(backpc, 0, m_total.y); } recomputed_this_time = true; } // figure out the row where the PC is and recompute the disassembly if (pcbyte != m_last_pcbyte) { // find the row with the PC on it for (u32 row = 0; row < m_visible.y; row++) { u32 effrow = m_topleft.y + row; if (effrow >= m_byteaddress.size()) break; if (pcbyte == m_byteaddress[effrow]) { // see if we changed bool changed = recompute(pc, effrow, 1); if (changed && !recomputed_this_time) { m_recompute = true; goto recompute; } // set the effective row and PC m_cursor.y = effrow; view_notify(VIEW_NOTIFY_CURSOR_CHANGED); } } m_last_pcbyte = pcbyte; } // loop over visible rows debug_view_char *dest = &m_viewdata[0]; for (u32 row = 0; row < m_visible.y; row++) { u32 effrow = m_topleft.y + row; u32 col = 0; // if this visible row is valid, add it to the buffer u8 attrib = DCA_NORMAL; if (effrow < m_byteaddress.size()) { // if we're on the line with the PC, recompute and hilight it if (pcbyte == m_byteaddress[effrow]) attrib = DCA_CURRENT; // if we're on a line with a breakpoint, tag it changed else { for (device_debug::breakpoint *bp = source.device()->debug()->breakpoint_first(); bp != nullptr; bp = bp->next()) if (m_byteaddress[effrow] == (source.m_space.address_to_byte(bp->address()) & source.m_space.logbytemask())) attrib = DCA_CHANGED; } // if we're on the active column and everything is couth, highlight it if (m_cursor_visible && effrow == m_cursor.y) attrib |= DCA_SELECTED; // if we've visited this pc, mark it as such if (source.device()->debug()->track_pc_visited(m_byteaddress[effrow])) attrib |= DCA_VISITED; // get the effective string const char *data = &m_dasm.vec()[effrow * m_total.x]; u32 len = u32(strlen(data)); // copy data u32 effcol = m_topleft.x; while (col < m_visible.x && effcol < len) { dest->byte = data[effcol++]; dest->attrib = (effcol <= m_divider1 || effcol >= m_divider2) ? (attrib | DCA_ANCILLARY) : attrib; // comments are just green for now - maybe they shouldn't even be this? if (effcol >= m_divider2 && m_right_column == DASM_RIGHTCOL_COMMENTS) attrib |= DCA_COMMENT; dest++; col++; } } // fill the rest with blanks while (col < m_visible.x) { dest->byte = ' '; dest->attrib = (effrow < m_total.y) ? (attrib | DCA_ANCILLARY) : attrib; dest++; col++; } } }
static eflt(uint8_t *p, uint8_t i) { mix uf; uf.u = u32(p,i); return uf.f; }
void Compress (LPCSTR path, LPCSTR base, BOOL bFast) { filesTOTAL ++; if (testSKIP(path)) { filesSKIP ++; printf (" - a SKIP"); Msg ("%-80s - SKIP",path); return; } string_path fn; strconcat (sizeof(fn),fn,base,"\\",path); if (::GetFileAttributes(fn)==u32(-1)) { filesSKIP ++; printf (" - CAN'T OPEN"); Msg ("%-80s - CAN'T OPEN",path); return; } IReader* src = FS.r_open (fn); if (0==src) { filesSKIP ++; printf (" - CAN'T OPEN"); Msg ("%-80s - CAN'T OPEN",path); return; } bytesSRC += src->length (); u32 c_crc32 = crc32 (src->pointer(),src->length()); u32 c_ptr = 0; u32 c_size_real = 0; u32 c_size_compressed = 0; u32 a_tests = 0; ALIAS* A = testALIAS (src,c_crc32,a_tests); printf ("%3da ",a_tests); if (A) { filesALIAS ++; printf ("ALIAS"); Msg ("%-80s - ALIAS (%s)",path,A->path); // Alias found c_ptr = A->c_ptr; c_size_real = A->c_size_real; c_size_compressed = A->c_size_compressed; } else { if (testVFS(path)) { filesVFS ++; // Write into BaseFS c_ptr = fs->tell (); c_size_real = src->length(); c_size_compressed = src->length(); fs->w (src->pointer(),c_size_real); printf ("VFS"); Msg ("%-80s - VFS",path); } else { // Compress into BaseFS c_ptr = fs->tell(); c_size_real = src->length(); if (0!=c_size_real) { u32 c_size_max = rtc_csize (src->length()); u8* c_data = xr_alloc<u8> (c_size_max); t_compress.Begin (); { // c_size_compressed = rtc_compress (c_data,c_size_max,src->pointer(),c_size_real); c_size_compressed = c_size_max; if (bFast){ R_ASSERT(LZO_E_OK == lzo1x_1_compress ((u8*)src->pointer(),c_size_real,c_data,&c_size_compressed,c_heap)); }else{ R_ASSERT(LZO_E_OK == lzo1x_999_compress ((u8*)src->pointer(),c_size_real,c_data,&c_size_compressed,c_heap)); } } t_compress.End (); if ((c_size_compressed+16) >= c_size_real) { // Failed to compress - revert to VFS filesVFS ++; c_size_compressed = c_size_real; fs->w (src->pointer(),c_size_real); printf ("VFS (R)"); Msg ("%-80s - VFS (R)",path); } else { // Compressed OK - optimize if (!bFast){ u8* c_out = xr_alloc<u8> (c_size_real); u32 c_orig = c_size_real; R_ASSERT (LZO_E_OK == lzo1x_optimize (c_data,c_size_compressed,c_out,&c_orig, NULL)); R_ASSERT (c_orig == c_size_real ); xr_free (c_out); } fs->w (c_data,c_size_compressed); printf ("%3.1f%%", 100.f*float(c_size_compressed)/float(src->length())); Msg ("%-80s - OK (%3.1f%%)",path,100.f*float(c_size_compressed)/float(src->length())); } // cleanup xr_free (c_data); }else { filesVFS ++; c_size_compressed = c_size_real; // fs->w (src->pointer(),c_size_real); printf ("VFS (R)"); Msg ("%-80s - EMPTY",path); } } } // Write description write_file_header (path,c_crc32,c_ptr,c_size_real,c_size_compressed); if (0==A) { // Register for future aliasing ALIAS R; R.path = xr_strdup (fn); R.crc = c_crc32; R.c_ptr = c_ptr; R.c_size_real = c_size_real; R.c_size_compressed = c_size_compressed; aliases.insert (mk_pair(R.c_size_real,R)); } FS.r_close (src); }
arx_noreturn void CrashHandlerWindows::handleCrash(int crashType, void * crashExtraInfo, int fpeCode) { Autolock autoLock(&m_Lock); // Run the callbacks for(std::vector<CrashHandler::CrashCallback>::iterator it = m_crashCallbacks.begin(); it != m_crashCallbacks.end(); ++it) { (*it)(); } m_pCrashInfo->signal = crashType; m_pCrashInfo->code = fpeCode; PEXCEPTION_POINTERS pointers = reinterpret_cast<PEXCEPTION_POINTERS>(crashExtraInfo); // Copy CONTEXT to crash info structure PCONTEXT context = reinterpret_cast<PCONTEXT>(m_pCrashInfo->contextRecord); ARX_STATIC_ASSERT(sizeof(m_pCrashInfo->contextRecord) >= sizeof(*context), "buffer too small"); memset(context, 0, sizeof(*context)); EXCEPTION_POINTERS fakePointers; EXCEPTION_RECORD exception; if(pointers) { u32 code = m_pCrashInfo->exceptionCode = pointers->ExceptionRecord->ExceptionCode; m_pCrashInfo->address = u64(pointers->ExceptionRecord->ExceptionAddress); m_pCrashInfo->hasAddress = true; if(code == EXCEPTION_ACCESS_VIOLATION || code == EXCEPTION_IN_PAGE_ERROR) { m_pCrashInfo->memory = pointers->ExceptionRecord->ExceptionInformation[1]; m_pCrashInfo->hasMemory = true; } #if ARX_ARCH == ARX_ARCH_X86 m_pCrashInfo->stack = pointers->ContextRecord->Esp; m_pCrashInfo->hasStack = true; m_pCrashInfo->frame = pointers->ContextRecord->Ebp; m_pCrashInfo->hasFrame = true; #elif ARX_ARCH == ARX_ARCH_X86_64 m_pCrashInfo->stack = pointers->ContextRecord->Rsp; m_pCrashInfo->hasStack = true; #endif std::memcpy(context, pointers->ContextRecord, sizeof(*context)); } else { RtlCaptureContext(context); std::memset(&exception, 0, sizeof(exception)); fakePointers.ContextRecord = context; fakePointers.ExceptionRecord = &exception; pointers = &fakePointers; } // Get current thread id m_pCrashInfo->threadId = u32(GetCurrentThreadId()); writeCrashDump(pointers); // Try to spawn a sub-process to process the crash info STARTUPINFO si; memset(&si, 0, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); PROCESS_INFORMATION pi; memset(&pi, 0, sizeof(PROCESS_INFORMATION)); BOOL created = CreateProcessW(m_exe, m_args.data(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); if(created) { while(true) { if(m_pCrashInfo->exitLock.try_wait()) { break; } if(WaitForSingleObject(pi.hProcess, 100) != WAIT_TIMEOUT) { break; } } TerminateProcess(GetCurrentProcess(), 1); unregisterCrashHandlers(); std::abort(); } // Fallback: process the crash info in-process unregisterCrashHandlers(); processCrash(); std::abort(); }
int __cdecl main (int argc, char* argv[]) { g_temporary_stuff = &trivial_encryptor::decode; g_dummy_stuff = &trivial_encryptor::encode; Core._initialize("xrCompress",0,FALSE); printf ("\n\n"); LPCSTR params = GetCommandLine(); #ifndef MOD_COMPRESS if(strstr(params,"-store")) { bStoreFiles = TRUE; }; { LPCSTR temp = strstr(params,"-max_size"); if (temp) { u64 test = u64(1024*1024)*u64(atoi(temp+9)); if (u64(test) >= u64(u32(1) << 31)) printf ("! too large max_size (%I64u), restoring previous (%I64u)\n",test,u64(XRP_MAX_SIZE)); else XRP_MAX_SIZE = u32(test); }; } #else bStoreFiles = TRUE; #endif #ifndef MOD_COMPRESS if(strstr(params,"-diff")) { ProcessDifference (); }else #endif { #ifndef MOD_COMPRESS if (argc<2) { printf("ERROR: u must pass folder name as parameter.\n"); printf("-diff /? option to get information about creating difference.\n"); printf("-fast - fast compression.\n"); printf("-store - store files. No compression.\n"); printf("-ltx <file_name.ltx> - pathes to compress.\n"); printf("\n"); printf("LTX format:\n"); printf(" [config]\n"); printf(" ;<path> = <recurse>\n"); printf(" .\\ = false\n"); printf(" textures = true\n"); Core._destroy(); return 3; } #endif string_path folder; strconcat (sizeof(folder),folder,argv[1],"\\"); _strlwr_s (folder,sizeof(folder)); printf ("\nCompressing files (%s)...\n\n",folder); FS._initialize (CLocatorAPI::flTargetFolderOnly|CLocatorAPI::flScanAppRoot,folder); BOOL bFast = 0!=strstr(params,"-fast"); LPCSTR p = strstr(params,"-ltx"); #ifndef MOD_COMPRESS if(0!=p) { ProcessLTX (argv[1],p+4,bFast); }else{ ProcessNormal (argv[1],bFast); } #else R_ASSERT2 (p, "wrong params passed. -ltx option needed"); ProcessLTX (argv[1],p+4,bFast); #endif } Core._destroy (); return 0; }
static int dm365_enable_clock(enum vpss_clock_sel clock_sel, int en) { unsigned long flags; u32 utemp, mask = 0x1, shift = 0, offset = DM365_ISP5_PCCR; u32 (*read)(u32 offset) = isp5_read; void(*write)(u32 val, u32 offset) = isp5_write; switch (clock_sel) { case VPSS_BL_CLOCK: break; case VPSS_CCDC_CLOCK: shift = 1; break; case VPSS_H3A_CLOCK: shift = 2; break; case VPSS_RSZ_CLOCK: shift = 3; break; case VPSS_IPIPE_CLOCK: shift = 4; break; case VPSS_IPIPEIF_CLOCK: shift = 5; break; case VPSS_PCLK_INTERNAL: shift = 6; break; case VPSS_PSYNC_CLOCK_SEL: shift = 7; break; case VPSS_VPBE_CLOCK: read = vpss_regr; write = vpss_regw; offset = DM365_VPBE_CLK_CTRL; break; case VPSS_VENC_CLOCK_SEL: shift = 2; read = vpss_regr; write = vpss_regw; offset = DM365_VPBE_CLK_CTRL; break; case VPSS_LDC_CLOCK: shift = 3; read = vpss_regr; write = vpss_regw; offset = DM365_VPBE_CLK_CTRL; break; case VPSS_FDIF_CLOCK: shift = 4; read = vpss_regr; write = vpss_regw; offset = DM365_VPBE_CLK_CTRL; break; case VPSS_OSD_CLOCK_SEL: shift = 6; read = vpss_regr; write = vpss_regw; offset = DM365_VPBE_CLK_CTRL; break; case VPSS_LDC_CLOCK_SEL: shift = 7; read = vpss_regr; write = vpss_regw; offset = DM365_VPBE_CLK_CTRL; break; default: printk(KERN_ERR "dm365_enable_clock: Invalid selector: %d\n", clock_sel); return -1; } spin_lock_irqsave(&oper_cfg.vpss_lock, flags); utemp = read(offset); if (!en) { mask = ~mask; utemp &= (mask << shift); } else utemp |= (mask << shift); write(utemp, offset); spin_unlock_irqrestore(&oper_cfg.vpss_lock, flags); return 0; }
void CSceneNodeAnimatorCameraFPS::animateNode(ISceneNode* node, u32 timeMs) { if (!node || node->getType() != ESNT_CAMERA) return; ICameraSceneNode* camera = static_cast<ICameraSceneNode*>(node); if (firstUpdate) { camera->updateAbsolutePosition(); if (CursorControl && camera) { CursorControl->setPosition(0.5f, 0.5f); CursorPos = CenterCursor = CursorControl->getRelativePosition(); } LastAnimationTime = timeMs; firstUpdate = false; } // If the camera isn't the active camera, and receiving input, then don't process it. if(!camera->isInputReceiverEnabled()) return; scene::ISceneManager * smgr = camera->getSceneManager(); if(smgr && smgr->getActiveCamera() != camera) return; // get time f32 timeDiff = (f32) ( timeMs - LastAnimationTime ); LastAnimationTime = timeMs; // update position core::vector3df pos = camera->getPosition(); // Update rotation core::vector3df target = (camera->getTarget() - camera->getAbsolutePosition()); core::vector3df relativeRotation = target.getHorizontalAngle(); if (CursorControl) { if (CursorPos != CenterCursor) { relativeRotation.Y -= (0.5f - CursorPos.X) * RotateSpeed; relativeRotation.X -= (0.5f - CursorPos.Y) * RotateSpeed * MouseYDirection; // X < MaxVerticalAngle or X > 360-MaxVerticalAngle if (relativeRotation.X > MaxVerticalAngle*2 && relativeRotation.X < 360.0f-MaxVerticalAngle) { relativeRotation.X = 360.0f-MaxVerticalAngle; } else if (relativeRotation.X > MaxVerticalAngle && relativeRotation.X < 360.0f-MaxVerticalAngle) { relativeRotation.X = MaxVerticalAngle; } // Do the fix as normal, special case below // reset cursor position to the centre of the window. CursorControl->setPosition(0.5f, 0.5f); CenterCursor = CursorControl->getRelativePosition(); // needed to avoid problems when the event receiver is disabled CursorPos = CenterCursor; } // Special case, mouse is whipped outside of window before it can update. video::IVideoDriver* driver = smgr->getVideoDriver(); core::vector2d<u32> mousepos(u32(CursorControl->getPosition().X), u32(CursorControl->getPosition().Y)); core::rect<u32> screenRect(0, 0, driver->getScreenSize().Width, driver->getScreenSize().Height); // Only if we are moving outside quickly. bool reset = !screenRect.isPointInside(mousepos); if(reset) { // Force a reset. CursorControl->setPosition(0.5f, 0.5f); CenterCursor = CursorControl->getRelativePosition(); CursorPos = CenterCursor; } } // set target target.set(0,0, core::max_(1.f, pos.getLength())); core::vector3df movedir = target; core::matrix4 mat; mat.setRotationDegrees(core::vector3df(relativeRotation.X, relativeRotation.Y, 0)); mat.transformVect(target); if (NoVerticalMovement) { mat.setRotationDegrees(core::vector3df(0, relativeRotation.Y, 0)); mat.transformVect(movedir); } else { movedir = target; } movedir.normalize(); if (CursorKeys[EKA_MOVE_FORWARD]) pos += movedir * timeDiff * MoveSpeed; if (CursorKeys[EKA_MOVE_BACKWARD]) pos -= movedir * timeDiff * MoveSpeed; // strafing core::vector3df strafevect = target; strafevect = strafevect.crossProduct(camera->getUpVector()); if (NoVerticalMovement) strafevect.Y = 0.0f; strafevect.normalize(); if (CursorKeys[EKA_STRAFE_LEFT]) pos += strafevect * timeDiff * MoveSpeed; if (CursorKeys[EKA_STRAFE_RIGHT]) pos -= strafevect * timeDiff * MoveSpeed; // For jumping, we find the collision response animator attached to our camera // and if it's not falling, we tell it to jump. if (CursorKeys[EKA_JUMP_UP]) { const ISceneNodeAnimatorList& animators = camera->getAnimators(); ISceneNodeAnimatorList::ConstIterator it = animators.begin(); while(it != animators.end()) { if(ESNAT_COLLISION_RESPONSE == (*it)->getType()) { ISceneNodeAnimatorCollisionResponse * collisionResponse = static_cast<ISceneNodeAnimatorCollisionResponse *>(*it); if(!collisionResponse->isFalling()) collisionResponse->jump(JumpSpeed); } it++; } } // write translation camera->setPosition(pos); // write right target target += pos; camera->setTarget(target); }
u32 CGameObject::ef_detector_type () const { string16 temp; CLSID2TEXT(CLS_ID,temp); R_ASSERT3 (false,"Invalid detector type request, virtual function is not properly overridden!",temp); return (u32(-1)); }
double Index::getScaledValue(PointBuffer& data, Dimension const& d, std::size_t pointIndex) const { double output(0.0); float flt(0.0); boost::int8_t i8(0); boost::uint8_t u8(0); boost::int16_t i16(0); boost::uint16_t u16(0); boost::int32_t i32(0); boost::uint32_t u32(0); boost::int64_t i64(0); boost::uint64_t u64(0); boost::uint32_t size = d.getByteSize(); switch (d.getInterpretation()) { case dimension::Float: if (size == 4) { flt = data.getField<float>(d, pointIndex); output = static_cast<double>(flt); } if (size == 8) { output = data.getField<double>(d, pointIndex); } break; case dimension::SignedInteger: case dimension::SignedByte: if (size == 1) { i8 = data.getField<boost::int8_t>(d, pointIndex); output = d.applyScaling<boost::int8_t>(i8); } if (size == 2) { i16 = data.getField<boost::int16_t>(d, pointIndex); output = d.applyScaling<boost::int16_t>(i16); } if (size == 4) { i32 = data.getField<boost::int32_t>(d, pointIndex); output = d.applyScaling<boost::int32_t>(i32); } if (size == 8) { i64 = data.getField<boost::int64_t>(d, pointIndex); output = d.applyScaling<boost::int64_t>(i64); } break; case dimension::UnsignedInteger: case dimension::UnsignedByte: if (size == 1) { u8 = data.getField<boost::uint8_t>(d, pointIndex); output = d.applyScaling<boost::uint8_t>(u8); } if (size == 2) { u16 = data.getField<boost::uint16_t>(d, pointIndex); output = d.applyScaling<boost::uint16_t>(u16); } if (size == 4) { u32 = data.getField<boost::uint32_t>(d, pointIndex); output = d.applyScaling<boost::uint32_t>(u32); } if (size == 8) { u64 = data.getField<boost::uint64_t>(d, pointIndex); output = d.applyScaling<boost::uint64_t>(u64); } break; case dimension::Pointer: // stored as 64 bits, even on a 32-bit box case dimension::Undefined: throw pdal_error("Dimension data type unable to be reprojected"); } return output; }
CLevel::CLevel():IPureClient (Device.GetTimerGlobal()) #ifdef PROFILE_CRITICAL_SECTIONS ,DemoCS(MUTEX_PROFILE_ID(DemoCS)) #endif // PROFILE_CRITICAL_SECTIONS { g_bDebugEvents = strstr(Core.Params,"-debug_ge")?TRUE:FALSE; Server = NULL; game = NULL; // game = xr_new<game_cl_GameState>(); game_events = xr_new<NET_Queue_Event>(); spawn_events = xr_new<NET_Queue_Event>(); game_configured = FALSE; m_bGameConfigStarted = FALSE; eChangeRP = Engine.Event.Handler_Attach ("LEVEL:ChangeRP",this); eDemoPlay = Engine.Event.Handler_Attach ("LEVEL:PlayDEMO",this); eChangeTrack = Engine.Event.Handler_Attach ("LEVEL:PlayMusic",this); eEnvironment = Engine.Event.Handler_Attach ("LEVEL:Environment",this); eEntitySpawn = Engine.Event.Handler_Attach ("LEVEL:spawn",this); m_pBulletManager = xr_new<CBulletManager>(); if(!g_dedicated_server) m_map_manager = xr_new<CMapManager>(); else m_map_manager = NULL; // m_pFogOfWarMngr = xr_new<CFogOfWarMngr>(); //---------------------------------------------------- m_bNeed_CrPr = false; m_bIn_CrPr = false; m_dwNumSteps = 0; m_dwDeltaUpdate = u32(fixed_step*1000); m_dwLastNetUpdateTime = 0; physics_step_time_callback = (PhysicsStepTimeCallback*) &PhisStepsCallback; m_seniority_hierarchy_holder= xr_new<CSeniorityHierarchyHolder>(); if(!g_dedicated_server) { m_level_sound_manager = xr_new<CLevelSoundManager>(); m_space_restriction_manager = xr_new<CSpaceRestrictionManager>(); m_client_spawn_manager = xr_new<CClientSpawnManager>(); m_autosave_manager = xr_new<CAutosaveManager>(); #ifdef DEBUG m_debug_renderer = xr_new<CDebugRenderer>(); m_level_debug = xr_new<CLevelDebug>(); #endif }else { m_level_sound_manager = NULL; m_client_spawn_manager = NULL; m_autosave_manager = NULL; m_space_restriction_manager = NULL; #ifdef DEBUG m_debug_renderer = NULL; m_level_debug = NULL; #endif } m_ph_commander = xr_new<CPHCommander>(); m_ph_commander_scripts = xr_new<CPHCommander>(); #ifdef DEBUG m_bSynchronization = false; #endif //--------------------------------------------------------- pStatGraphR = NULL; pStatGraphS = NULL; //--------------------------------------------------------- pObjects4CrPr.clear(); pActors4CrPr.clear(); //--------------------------------------------------------- pCurrentControlEntity = NULL; //--------------------------------------------------------- m_dwCL_PingLastSendTime = 0; m_dwCL_PingDeltaSend = 1000; m_dwRealPing = 0; //--------------------------------------------------------- m_sDemoName[0] = 0; m_bDemoSaveMode = FALSE; m_dwStoredDemoDataSize = 0; m_pStoredDemoData = NULL; m_pOldCrashHandler = NULL; m_we_used_old_crach_handler = false; // if ( !strstr( Core.Params, "-tdemo " ) && !strstr(Core.Params,"-tdemof ")) // { // Demo_PrepareToStore(); // }; //--------------------------------------------------------- // m_bDemoPlayMode = FALSE; // m_aDemoData.clear(); // m_bDemoStarted = FALSE; Msg("%s", Core.Params); /* if (strstr(Core.Params,"-tdemo ") || strstr(Core.Params,"-tdemof ")) { string1024 f_name; if (strstr(Core.Params,"-tdemo ")) { sscanf (strstr(Core.Params,"-tdemo ")+7,"%[^ ] ",f_name); m_bDemoPlayByFrame = FALSE; Demo_Load (f_name); } else { sscanf (strstr(Core.Params,"-tdemof ")+8,"%[^ ] ",f_name); m_bDemoPlayByFrame = TRUE; m_lDemoOfs = 0; Demo_Load_toFrame(f_name, 100, m_lDemoOfs); }; } */ //--------------------------------------------------------- }
u32 CCustomZone::ef_weapon_type() const { VERIFY (m_ef_weapon_type != u32(-1)); return (m_ef_weapon_type); }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ bool CSReporter::assertionEnded(const Catch::AssertionStats& in_assertionStats) noexcept { const Catch::AssertionResult& assertionResult = in_assertionStats.assertionResult; if (isOk(assertionResult.getResultType()) == false) { m_currentFailedAssertions.push_back(FailedAssertion(assertionResult.getSourceInfo().file, u32(assertionResult.getSourceInfo().line), assertionResult.getExpression())); } return true; }
BOOL CCustomZone::net_Spawn(CSE_Abstract* DC) { if (!inherited::net_Spawn(DC)) return (FALSE); CSE_Abstract *e = (CSE_Abstract*)(DC); CSE_ALifeCustomZone *Z = smart_cast<CSE_ALifeCustomZone*>(e); VERIFY (Z); m_fMaxPower = pSettings->r_float(cNameSect(),"max_start_power"); m_fAttenuation = pSettings->r_float(cNameSect(),"attenuation"); m_owner_id = Z->m_owner_id; if(m_owner_id != u32(-1)) m_ttl = Device.dwTimeGlobal + 40000;// 40 sec else m_ttl = u32(-1); m_TimeToDisable = Z->m_disabled_time*1000; m_TimeToEnable = Z->m_enabled_time*1000; m_TimeShift = Z->m_start_time_shift*1000; m_StartTime = Device.dwTimeGlobal; m_zone_flags.set (eUseOnOffTime, (m_TimeToDisable!=0)&&(m_TimeToEnable!=0) ); //добавить источники света bool br1 = (0==psDeviceFlags.test(rsR2|rsR3)); bool render_ver_allowed = !br1 || (br1&&m_zone_flags.test(eIdleLightR1)) ; if ( m_zone_flags.test(eIdleLight) && render_ver_allowed) { m_pIdleLight = ::Render->light_create(); m_pIdleLight->set_shadow(!!m_zone_flags.test(eIdleLightShadow)); if(m_zone_flags.test(eIdleLightVolumetric)) { //m_pIdleLight->set_type (IRender_Light::SPOT); m_pIdleLight->set_volumetric (true); } } else m_pIdleLight = NULL; if ( m_zone_flags.test(eBlowoutLight) ) { m_pLight = ::Render->light_create(); m_pLight->set_shadow(true); }else m_pLight = NULL; setEnabled (TRUE); PlayIdleParticles (); m_iPreviousStateTime = m_iStateTime = 0; m_dwLastTimeMoved = Device.dwTimeGlobal; m_vPrevPos.set (Position()); if(spawn_ini() && spawn_ini()->line_exist("fast_mode","always_fast")) { m_zone_flags.set(eAlwaysFastmode, spawn_ini()->r_bool("fast_mode","always_fast")); } return (TRUE); }
void CRender::LoadSectors(IReader* fs) { // allocate memory for portals u32 size = fs->find_chunk(fsL_PORTALS); R_ASSERT(0==size%sizeof(b_portal)); u32 count = size/sizeof(b_portal); Portals.resize (count); for (u32 c=0; c<count; c++) Portals[c] = xr_new<CPortal> (); // load sectors IReader* S = fs->open_chunk(fsL_SECTORS); for (u32 i=0; ; i++) { IReader* P = S->open_chunk(i); if (0==P) break; CSector* __S = xr_new<CSector> (); __S->load (*P); Sectors.push_back (__S); P->close(); } S->close(); // load portals if (count) { CDB::Collector CL; fs->find_chunk (fsL_PORTALS); for (u32 i=0; i<count; i++) { b_portal P; fs->r (&P,sizeof(P)); CPortal* __P = (CPortal*)Portals[i]; __P->Setup (P.vertices.begin(),P.vertices.size(), (CSector*)getSector(P.sector_front), (CSector*)getSector(P.sector_back)); for (u32 j=2; j<P.vertices.size(); j++) CL.add_face_packed_D( P.vertices[0],P.vertices[j-1],P.vertices[j], u32(i) ); } if (CL.getTS()<2) { Fvector v1,v2,v3; v1.set (-20000.f,-20000.f,-20000.f); v2.set (-20001.f,-20001.f,-20001.f); v3.set (-20002.f,-20002.f,-20002.f); CL.add_face_packed_D (v1,v2,v3,0); } // build portal model rmPortals = xr_new<CDB::MODEL> (); rmPortals->build (CL.getV(),int(CL.getVS()),CL.getT(),int(CL.getTS())); } else { rmPortals = 0; } // debug // for (int d=0; d<Sectors.size(); d++) // Sectors[d]->DebugDump (); pLastSector = 0; }
//! //! Update the value part. //! void StringPair::setV(unsigned int v) { U32 u32(v); v_ = u32.toString(); }