コード例 #1
0
ファイル: axxpacimp.c プロジェクト: TimofonicJunkRoom/plucker
/* stores the table of offsets for all records of the current file for
   faster access.  */
static void LoadOffsets(axxPacFD fd)
{
    MemPtr mp;

    /* assumption: there is just one file being read */
    ASSERT_MSG("AIM6", currFileDesc == -1);

    axxPacSeek(LibRef, fd, 76, SEEK_SET);
    axxPacRead(LibRef, fd, &nrec, 2);
    moff = MemHandleNew(nrec * 8L);
    ASSERT_MSG("AIM3", moff != 0);

    mp = MemHandleLock(moff);
    ASSERT_MSG("AIM4", mp != 0);

    axxPacSeek(LibRef, fd, 78, SEEK_SET);
    axxPacRead(LibRef, fd, mp, nrec * 8L);
    MemHandleUnlock(moff);
    currFileDesc = fd;
    nrec--;
}
コード例 #2
0
ファイル: vertex_loader.cpp プロジェクト: FenrisulfrX/citra
void VertexLoader::Setup(const PipelineRegs& regs) {
    ASSERT_MSG(!is_setup, "VertexLoader is not intended to be setup more than once.");

    const auto& attribute_config = regs.vertex_attributes;
    num_total_attributes = attribute_config.GetNumTotalAttributes();

    boost::fill(vertex_attribute_sources, 0xdeadbeef);

    for (int i = 0; i < 16; i++) {
        vertex_attribute_is_default[i] = attribute_config.IsDefaultAttribute(i);
    }

    // Setup attribute data from loaders
    for (int loader = 0; loader < 12; ++loader) {
        const auto& loader_config = attribute_config.attribute_loaders[loader];

        u32 offset = 0;

        // TODO: What happens if a loader overwrites a previous one's data?
        for (unsigned component = 0; component < loader_config.component_count; ++component) {
            if (component >= 12) {
                LOG_ERROR(HW_GPU,
                          "Overflow in the vertex attribute loader %u trying to load component %u",
                          loader, component);
                continue;
            }

            u32 attribute_index = loader_config.GetComponent(component);
            if (attribute_index < 12) {
                offset = Common::AlignUp(offset,
                                         attribute_config.GetElementSizeInBytes(attribute_index));
                vertex_attribute_sources[attribute_index] = loader_config.data_offset + offset;
                vertex_attribute_strides[attribute_index] =
                    static_cast<u32>(loader_config.byte_count);
                vertex_attribute_formats[attribute_index] =
                    attribute_config.GetFormat(attribute_index);
                vertex_attribute_elements[attribute_index] =
                    attribute_config.GetNumElements(attribute_index);
                offset += attribute_config.GetStride(attribute_index);
            } else if (attribute_index < 16) {
                // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings,
                // respectively
                offset = Common::AlignUp(offset, 4);
                offset += (attribute_index - 11) * 4;
            } else {
                UNREACHABLE(); // This is truly unreachable due to the number of bits for each
                               // component
            }
        }
    }

    is_setup = true;
}
コード例 #3
0
void DX9VertexShader::setVec4( const char* paramName, const D3DXVECTOR4& vec )
{
   if ( m_activeConstantsTable )
   {
      D3DXHANDLE hConstant = m_activeConstantsTable->GetConstantByName( NULL, paramName );
      if ( hConstant )
      {
         HRESULT res = m_activeConstantsTable->SetVector( m_d3Device, hConstant, &vec );
         ASSERT_MSG( SUCCEEDED( res ), translateDxError( "setVec4", res ).c_str() );
      }
   }
}
コード例 #4
0
ファイル: Quadtree.cpp プロジェクト: MelkorOJ/wssd_cech
const Quadtree<T,D>* Quadtree<T,D>::FindLeafNode(const vec<T,D>* p) const
{
	if(IsLeaf())
    {
        ASSERT(ContainsPoint(p));
        return this;
    }
    
    Orthant<D> orthant = GetOrthant(p);
    ASSERT_MSG(children[orthant] != NULL, "The point does not appear in a leaf node in the quadtree.\n");
    return children[orthant]->FindLeafNode(p);    
}
コード例 #5
0
void DX9VertexShader::setMtxArray( const char* paramName, const D3DXMATRIX* matrices, unsigned int size )
{
   if ( m_activeConstantsTable )
   {
      D3DXHANDLE hConstant = m_activeConstantsTable->GetConstantByName( NULL, paramName );
      if ( hConstant )
      {
         HRESULT res = m_activeConstantsTable->SetMatrixArray( m_d3Device, hConstant, matrices, size );
         ASSERT_MSG( SUCCEEDED( res ), translateDxError( "setMtxArray", res ).c_str() );
      }
   }
}
コード例 #6
0
ファイル: linalg_dense.c プロジェクト: jackd/FVMPor
void mtx_init( Tmtx_ptr A, int nrows, int ncols )
{
	if( A->init )
		mtx_free( A );
	
	A->init = 1;
	A->nrows = nrows;
	A->ncols = ncols;
	A->dat = (double *)calloc( nrows*ncols, sizeof(double) );
	A->tau = NULL;		// This is only allocated by least squares routines
	ASSERT_MSG( A->dat!=NULL, "mtx_init() : unable calloc memory for dense matrix" );
}
コード例 #7
0
ファイル: Quadtree.cpp プロジェクト: MelkorOJ/wssd_cech
Orthant<D> Quadtree<T,D>::GetOrthant(const vec<T,D>* p) const
{
    ASSERT_MSG(ContainsPoint(p), "The node does not contain the point for which we try to find the orthant.\n");

    Orthant<D> orthant;
    for(int d=0; d<D; ++d)
    {
        orthant.Set(d, minPoint[d] + (sideLength/T(2)) < (*p)[d]);
    }

    return orthant;
}
コード例 #8
0
ファイル: dsp_dsp.cpp プロジェクト: DaMan69/citra
/**
 * DSP_DSP::WriteProcessPipe service function
 *  Inputs:
 *      1 : Pipe Number
 *      2 : Size
 *      3 : (size << 14) | 0x402
 *      4 : Buffer
 *  Outputs:
 *      0 : Return header
 *      1 : Result of function, 0 on success, otherwise error code
 */
