bool Menu_Delete(){ WPAD_Rumble(0,0); self.rumbleAmt = 0; struct discHdr *header = NULL; char gameName[31]; /* No game list */ if (!self.gameCnt) return false; /* Selected game */ header = &self.gameList[self.gameSelected]; char title[MAX_TITLE_LEN]; if(self.usingTitlesTxt){ sprintf(title, "%s", header->title); getTitle(titleList, (char*)header->id, title); } else sprintf(title, "%s", (header->title)); if(strlen(title) < 30) { sprintf(gameName, "%s", title); } else { strncpy(gameName, title, 27); gameName[27] = '\0'; strncat(gameName, "...", 3); } //if(WindowPrompt(TX.askDelete, gameName, &yesButton, &noButton)) if(WindowPromptInstall((char*)header->id, gameName, TX.askDelete, &yesButton, &noButton, 1)) { BUFFER_KillBuffer(); if(0 > WBFS_RemoveGame(header->id)) { InitializeBuffer(self.gameList,self.gameCnt,BUFFER_WINDOW,COVER_COUNT/2.0 +self.shift,(settings.covers3d+settings.hq)); BUFFER_InitBuffer(); WindowPrompt(TX.errorDelete, TX.cantDelete, &okButton, 0); } else { GetEntries(); InitializeBuffer(self.gameList,self.gameCnt,BUFFER_WINDOW,COVER_COUNT/2.0 +self.shift,(settings.covers3d+settings.hq)); BUFFER_InitBuffer(); WindowPrompt(TX.successDelete, TX.pressOkContinue, &okButton, 0); WBFS_DiskSpace(&self.usedSpace, &self.freeSpace); return true; } } return false; }
//------------------------------------------------------------------------- MH_STATUS WINAPI MH_Initialize(VOID) { MH_STATUS status = MH_OK; EnterSpinLock(); if (g_hHeap == NULL) { g_hHeap = HeapCreate(0, 0, 0); if (g_hHeap != NULL) { // Initialize the internal function buffer. InitializeBuffer(); } else { status = MH_ERROR_MEMORY_ALLOC; } } else { status = MH_ERROR_ALREADY_INITIALIZED; } LeaveSpinLock(); return status; }
void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketType type) { //OSDebugOut (TEXT("SendPacket (%08x)\n"), quickHash(data,size)); if(!bConnected && !bConnecting && !bStopping) { hConnectionThread = OSCreateThread((XTHREAD)CreateConnectionThread, this); bConnecting = true; } if (bFirstKeyframe) { if (!bConnected || type != PacketType_VideoHighest) return; firstTimestamp = timestamp; bFirstKeyframe = false; } if (bufferedPackets.Num() == MAX_BUFFERED_PACKETS) { if (!bBufferFull) { InitializeBuffer(); bBufferFull = true; } TimedPacket packet; mcpy(&packet, &bufferedPackets[0], sizeof(TimedPacket)); bufferedPackets.Remove(0); SendPacketForReal(packet.data.Array(), packet.data.Num(), packet.timestamp, packet.type); } timestamp -= firstTimestamp; TimedPacket *packet; if (type == PacketType_Audio) { UINT newID; timestamp -= audioTimeOffset; newID = FindClosestBufferIndex(timestamp); packet = bufferedPackets.InsertNew(newID); } else { packet = bufferedPackets.CreateNew(); } packet->data.CopyArray(data, size); packet->timestamp = timestamp; packet->type = type; /*for (UINT i=0; i<bufferedPackets.Num(); i++) { if (bufferedPackets[i].data.Array() == 0) nop(); }*/ }
bool NtImage::Initialize(const ntWchar* fileName, ntInt screenWidth, ntInt screenHeight) { m_texHandle = g_resManager->LoadTexture(fileName); if (m_texHandle == INVALID_TEXTURE_HANDLE) { return false; } if (InitializeBuffer() == false) { return false; } //if (m_texture->Initialize(renderer, fileName) == false) //{ // return false; //} // post action m_screenSize.x = screenWidth; m_screenSize.y = screenHeight; m_prevPos.x = -1; m_prevPos.y = -1; return true; }
void InitializeScanner(CJcScanner* scanner, void* source, FGetLineFromSource getline){ scanner->buffer = (CJcBuffer*)g_oInterface.Malloc(sizeof(CJcBuffer)); InitializeBuffer(scanner->buffer, source, getline); InitializeStartStates(&scanner->start); InitializeKeywordMap(&scanner->keywords); Init(scanner); }
MH_STATUS Initialize() { if (!gCS) gCS = new CriticalSection(); CriticalSection::ScopedLock lock(*gCS); if (gIsInitialized) { return MH_ERROR_ALREADY_INITIALIZED; } // 内部関数バッファの初期化 InitializeBuffer(); gIsInitialized = true; return MH_OK; }
/** * @brief this function checks if a NDEF message is available in the M24LR04E-R EEPROM * @par PayloadLength : the number of byte of the NDEF message * @retval SUCCESS : A NDEF message has been found * @retval ERROR : a NDEF message doens't have been found */ static int8_t User_ReadNDEFMessage ( uint8_t *PayloadLength ) { uint8_t NthAttempt=0, NbAttempt = 2; *PayloadLength = 0; for (NthAttempt = 0; NthAttempt < NbAttempt ; NthAttempt++) { M24LR04E_Init(); // check if a NDEF message is available in the M24LR04 EEPROM if (User_CheckNDEFMessage() == SUCCESS) { User_GetPayloadLength(PayloadLength); if (PayloadLength !=0x00) { (*PayloadLength) -=2; InitializeBuffer (NDEFmessage,(*PayloadLength)+10); User_GetNDEFMessage(*PayloadLength,NDEFmessage); I2C_Cmd(M24LR04E_I2C, DISABLE); CLK_PeripheralClockConfig(CLK_Peripheral_I2C1, DISABLE); GPIO_HIGH(M24LR04E_I2C_SCL_GPIO_PORT,M24LR04E_I2C_SCL_PIN); GPIO_HIGH(M24LR04E_I2C_SCL_GPIO_PORT,M24LR04E_I2C_SDA_PIN); ToUpperCase (*PayloadLength,NDEFmessage); return SUCCESS; } } M24LR04E_DeInit(); I2C_Cmd(M24LR04E_I2C, DISABLE); } return ERROR; }
void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketType type) { if(!bConnected && !bConnecting && !bStopping) { hConnectionThread = OSCreateThread((XTHREAD)CreateConnectionThread, this); bConnecting = true; } if (bFastInitialKeyframe) { if (!bConnected) { //while not connected, keep at most one keyframe buffered if (type != PacketType_VideoHighest) return; bufferedPackets.Clear(); } if (bConnected && bFirstKeyframe) { bFirstKeyframe = false; firstTimestamp = timestamp; //send out our buffered keyframe immediately, unless this packet happens to also be a keyframe if (type != PacketType_VideoHighest && bufferedPackets.Num() == 1) { TimedPacket packet; mcpy(&packet, &bufferedPackets[0], sizeof(TimedPacket)); bufferedPackets.Remove(0); packet.timestamp = 0; SendPacketForReal(packet.data.Array(), packet.data.Num(), packet.timestamp, packet.type); } else bufferedPackets.Clear(); } } else { if (bFirstKeyframe) { if (!bConnected || type != PacketType_VideoHighest) return; firstTimestamp = timestamp; bFirstKeyframe = false; } } //OSDebugOut (TEXT("%u: SendPacket (%d bytes - %08x @ %u)\n"), OSGetTime(), size, quickHash(data,size), timestamp); if (bufferedPackets.Num() == MAX_BUFFERED_PACKETS) { if (!bBufferFull) { InitializeBuffer(); bBufferFull = true; } TimedPacket packet; mcpy(&packet, &bufferedPackets[0], sizeof(TimedPacket)); bufferedPackets.Remove(0); SendPacketForReal(packet.data.Array(), packet.data.Num(), packet.timestamp, packet.type); } timestamp -= firstTimestamp; TimedPacket *packet; if (type == PacketType_Audio) { UINT newID; timestamp -= audioTimeOffset; newID = FindClosestBufferIndex(timestamp); packet = bufferedPackets.InsertNew(newID); } else { packet = bufferedPackets.CreateNew(); } packet->data.CopyArray(data, size); packet->timestamp = timestamp; packet->type = type; /*for (UINT i=0; i<bufferedPackets.Num(); i++) { if (bufferedPackets[i].data.Array() == 0) nop(); }*/ }
int CameraInit(void *pData) { PHYSICAL_ADDRESS ioPhysicalBase = {0,0}; RETAILMSG(CAM_INOUT,(TEXT("++%s\n"), __FUNCTION__)); // 0. Map to Virtual Address // GPIO Virtual alloc ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_GPIO; s6410IOP = (S3C6410_GPIO_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_GPIO_REG), FALSE); if (s6410IOP == NULL) { goto CleanUp; } // Camera Virtual alloc ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_CAMIF; s6410CAM = (S3C6410_CAMIF_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_CAMIF_REG), FALSE); if (s6410CAM == NULL) { goto CleanUp; } // PWM clock Virtual alloc ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_SYSCON; s6410PWR = (S3C6410_SYSCON_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_SYSCON_REG), FALSE); if (s6410PWR == NULL) { goto CleanUp; } hPwrControl = CreateFile( L"PWC0:", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); if (INVALID_HANDLE_VALUE == hPwrControl ) { RETAILMSG(CAM_ERR, (TEXT("[CAM] CameraInit() : PWC0 Open Device Failed\r\n"))); return FALSE; } ModuleInit(); CameraSetClockDiv(); // 1. Camera IO setup CameraGpioInit(); // 2. Camera Clock setup CameraClockOn(TRUE); // 3. camera module reset CameraModuleReset(); /* // Reserved Step // 4. Write Setting for Module using I2C if(!ModuleWriteBlock()) { return FALSE; } // 5. Camera i/f reset CameraInterfaceReset(); // 6. Initialize I/F source register CameraCaptureSourceSet(); */ // 7. Camera Clock Off CameraClockOn(FALSE); // 8. Allocation Buffer(); if(!InitializeBuffer()) { return FALSE; } // 9. Interrupt Initlaize(); if(!InterruptInitialize()) { return FALSE; } RETAILMSG(CAM_INOUT,(TEXT("--%s Succeeded\n"), __FUNCTION__)); return TRUE; CleanUp: RETAILMSG(1,(TEXT("%s : Failed, ioPhysicalBase(0x%x,0x%x)\r\n"), __FUNCTION__, ioPhysicalBase.LowPart, ioPhysicalBase.HighPart)); return FALSE; }