本文整理汇总了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;
}
示例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
}
示例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;
}
示例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;
}
示例5:
bool MemoryBlockLE::Read128(const u64 addr, u128* value)
{
if(!IsMyAddress(addr)) return false;
*value = *(u128*)GetMem(FixAddr(addr));
return true;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例10: GetMem
bool MemoryBlock::GetMemFFromAddr(void* dst, const u64 addr)
{
if(!IsMyAddress(addr)) return false;
dst = GetMem(FixAddr(addr));
return true;
}
示例11: Interpolate
void Interpolate(int n) {
FreeMem();
GetMem(n);
GetMaxMin();
GetNodesAndValues(n);
GetWeights(n);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}