static void WriteProcessPipe(Service::Interface* self) {
    u32* cmd_buff = Kernel::GetCommandBuffer();

    u32 pipe_index = cmd_buff[1];
    u32 size = cmd_buff[2];
    u32 buffer = cmd_buff[4];

    AudioCore::DspPipe pipe = static_cast<AudioCore::DspPipe>(pipe_index);

    if (IPC::StaticBufferDesc(size, 1) != cmd_buff[3]) {
        LOG_ERROR(Service_DSP,
                  "IPC static buffer descriptor failed validation (0x%X). pipe=%u, "
                  "size=0x%X, buffer=0x%08X",
                  cmd_buff[3], pipe_index, size, buffer);
        cmd_buff[0] = IPC::MakeHeader(0, 1, 0);
        cmd_buff[1] = IPC::ERR_INVALID_BUFFER_DESCRIPTOR.raw;
        return;
    }

    ASSERT_MSG(Memory::IsValidVirtualAddress(buffer),
               "Invalid Buffer: pipe={}, size={:#X}, buffer={:#010X}", pipe_index, size, buffer);

    std::vector<u8> message(size);
    for (u32 i = 0; i < size; i++) {
        message[i] = Memory::Read8(buffer + i);
    }

    // This behaviour was confirmed by RE.
    // The likely reason for this is that games tend to pass in garbage at these bytes
    // because they read random bytes off the stack.
    switch (pipe) {
    case AudioCore::DspPipe::Audio:
        ASSERT(message.size() >= 4);
        message[2] = 0;
        message[3] = 0;
        break;
    case AudioCore::DspPipe::Binary:
        ASSERT(message.size() >= 8);
        message[4] = 1;
        message[5] = 0;
        message[6] = 0;
        message[7] = 0;
        break;
    }

    Core::DSP().PipeWrite(pipe, message);

    cmd_buff[0] = IPC::MakeHeader(0xD, 1, 0);
    cmd_buff[1] = RESULT_SUCCESS.raw; // No error

    LOG_DEBUG(Service_DSP, "pipe=%u, size=0x%X, buffer=0x%08X", pipe_index, size, buffer);
}
コード例 #9
0
ファイル: core_timing.cpp プロジェクト: DaMan69/citra
EventType* RegisterEvent(const std::string& name, TimedCallback callback) {
    // check for existing type with same name.
    // we want event type names to remain unique so that we can use them for serialization.
    ASSERT_MSG(event_types.find(name) == event_types.end(),
               "CoreTiming Event \"{}\" is already registered. Events should only be registered "
               "during Init to avoid breaking save states.",
               name);

    auto info = event_types.emplace(name, EventType{callback, nullptr});
    EventType* event_type = &info.first->second;
    event_type->name = &info.first->first;
    return event_type;
}
コード例 #10
0
ファイル: interpreter.c プロジェクト: CZ-NIC/turris-updater
static void command_postfork(void *data) {
	struct lua_command_data *lcd = data;
	struct lua_State *L = lcd->L;
	ASSERT(L);
	// This would be called from within the lua_run_command, no need to allocate more stack
	if (lcd->postfork_callback) {
		int handler = push_err_handler(L);
		extract_registry_value(L, lcd->postfork_callback);
		int result = lua_pcall(L, 0, 0, handler);
		ASSERT_MSG(!result, "%s", interpreter_error_result(L));
	}
	// We don't worry about freeing memory here. We're going to exec just in a while.
}
コード例 #11
0
ファイル: mpirun_ckpt.c プロジェクト: hpc/mvapich2-cce
int CR_thread_start( unsigned int n )
{
    nspawns = n;

    if ( m_state_get() == M_RESTART ) {
        ASSERT_MSG( restart_version >= 0, "Internal error" );
    }

#ifndef CR_FTB
    // This must be called before mpispawn are started
    // Do not move this to CR_Loop()
    if (USE_LINEAR_SSH) {
        if (!show_on) {
            int rv = create_connections();
            if ( rv != 0 ) {
                return -1;
            }
        }
    }
#endif

    struct timeval starting;
    gettimeofday(&starting, NULL);
    starting_time = last_ckpt = starting.tv_sec;

    // Check and set CR state
    CR_state_lock();
    ASSERT_MSG( cr_state == CR_INIT || cr_state == CR_STOPPED, "Internal Error\n");
    CR_state_transition_nolock( CR_INIT );
    CR_state_unlock();

    if (pthread_create(&cr_tid, NULL, CR_Loop, NULL) < 0) {
        PRINT_ERROR_ERRNO("pthread_create() failed", errno);
        cr_tid = 0;
        return -1;
    }

    return 0;
}
コード例 #12
0
ファイル: dsp_dsp.cpp プロジェクト: DaMan69/citra
/**
 * DSP_DSP::RecvDataIsReady service function
 *      This function checks whether a DSP register is ready to be read.
 *  Inputs:
 *      1 : Register Number
 *  Outputs:
 *      1 : Result of function, 0 on success, otherwise error code
 *      2 : non-zero == ready
 *  Note:
 *      This function has only been observed being called with a register number of 0.
 */
