当前位置: 首页>>代码示例>>C++>>正文


C++ GetMem函数代码示例

本文整理汇总了C++中GetMem函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMem函数的具体用法?C++ GetMem怎么用?C++ GetMem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetMem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NGCUnFreezeBlock

/****************************************************************************
 * NGCUnFreezeBlock
 ***************************************************************************/
int
NGCUnFreezeBlock (char *name, uint8 * block, int size)
{
	char buffer[20], *e;
	int len = 0;
	int rem = 0;

	GetMem (buffer, 11);

	if (strncmp (buffer, name, 3) != 0 || buffer[3] != ':' ||
	buffer[10] != ':' || (len = strtol (&buffer[4], &e, 10)) == 0 ||
	e != buffer + 10)
	{
		bufoffset -= 11; // go back to where we started
		return WRONG_FORMAT;
	}

	if (len > size)
	{
		rem = len - size;
		len = size;
	}

	ZeroMemory (block, size);

	GetMem ((char *) block, len);

	if (rem)
	{
		bufoffset += rem;
	}

	return SUCCESS;
}
开发者ID:feraligatr,项目名称:snes9xgx,代码行数:37,代码来源:freeze.cpp

示例2: return

static void *amgmalloc (size_t n)
{
        #ifndef DYNAMIC_MEMORY_ALLOCMODEL
  return(GetMem(MGHEAP(amgMG),n,FROM_BOTTOM));
        #else
  return(GetMem(MGHEAP(amgMG),n,FROM_TOP));
        #endif
}
开发者ID:rolk,项目名称:ug,代码行数:8,代码来源:amg_ug.c

示例3: main

int main() {
  printf("Enter number of nodes: ");
  scanf("%d", &N);
  if (N < 3)
    return 0;

  GetMem(N);

  //    printf("Enter left edge: ");
  //    scanf("%e", &a);
  //    printf("Enter right edge: ");
  //    scanf("%e", &b);
  a = -1.0;
  b = 1.0;
  if (a >= b)
    return 0;

  Interpolate(N);

  printf("Retcode: %d", DrawWindow(DrawWindowContent, KeyPressFunction));
  delete x;
  delete fv;
  delete d;
  delete w;
  return 0;
}
开发者ID:tokar1,项目名称:mech-math,代码行数:26,代码来源:test.cpp

示例4: PRINTF

int cN2Prov0501::ProcessBx(unsigned char *data, int len, int pos)
{
  if(data[pos-1]!=0xBC) {
    PRINTF(L_SYS_EMU,"%04X: bad nano %02X for ROM 120",id,data[pos-1]);
    return -1;
    }
  if(pos!=(0x93-0x80)) { // maybe exploitable
    PRINTF(L_SYS_EMU,"%04X: refuse to execute from %04x",id,0x80+pos);
    return -1;
    }
  if(Init(id,120)) {
    SetMem(0x80,data,len);
    SetPc(0x80+pos);
    SetSp(0x0FFF,0x0FE0);
    Set(0x0001,0xFF);
    Set(0x000E,0xFF);
    Set(0x0000,0x04);
    ClearBreakpoints();
    AddBreakpoint(0x821f);
    AddBreakpoint(0x0000);
    AddRomCallbacks();
    while(!Run(hasMaprom ? 20000:5000)) {
      if(GetPc()==0x821f) {
        GetMem(0x80,data,len);
        return a;
        }
      else if(GetPc()==0x0000) break;
      else if(!RomCallbacks()) break;
      }
    }
  return -1;
}
开发者ID:3PO,项目名称:vdr-plugin-sc,代码行数:32,代码来源:nagra2-0501.c

示例5:

bool MemoryBlockLE::Read128(const u64 addr, u128* value)
{
	if(!IsMyAddress(addr)) return false;

	*value = *(u128*)GetMem(FixAddr(addr));
	return true;
}
开发者ID:TheGeekAndrew,项目名称:rpcs3,代码行数:7,代码来源:Memory.cpp