static void RecvDataIsReady(Service::Interface* self) {
    u32* cmd_buff = Kernel::GetCommandBuffer();

    u32 register_number = cmd_buff[1];

    ASSERT_MSG(register_number == 0, "Unknown register_number {}", register_number);

    cmd_buff[0] = IPC::MakeHeader(0x2, 2, 0);
    cmd_buff[1] = RESULT_SUCCESS.raw;
    cmd_buff[2] = 1; // Ready to read

    LOG_DEBUG(Service_DSP, "register_number=%u", register_number);
}
コード例 #13
0
ファイル: heap.c プロジェクト: skarpenko/phlox
void *kmalloc_pages(size_t npages)
{
    void *p;

    p = kmalloc(npages * PAGE_SIZE);
    if (!p)
        return NULL;

    /* check page alignment in debug kernels */
    ASSERT_MSG(!((addr_t)p % PAGE_SIZE), "allocated memory is not page aligned!\n");

    return p;
}
コード例 #14
0
ファイル: Sound3D.cpp プロジェクト: dabroz/Tamy
void Sound3D::assignChannel(SoundDevice& device)
{
   if (m_channel != NULL)
   {
      ASSERT_MSG( false, "The 3d sound already has a channel assigned");
      return;
   }

   m_channel = &(device.activateSound(m_sound));
   onChannelAssigned(*m_channel);
   m_channel->setLooped(m_looped);
   m_channel->play();
}
コード例 #15
0
ファイル: sarray_reader.hpp プロジェクト: Bhushan1002/SFrame
 /**
  * Returns the type of the SArray (as set by 
  * \ref swriter<flexible_type>::set_type). If the type of the SArray was
  * not set, this returns \ref flex_type_enum::UNDEFINED, in which case
  * each row can be of arbitrary type.
  *
  * This function should only be used for sarray<flexible_type> and
  * will fail fatally otherwise.
  */
 flex_type_enum get_type() const {
   if (!std::is_same<T, flexible_type>::value) {
     ASSERT_MSG(false, 
                 "Use of get_type() in SArray which "
                 "does not contain flexible_types");
   }
   ASSERT_NE(reader, NULL);
   const index_file_information& index_info = reader->get_index_info();
   if (index_info.metadata.count("__type__")) {
     return flex_type_enum::UNDEFINED;
   }
   return flex_type_enum(std::stoi(index_info.metadata.at("__type__")));
 }
コード例 #16
0
ファイル: process.c プロジェクト: skarpenko/phlox
/* create user process */
process_t *proc_create_user_process(const char *name, process_t *parent,
    vm_address_space_t *aspace, const char *args, uint role)
{
    process_t *proc;

    ASSERT_MSG(name != NULL && strlen(name) <= SYS_MAX_OS_NAME_LEN,
        "proc_create_user_process: user process name is invalid!\n");

    /* check args */
    if(aspace == NULL || role > PROCESS_ROLES_COUNT)
        return NULL;

    /* create process struct */
    proc = create_process_common(name, args);
    if(!proc)
        return INVALID_PROCESSID;

    /* init struct fields */
    proc->aspace = vm_inc_aspace_refcnt(aspace);
    if(!proc->aspace)
        goto error_exit;
    if(parent) {
        proc->parent = proc_inc_refcnt(parent);
        if(!proc->parent)
            goto error_exit;
    }
    proc->aid = proc->aspace->id;
    proc->process_role = role;
    proc->def_prio = process_roles_props[proc->process_role].def_prio;
    proc->def_sched_policy.raw =
        process_roles_props[proc->process_role].def_sched_policy.raw;
    atomic_set((atomic_t*)&proc->ref_count, 1); /* already has one ref owned by caller */

    /* init arch-dependend part */
    if(arch_init_process_struct(proc) != NO_ERROR)
        goto error_exit;

    /* add to processes list */
    put_process_to_list(proc);

    return proc; /* return to caller */

/* exit on errors */
error_exit:
    if(proc->aspace) vm_put_aspace(proc->aspace);
    if(proc->parent) proc_put_process(proc->parent);

    destroy_process_common(proc);

    return NULL;
}
コード例 #17
0
void MainEditorPanel::saveLayout( QSettings& outSettings )
{
   char tmpEditorGroupStr[32];

   outSettings.beginGroup( "MainEditorPanel/activeEditors" );

   // first - serialize the active project's path, if there's one
   Project* activeProject = TamyEditor::getInstance().getActiveProject();
   if ( activeProject )
   {
      FilePath projectPath = activeProject->getFilePath();
      outSettings.setValue( "activeProjectPath", QString( projectPath.c_str() ) );
   }
   
   // if there's an active project, serialize the active editors ( editors may work only in the project scope )
   if ( activeProject )
   {
      std::vector< ResourceEditor* > editors;
      std::vector< TabLocation > tabsLocations;
      collectEditors( editors, &tabsLocations );

      uint count = editors.size();
      outSettings.setValue( "editorsCount", count );
      for ( uint i = 0; i < count; ++i )
      {
         ResourceEditor* editor = editors[i];

         // create a new group for each editor
         sprintf( tmpEditorGroupStr, "editor_%d", i );
         outSettings.beginGroup( tmpEditorGroupStr );
         {
            // save the layout data
            outSettings.setValue( "internal", tabsLocations[i].m_internal );
            if ( tabsLocations[i].m_internal == false )
            {
               QWidget* parentWidget = editor->parentWidget();
               ASSERT_MSG( dynamic_cast< QDockWidget* >( parentWidget ), "A detached ResourceEditor is expected to be embedded in a QDockWidget" );

               QDockWidget* parentDockWidget = static_cast< QDockWidget* >( parentWidget );
               Qt::DockWidgetArea dockArea = m_mainWindow->dockWidgetArea( parentDockWidget );
               outSettings.setValue( "dockArea", (int)dockArea );
            }

            outSettings.setValue( "path", editor->getLabel() );
            outSettings.setValue( "icon", editor->getIcon().name() );
         }
         outSettings.endGroup();
      }
   }
   outSettings.endGroup();
}
コード例 #18
0
ファイル: SceneGraph.cpp プロジェクト: amaiorano/ZeldaDS
void SceneGraph::AddNode(ISceneNode* pNode)
{
	ASSERT(pNode);
	ASSERT_MSG(!pNode->mRemoveNodePostUpdate, "Probably got scheduled for remove then added in same frame");

	//@LAME: Because we multiply inherit ISceneNode and IPhysical, we need to do this here
	if (IPhysical* pPhysical = DynamicCast<IPhysical*>(pNode))
	{
		mPhysicalList.push_back(pPhysical);
	}

	mSceneNodeList.push_back(pNode);
	pNode->OnAddToScene();
}
コード例 #19
0
ファイル: file_util.cpp プロジェクト: Glought/citra
/**
 * @return The user’s home directory on POSIX systems
 */