示例6: NewListCDSByLevel

/**
 * Create new list by level
 */
PLISTCDSBYLEVEL NewListCDSByLevel(PLISTCDSBYLEVEL plcdsbylevel) {
	plcdsbylevel = (PLISTCDSBYLEVEL) GetMem(1, sizeof(LISTCDSBYLEVEL), "NewListCDSByLevel");
	plcdsbylevel->pFirstLCDS = NULL;
	plcdsbylevel->NElem = 0;
	plcdsbylevel->MaxNElem = 0;
	return plcdsbylevel;
}
开发者ID:josmanual,项目名称:DivSRegOnGrid,代码行数:10,代码来源:listCDSimplexByLevel.c

示例7: re

__forceinline void MemoryBlock::FastWrite<u128>(const u64 addr, const u128 value)
{
	u128 res;
	res.lo = re(value.hi);
	res.hi = re(value.lo);
	*(u128*)GetMem(addr) = res;
}
开发者ID:TheGeekAndrew,项目名称:rpcs3,代码行数:7,代码来源:Memory.cpp

示例8: memcpy

bool MemoryBlock::SetMemFromAddr(void* src, const u64 addr, const u32 size)
{
    if(!IsMyAddress(addr) || FixAddr(addr) + size > GetSize()) return false;

    memcpy(GetMem(FixAddr(addr)), src, size);

    return true;
}
开发者ID:sireq,项目名称:rpcs3,代码行数:8,代码来源:Memory.cpp

示例9: switch

unsigned int Cpu::GetData(unsigned char Addressing, unsigned int Argument)
{
	switch(Addressing)
	{
	case 0:
		return GetReg(Argument);
	case 1:
		return GetMem(GetReg(Argument));
	case 2:
		return Argument;
	case 3:
		return GetMem(Argument);
	default:
		CoreCrash("Unknow addressing: %d", Addressing);
		return 0;
	}
}
开发者ID:RonxBulld,项目名称:anvm,代码行数:17,代码来源:Cpu.cpp

示例10: GetMem

bool MemoryBlock::GetMemFFromAddr(void* dst, const u64 addr)
{
    if(!IsMyAddress(addr)) return false;

    dst = GetMem(FixAddr(addr));

    return true;
}
开发者ID:sireq,项目名称:rpcs3,代码行数:8,代码来源:Memory.cpp

示例11: Interpolate

void Interpolate(int n) {
  FreeMem();
  GetMem(n);

  GetMaxMin();
  GetNodesAndValues(n);
  GetWeights(n);
}
开发者ID:tokar1,项目名称:mech-math,代码行数:8,代码来源:test.cpp

示例12: NewLCDSNodeByLevel

/**
 * New node by level
 */
PLCDSNODEBYLEVEL NewLCDSNodeByLevel(PLISTCDS plcds) {
	PLCDSNODEBYLEVEL plcsnbylevel;

	plcsnbylevel = (PLCDSNODEBYLEVEL) GetMem((SIZE) 1, (SIZE) sizeof(LCDSNODEBYLEVEL), "NewLCDSNodeByLevel");
	plcsnbylevel->plcds = plcds;
	plcsnbylevel->level = -1;
	plcsnbylevel->pnext = NULL;

	return plcsnbylevel;
}
开发者ID:josmanual,项目名称:DivSRegOnGrid,代码行数:13,代码来源:listCDSimplexByLevel.c

示例13: offsetStringToInt