static const std::string& GetHomeDirectory() {
    static std::string home_path;
    if (home_path.empty()) {
        const char* envvar = getenv("HOME");
        if (envvar) {
            home_path = envvar;
        } else {
            auto pw = getpwuid(getuid());
            ASSERT_MSG(pw, "$HOME isn’t defined, and the current user can’t be found in /etc/passwd.");
            home_path = pw->pw_dir;
        }
    }
    return home_path;
}
コード例 #20
0
ファイル: GFX_Model.cpp プロジェクト: ddionisio/TaTaMahatta
/////////////////////////////////////
// Name:	MDLSetMaterial
// Purpose:	sets/change model's
//			texture within material
//			index
// Output:	model's texture change
// Return:	RETCODE_SUCCESS if success
/////////////////////////////////////
PUBLIC RETCODE MDLSetMaterial(hMDL model, int materialInd, const GFXMATERIAL &material)
{
	//allocate materials if there is none
	//set it automatically to one
	if(model->numMaterial == 0)
	{
		model->numMaterial = 1;
		model->materials = (GFXMATERIAL*)GFX_MALLOC(sizeof(GFXMATERIAL)*model->numMaterial);
		if(!model->materials)
		{ ASSERT_MSG(0, "Unable to allocate model materials", "Error in MDLSetMaterial"); return RETCODE_FAILURE; }

		memcpy(&model->materials[0], &material, sizeof(GFXMATERIAL));
	}
	else
	{
		if(materialInd >= model->numMaterial)
		{ ASSERT_MSG(0, "Bad material index", "Error in MDLSetMaterial"); return RETCODE_FAILURE; }

		memcpy(&model->materials[materialInd], &material, sizeof(GFXMATERIAL));
	}

	return RETCODE_SUCCESS;
}
コード例 #21
0
ファイル: GpuFFTPlanCl.cpp プロジェクト: steffen-kiess/dda
    template <typename F> void GpuFFTPlanCl<F>::doExecute (const cl::CommandQueue& queue, const cl::Buffer& input, csize_t inputOffset, const cl::Buffer& output, csize_t outputOffset, bool doForward) const {
      if (supportNonZeroOffsets) {
        if (inputOffset != 0 || outputOffset != 0) {
          queue.enqueueCopyBuffer (input, tmp.getDataWritable (), (inputOffset * sizeof (std::complex<F>)) (), 0, (csize_t (sizeof (std::complex<F>)) * this->batchSize ()).value ());
          doExecute (queue, tmp.getDataWritable (), 0, tmp.getDataWritable (), 0, doForward);
          queue.enqueueCopyBuffer (tmp.getData (), output, 0, (outputOffset * sizeof (std::complex<F>)) (), (csize_t (sizeof (std::complex<F>)) * this->batchSize ()).value ());
          return;
        }
      } else {
        ASSERT_MSG (inputOffset == 0, "not implemented");
        ASSERT_MSG (outputOffset == 0, "not implemented");
      }

      if (this->size () == 0)
        return;
      if (this->size () == 1) {
        if (input () != output ())
          queue.enqueueCopyBuffer (input, output, 0, 0, (csize_t (sizeof (std::complex<F>)) * this->batchCount ()).value ());
        return;
      }

      cl::detail::errHandler (VAL(ExecuteInterleaved) (queue (), static_cast<TY(Plan)> (plan), Core::checked_cast<int> (this->batchCount ()), doForward ? VAL(Forward) : VAL(Inverse), input (), output (), 0, NULL, NULL), VAL(ExecuteInterleavedStr));
    }
コード例 #22
0
ファイル: GFX_Object.cpp プロジェクト: ddionisio/TaTaMahatta
/////////////////////////////////////
// Name:	OBJSetMaterial
// Purpose:	change obj's
//			material within material
//			index
// Output:	obj's material change
// Return:	RETCODE_SUCCESS if success
/////////////////////////////////////
PUBLIC RETCODE OBJSetMaterial(hOBJ obj, int materialInd, const GFXMATERIAL * material)
{
	//allocate materials if there is none
	//set it automatically to one
	if(obj->theMdl->numMaterial > 0)
	{
		if(materialInd >= obj->theMdl->numMaterial)
		{ ASSERT_MSG(0, "Bad material index", "Error in OBJSetMaterial"); return RETCODE_FAILURE; }

		memcpy(&obj->materials[materialInd], material, sizeof(GFXMATERIAL));
	}

	return RETCODE_SUCCESS;
}
コード例 #23
0
ファイル: interpreter.c プロジェクト: CZ-NIC/turris-updater
static void subprocess_callback(void *vdata) {
	struct subprocess_callback_data *dt = (struct subprocess_callback_data*)vdata;
	if (!dt->callback)
		return;
	lua_State *L = dt->L;

	// This may be called from C code with a dirty stack
	luaL_checkstack(L, 4, "Not enough stack space to call subprocess callback");
	int handler = push_err_handler(L);
	extract_registry_value(L, dt->callback);

	int result = lua_pcall(L, 0, 0, handler);
	ASSERT_MSG(!result, "%s", interpreter_error_result(L));
}
コード例 #24
0
/////////////////////////////////////
// Name:	ScriptVarCreate
// Purpose:	create a variable from file
// Output:	variable added to global list
//			if bGlobal == true
// Return:	new variable
/////////////////////////////////////
PROTECTED hVAR ScriptVarCreate(void *owner, FILE *fp, const ScriptInd & sInd, bool bGlobal)
{
	hVAR newVar = (hVAR)SCRIPT_MALLOC(sizeof(Variable));

	if(!newVar) { ASSERT_MSG(0, "Unable to allocate new variable!", "ScriptVarCreate"); return 0; }

	//set type
	newVar->type = sInd;

	//get name from file
	ParserReadWordFile(fp, newVar->name, MAXCHARNAME, 0);

	if(ScriptVarCall(owner, newVar, VAR_CREATE, 0, 0) != RETCODE_SUCCESS)
	{ ASSERT_MSG(0, "Error initializing new variable!", "ScriptVarCreate"); ScriptVarDestroy(owner, &newVar); return 0; }

	//add to global if bGlobal is true
	if(bGlobal)
	{
		ScriptTeaseAddGlobalVar(newVar);
	}

	return newVar;
}
コード例 #25
0
ファイル: EntityManager.hpp プロジェクト: leod/game
    T* operator()(ComponentBase* component) const {
        ASSERT(component != nullptr);

        T* result;
#ifndef NDEBUG
        result = dynamic_cast<T*>(component);
        ASSERT_MSG(result != nullptr, "Component has invalid family.");
#else
        // AFAIK, static_cast produces undefined behavior if
        // T isn't a subclass of ComponentBase.
        result = static_cast<T*>(component);
#endif
        return result;
    }