int offsetStringToInt(unsigned int type, const char* offsetBuffer)
{
	int offset = -1;

	if (sscanf(offsetBuffer,"%4X",&offset) == EOF)
	{
		return -1;
	}

	if (type & BT_P)
	{
		return offset & 0x3FFF;
	}
	else if (type & BT_S)
	{
		return offset & 0x00FF;
	}
	else // BT_C
	{
		if (GameInfo->type == GIT_NSF) { //NSF Breakpoint keywords
			if (strcmp(offsetBuffer,"LOAD") == 0) return (NSFHeader.LoadAddressLow | (NSFHeader.LoadAddressHigh<<8));
			if (strcmp(offsetBuffer,"INIT") == 0) return (NSFHeader.InitAddressLow | (NSFHeader.InitAddressHigh<<8));
			if (strcmp(offsetBuffer,"PLAY") == 0) return (NSFHeader.PlayAddressLow | (NSFHeader.PlayAddressHigh<<8));
		}
		else if (GameInfo->type == GIT_FDS) { //FDS Breakpoint keywords
			if (strcmp(offsetBuffer,"NMI1") == 0) return (GetMem(0xDFF6) | (GetMem(0xDFF7)<<8));
			if (strcmp(offsetBuffer,"NMI2") == 0) return (GetMem(0xDFF8) | (GetMem(0xDFF9)<<8));
			if (strcmp(offsetBuffer,"NMI3") == 0) return (GetMem(0xDFFA) | (GetMem(0xDFFB)<<8));
			if (strcmp(offsetBuffer,"RST") == 0) return (GetMem(0xDFFC) | (GetMem(0xDFFD)<<8));
			if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) return (GetMem(0xDFFE) | (GetMem(0xDFFF)<<8));
		}
		else { //NES Breakpoint keywords
			if ((strcmp(offsetBuffer,"NMI") == 0) || (strcmp(offsetBuffer,"VBL") == 0)) return (GetMem(0xFFFA) | (GetMem(0xFFFB)<<8));
			if (strcmp(offsetBuffer,"RST") == 0) return (GetMem(0xFFFC) | (GetMem(0xFFFD)<<8));
			if ((strcmp(offsetBuffer,"IRQ") == 0) || (strcmp(offsetBuffer,"BRK") == 0)) return (GetMem(0xFFFE) | (GetMem(0xFFFF)<<8));
		}
	}

	return offset;
}
开发者ID:dmitrysmagin,项目名称:fceu320-rzx50,代码行数:40,代码来源:debug.cpp

示例14: sizeof

    void* Context::Allocate(std::size_t sz)
    {
    	struct TaggedObj* obj;

    	if (POOL && sz < 8192)
    	{
    		std::vector<void*>& poolForSize = pools[sz];
    		if (poolForSize.size() > 0)
    		{
    			obj = reinterpret_cast<struct TaggedObj*>(poolForSize.back());
    			poolForSize.pop_back();
    		}
    		else
    			obj = reinterpret_cast<struct TaggedObj*>(GetMem(sz + sizeof(Context*)));
    	}
    	else
    		obj = reinterpret_cast<struct TaggedObj*>(GetMem(sz + sizeof(Context*)));


		obj->context = this;
		return &(obj->body);
    }
开发者ID:tosca-lang,项目名称:tosca,代码行数:22,代码来源:ts.cpp

示例15: AddProtectedProcess

VOID AddProtectedProcess(HANDLE ParentProcessId, HANDLE ProcessId) {
	PPROTECTED_PROCESS CurrentProcess = ProtectedProcess;

	// Если список ещё пуст:
	if (ProtectedProcess == NULL) {
		CurrentProcess = GetMem(sizeof(PROTECTED_PROCESS));
		FillProtectionStruct(CurrentProcess, ParentProcessId, ProcessId);
		ProtectedProcess = CurrentProcess;
		return;
	}

	// Ищем последний элемент в списке:
	while (CurrentProcess->NextEntry != NULL) {
		if (CurrentProcess->ProcessID == ProcessId) return;
		CurrentProcess = CurrentProcess->NextEntry;
	}

	if (CurrentProcess->ProcessID == ProcessId) return;

	CurrentProcess->NextEntry = GetMem(sizeof(PROTECTED_PROCESS));
	FillProtectionStruct(CurrentProcess->NextEntry, ParentProcessId, ProcessId);
}
开发者ID:tetratec,项目名称:EnjoyTheRing0,代码行数:22,代码来源:Protection.c


注:本文中的GetMem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。