コード例 #26
0
ファイル: nudge_ex.dll.c プロジェクト: Arunpreet/dynamorio
static void
event_nudge(void *drcontext, uint64 arg)
{
    dr_fprintf(STDERR, "nudge delivered %x\n", (uint)arg);
    if (arg == NUDGE_ARG_SELF)
        dr_fprintf(STDERR, "self\n");
    else if (arg == NUDGE_ARG_PRINT)
        dr_fprintf(STDERR, "printing\n");
    else if (arg == NUDGE_ARG_TERMINATE) {
        dr_fprintf(STDERR, "terminating\n");
        dr_exit_process(NUDGE_TERMINATE_STATUS);
        ASSERT_MSG(false, "should not be reached");
    }
}
コード例 #27
0
///////////////////////////////////////////////////////////////////////////////
// Descripcion:
// - Alinea a la criatura en el mismo conjunto en donde este alineada 
//   la criatura hCriatureFriend. En caso de que dicha criatura no este
//   alineada en ningun grupo, la alineacion no se llevara a cabo.
// Parametros:
// - hCriature. Entidad a la que se desea alinear.
// - hCriatureFriend. Entidad con la que se desea alinear.
// Devuelve:
// - Si ha sido posible realizar la operacion true. En caso contrario false.
// Notas:
///////////////////////////////////////////////////////////////////////////////
bool
CCombatSystem::SetAlingmentWith(const AreaDefs::EntHandle& hCriature,
								const AreaDefs::EntHandle& hCriatureFriend)
{
  // SOLO si insancia inicializada
  ASSERT(IsInitOk());
  // SOLO si parametros validos
  ASSERT_MSG(IsValidCombatient(hCriature), "SetAlingmentWith_1");
  ASSERT_MSG(IsValidCombatient(hCriatureFriend), "SetAlingmentWith_2");

  // Se obtiene la alineacion de hCriatureFriend
  const CombatSystemDefs::eCombatAlingment FriendAlingment = GetAlingment(hCriatureFriend);

  // ¿Hay alineacion?
  if (FriendAlingment) {
	// Se alinea a la entidad en dicho bando y retorna
	SetAlingment(hCriature, FriendAlingment);
	return true;
  }

  // No se pudo realizar alineacion
  return false;
}
コード例 #28
0
ファイル: GFX_Model.cpp プロジェクト: PtrickH/homies
/////////////////////////////////////
// Name:	MDLSetMaterial
// Purpose:	sets/change model's
//			texture within material
//			index
// Output:	model's texture change
// Return:	RETCODE_SUCCESS if success
/////////////////////////////////////
PUBLIC RETCODE MDLSetMaterial(hMDL model, int materialInd, const D3DMATERIAL8 &material)
{
	//allocate materials if there is none
	//set it automatically to one
	if(model->numMaterial == 0)
	{
		model->numMaterial = 1;
		if(MemAlloc((void**)&model->materials, sizeof(D3DMATERIAL8)*model->numMaterial, M_ZERO) != RETCODE_SUCCESS)
		{ ASSERT_MSG(0, "Unable to allocate model materials", "Error in MDLSetMaterial"); return RETCODE_FAILURE; }
		MemSetPattern(model->materials, "MDLMTR");

		memcpy(&model->materials[0], &material, sizeof(D3DMATERIAL8));
	}
	else
	{
		if(materialInd >= model->numMaterial)
		{ ASSERT_MSG(0, "Bad material index", "Error in MDLSetMaterial"); return RETCODE_FAILURE; }

		memcpy(&model->materials[materialInd], &material, sizeof(D3DMATERIAL8));
	}

	return RETCODE_SUCCESS;
}
コード例 #29
0
bool MainEditorPanel::findTabByName( const QString& tabName, TabLocation& outLocation ) const
{
   // first - go through the tabs in the tab manager
   uint tabsCount = m_tabsWidget->count();
   for ( uint i = 0; i < tabsCount; ++i )
   {
      QWidget* tabWidget = m_tabsWidget->widget( i );
      ASSERT_MSG( dynamic_cast< ResourceEditor* >( tabWidget ), "We don't support tabs that don't contain ResourceEditors" );

      ResourceEditor* editor = static_cast< ResourceEditor* >( tabWidget );
      if ( editor->getLabel() == tabName )
      {
         // found it
         outLocation.m_internal = true;
         outLocation.m_index = i;
         return true;
      }
   }

   // next - browse undocked editors
   uint undockedTabsCount = m_undockedTabs.size();
   for ( uint i = 0; i < undockedTabsCount; ++i )
   {
      ASSERT_MSG( dynamic_cast< ResourceEditor* >( m_undockedTabs[i] ), "We don't support tabs that don't contain ResourceEditors" );

      ResourceEditor* editor = static_cast< ResourceEditor* >( m_undockedTabs[i] );
      if ( editor->getLabel() == tabName )
      {
         // found it
         outLocation.m_internal = false;
         outLocation.m_index = i;
         return true;
      }
   }

   return false;
}
コード例 #30
0
ファイル: memguard.c プロジェクト: OS2World/MM-SOUND-xine
void _my_free(void **data)
#endif
{
   char fail[256];

   if (NULL == data || NULL == *data
       || 0xFFFFFFFF == (uint32) *data || 0xFFFFFFFF == (uint32) data)
   {
#ifdef NOFRENDO_DEBUG
      sprintf(fail, "free: attempted to free NULL pointer at line %d of %s\n",
              line, file);
#else
      sprintf(fail, "free: attempted to free NULL pointer.\n");
#endif
      ASSERT_MSG(fail);
   }

#ifdef NOFRENDO_DEBUG
   /* if this is true, we are in REAL trouble */
   if (0 == mem_blockcount)
   {
      ASSERT_MSG("free: attempted to free memory when no blocks available");
   }

   if (FALSE != mem_debug)
      mem_deleteblock(*data, file, line);

   mem_blockcount--; /* dec our block count */

   if (FALSE != mem_debug)
      mem_freeguardblock(*data, GUARD_LENGTH);
   else
#endif /* NOFRENDO_DEBUG */
      free(*data);

   *data = NULL; /* NULL our source */
}