// TMessage ctor TMsgAuth1Challenge2::TMsgAuth1Challenge2(const TMessage& theMsgR) : TMsgAuthRawBufferBase(theMsgR) { Unpack(); }
// SmallMessage ctor SMsgDirG2SetDataObjects::SMsgDirG2SetDataObjects(const SmallMessage& theMsgR) : SMsgDirG2UpdateExtendBase(theMsgR), mSetMode(WONMsg::DOSM_ADDREPLACE) { Unpack(); }
SMsgFactStreamFile::SMsgFactStreamFile(const SmallMessage& theMsgR, bool doUnpack) : SmallMessage(theMsgR) { if (doUnpack) Unpack(); }
void ExtractStreams(Archive& Arc, char* FileName, wchar* FileNameW) { if (!WinNT()) return; if (Arc.HeaderCRC != Arc.StreamHead.HeadCRC) { #ifndef SILENT Log(Arc.FileName, St(MStreamBroken), FileName); #endif ErrHandler.SetErrorCode(CRC_ERROR); return; } if (Arc.StreamHead.Method < 0x31 || Arc.StreamHead.Method > 0x35 || Arc.StreamHead.UnpVer > PACK_VER) { #ifndef SILENT Log(Arc.FileName, St(MStreamUnknown), FileName); #endif ErrHandler.SetErrorCode(WARNING); return; } char StreamName[NM + 2]; if (FileName[0] != 0 && FileName[1] == 0) { strcpy(StreamName, ".\\"); strcpy(StreamName + 2, FileName); } else strcpy(StreamName, FileName); if (strlen(StreamName) + strlen((char*)Arc.StreamHead.StreamName) >= sizeof(StreamName) || Arc.StreamHead.StreamName[0] != ':') { #ifndef SILENT Log(Arc.FileName, St(MStreamBroken), FileName); #endif ErrHandler.SetErrorCode(CRC_ERROR); return; } ConvertPath((char*)Arc.StreamHead.StreamName + 1, (char*)Arc.StreamHead.StreamName + 1); strcat(StreamName, (char*)Arc.StreamHead.StreamName); FindData fd; bool Found = FindFile::FastFind(FileName, FileNameW, &fd); if (fd.FileAttr & FILE_ATTRIBUTE_READONLY) SetFileAttr(FileName, FileNameW, fd.FileAttr & ~FILE_ATTRIBUTE_READONLY); File CurFile; if (CurFile.WCreate(StreamName)) { ComprDataIO DataIO; Unpack Unpack(&DataIO); Unpack.Init(); Array<unsigned char> UnpData(Arc.StreamHead.UnpSize); DataIO.SetPackedSizeToRead(Arc.StreamHead.DataSize); DataIO.EnableShowProgress(false); DataIO.SetFiles(&Arc, &CurFile); Unpack.SetDestSize(Arc.StreamHead.UnpSize); Unpack.DoUnpack(Arc.StreamHead.UnpVer, false); if (Arc.StreamHead.StreamCRC != ~DataIO.UnpFileCRC) { #ifndef SILENT Log(Arc.FileName, St(MStreamBroken), StreamName); #endif ErrHandler.SetErrorCode(CRC_ERROR); } else CurFile.Close(); } File HostFile; if (Found && HostFile.Open(FileName, FileNameW, true, true)) SetFileTime(HostFile.GetHandle(), &fd.ftCreationTime, &fd.ftLastAccessTime, &fd.ftLastWriteTime); if (fd.FileAttr & FILE_ATTRIBUTE_READONLY) SetFileAttr(FileName, FileNameW, fd.FileAttr); }
SMsgCommDumpStatistics::SMsgCommDumpStatistics(const SmallMessage& theMsgR) : SmallMessage(theMsgR) { Unpack(); }
// MiniMessage ctor MMsgCommGetNumUsers::MMsgCommGetNumUsers(const MiniMessage& theMsgR) : MiniMessage(theMsgR) { WTRACE("MMsgCommGetNumUsers::ctor(MiniMessage)"); Unpack(); }
RoutingServerClientIdFlagMessage::RoutingServerClientIdFlagMessage(const RoutingServerMessage& theMsgR) : RoutingServerFlagMessage(theMsgR) { Unpack(); }
MMsgRoutingModifyDataObject::MMsgRoutingModifyDataObject(const RoutingServerMessage& theMsgR) : MMsgRoutingBaseDataObject(theMsgR) { Unpack(); }
void PackedGame::Unpack( Roster &r, std::string &blob ) { Unpack(blob); Unpack(r); }
MMsgRoutingClientChange::MMsgRoutingClientChange(const RoutingServerMessage& theMsgR, bool doUnpack) : RoutingServerMessage(theMsgR) { if (doUnpack) Unpack(); }
MMsgRoutingSendData::MMsgRoutingSendData(const RoutingServerMessage& theMsgR) : RoutingServerMessage(theMsgR) { Unpack(); }
MMsgRoutingClientChangeEx::MMsgRoutingClientChangeEx(const RoutingServerMessage& theMsgR, bool doUnpack) : MMsgRoutingClientChange(theMsgR, false) { if (doUnpack) Unpack(); }
void VSTInstrument::processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames) { renderMutex.Lock(); // Before rendering, set rounding flags, and denormal flags ZFPUState fpuState(ZFPUState::kRoundToZero); // If neccesary, create or reload synth if (programFile.DidUpdate()) { if (synth) { delete synth; synth = nullptr; } auto prog = invader::ZVMProgram::FromBlob(programFile.data); prog->Unpack(); synth = new invader::ZSynth(prog); } eventQueueMutex.Lock(); int32_t numSamplesToRender = ((int32_t)sampleFrames)-((int32_t)sampleBuffer.SamplesAvailable()); // Get time info VstTimeInfo *timeInfo = getTimeInfo(kVstPpqPosValid | kVstTempoValid | kVstBarsValid | kVstCyclePosValid | kVstTimeSigValid | kVstTransportPlaying); synth->sync.bpm = (timeInfo && (timeInfo->flags & kVstTempoValid)) ? timeInfo->tempo : 120.0f; synth->sync.bps = synth->sync.bpm / 60.0f; bool shouldSync = timeInfo && (timeInfo->flags & kVstPpqPosValid) && (timeInfo->flags & kVstTransportPlaying); if (shouldSync) { synth->sync.pos = timeInfo->ppqPos; // Compensate for samples already generated synth->sync.pos += (double)sampleBuffer.SamplesAvailable() / kSampleRate * synth->sync.bps; } synth->sync.time = synth->sync.pos / synth->sync.bps; // Loop over blocks while (numSamplesToRender > 0) { // Handle relevant events while (!eventQueue.empty() && eventQueue.front().deltaFrames < kBlockSize) { VstMidiEvent event = eventQueue.front(); char* midiData = event.midiData; zmsg("Midi Event: %02X %02X %02X\n", (unsigned char)midiData[0], (unsigned char)midiData[1], (unsigned char)midiData[2]); uint32_t channel = uint32_t(midiData[0]) & 0x0f; uint32_t status = uint32_t(midiData[0]) & 0xf0; if (status == 0x90 || status == 0x80) // Note on or note off { uint32_t note = uint32_t(midiData[1]) & 0x7f; uint32_t velocity = uint32_t(midiData[2]) & 0x7f; if (status == 0x80) velocity = 0; // note off by velocity 0 if (velocity==0) { synth->NoteOff((uint32_t)channel, (uint32_t)note, (uint32_t)event.deltaFrames); } else { synth->NoteOn((uint32_t)channel, (uint32_t)note, (uint32_t)velocity, (uint32_t)event.deltaFrames); } } else if (status == 0xB0) // MIDI control change { uint32_t number = uint32_t(midiData[1]) & 0x7f; uint32_t value = uint32_t(midiData[2]) & 0x7f; synth->ControlChange(channel, number, value, (uint32_t)event.deltaFrames); } eventQueue.pop_front(); } // Render blocks synth->ProcessBlock(); // Resample // Access here is a little hackish, we're relying on storage of sample block outputs to be stored continually in global storage, starting at zero //ZResampler2xDownsample(*downsampler, downsampleBuffer, synth->vm.globalStorage->Load<ZBlockBufferInternal>((invader::opcode_index_t)(synth->section*sizeof(ZBlockBufferInternal)))); ZResampler2xDownsample(*downsampler, downsampleBuffer, synth->vm.stack->Pop<ZBlockBufferInternal>()); sampleBuffer.PutBlock(downsampleBuffer); numSamplesToRender -= kBlockSize; // Decrement deltaSamples in events in queue for (event_queue_t::iterator it = eventQueue.begin(); it != eventQueue.end(); ++it) it->deltaFrames -= kBlockSize; } eventQueueMutex.Unlock(); renderMutex.Unlock(); // Deinterleave output into buffers for (int32_t i=0; i<sampleFrames; i++) { sample_t sample = sampleBuffer.GetSample(); outputs[0][i] = (float)sample.d[0]; outputs[1][i] = (float)sample.d[1]; } /*// We must always clear the buffer, to ensure non-garbage output Buffer dest; dest.channels[0]=outputs[0]; dest.channels[1]=outputs[1]; dest.numChannels=2; dest.numSamples=sampleFrames; dest.Reset(); // Only do this if replacing buffer // Note: This is mostly useful if some operation (e.g. synth realod) takes a while // We are not guarenteed that synth has not been reloaded when we get to the lock if (synth->shouldRender==false) { return; } synth->renderMutex.Lock(); // Recheck if (synth->shouldRender==false) { synth->renderMutex.Unlock(); return; } // Get time info VstTimeInfo *timeInfo = getTimeInfo(kVstPpqPosValid | kVstTempoValid | kVstBarsValid | kVstCyclePosValid | kVstTimeSigValid | kVstTransportPlaying); synth->timeInfo.bpm = (timeInfo && (timeInfo->flags & kVstTempoValid)) ? timeInfo->tempo : 120.0f; synth->timeInfo.bps = synth->timeInfo.bpm / 60.0f; bool shouldSync = timeInfo && (timeInfo->flags & kVstPpqPosValid) && (timeInfo->flags & kVstTransportPlaying); if (shouldSync) synth->timeInfo.pos = timeInfo->ppqPos; // Process, but support samplesFrames other than 256 synth->ProcessNon256(&dest); synth->renderMutex.Unlock(); */ return; }
// MiniMessage MMsgObsRemovePublication::MMsgObsRemovePublication(const MiniMessage& theMsgR) : MiniMessage(theMsgR), mPublicationId(0) { Unpack(); }
bool Archive::GetComment(Array<byte> &CmtData) { if (!MainComment) return(false); SaveFilePos SavePos(*this); ushort CmtLength; #ifndef SFX_MODULE if (OldFormat) { Seek(SFXSize+SIZEOF_OLDMHD,SEEK_SET); CmtLength=GetByte()+(GetByte()<<8); } else #endif { if (NewMhd.Flags & MHD_COMMENT) { Seek(SFXSize+SIZEOF_MARKHEAD+SIZEOF_NEWMHD,SEEK_SET); ReadHeader(); } else { Seek(SFXSize+SIZEOF_MARKHEAD+NewMhd.HeadSize,SEEK_SET); return(SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData)!=0); } #ifndef SFX_MODULE if (CommHead.HeadCRC!=HeaderCRC) { Log(FileName,St(MLogCommHead)); Alarm(); return(false); } CmtLength=CommHead.HeadSize-SIZEOF_COMMHEAD; #endif } #ifndef SFX_MODULE if ((OldFormat && (OldMhd.Flags & MHD_PACK_COMMENT)) || (!OldFormat && CommHead.Method!=0x30)) { if (!OldFormat && (CommHead.UnpVer < 15 || CommHead.UnpVer > UNP_VER || CommHead.Method > 0x35)) return(false); ComprDataIO DataIO; Unpack Unpack(&DataIO); Unpack.Init(); DataIO.SetTestMode(true); uint UnpCmtLength; if (OldFormat) { UnpCmtLength=GetByte()+(GetByte()<<8); CmtLength-=2; DataIO.SetCmt13Encryption(); } else UnpCmtLength=CommHead.UnpSize; DataIO.SetFiles(this,NULL); DataIO.EnableShowProgress(false); DataIO.SetPackedSizeToRead(CmtLength); Unpack.SetDestSize(UnpCmtLength); Unpack.DoUnpack(CommHead.UnpVer,false); if (!OldFormat && ((~DataIO.UnpFileCRC)&0xffff)!=CommHead.CommCRC) { Log(FileName,St(MLogCommBrk)); Alarm(); return(false); } else { unsigned char *UnpData; uint UnpDataSize; DataIO.GetUnpackedData(&UnpData,&UnpDataSize); CmtData.Alloc(UnpDataSize); memcpy(&CmtData[0],UnpData,UnpDataSize); } } else { CmtData.Alloc(CmtLength); Read(&CmtData[0],CmtLength); if (!OldFormat && CommHead.CommCRC!=(~CRC(0xffffffff,&CmtData[0],CmtLength)&0xffff)) { Log(FileName,St(MLogCommBrk)); Alarm(); CmtData.Reset(); return(false); } } #endif #if defined(_WIN_32) && !defined(_WIN_CE) && !defined(_XBOX) && !defined(_LINUX) //if (CmtData.Size()>0) // OemToCharBuff((char*)&CmtData[0],(char*)&CmtData[0],CmtData.Size()); #endif return(CmtData.Size()>0); }
// Construct from raw representation Auth2Certificate::Auth2Certificate(const unsigned char* theRawP, unsigned short theLen) { Unpack(theRawP, theLen); }
MMsgRoutingPeerData::MMsgRoutingPeerData(const RoutingServerMessage& theMsgR, bool doUnpack) : RoutingServerMessage(theMsgR) { if (doUnpack) Unpack(); }
MMsgRoutingRemoveSuccessor::MMsgRoutingRemoveSuccessor(const RoutingServerMessage& theMsgR) : RoutingServerMessage(theMsgR) { Unpack(); }
RoutingServerGenericFlagMessage::RoutingServerGenericFlagMessage(const RoutingServerMessage& theMsgR) : RoutingServerFlagMessage(theMsgR) { Unpack(); }
SMsgFactSaveConfigFile::SMsgFactSaveConfigFile(const SmallMessage& theMsgR, bool doUnpack) : SmallMessage(theMsgR) { if (doUnpack) Unpack(); }
// MiniMessage MMsgObsPublishRequested::MMsgObsPublishRequested(const MiniMessage& theMsgR) : MiniMessage(theMsgR), mPublicationName() { Unpack(); }
void ExtractStreams20(Archive &Arc,const wchar *FileName) { if (Arc.BrokenHeader) { uiMsg(UIERROR_STREAMBROKEN,Arc.FileName,FileName); ErrHandler.SetErrorCode(RARX_CRC); return; } if (Arc.StreamHead.Method<0x31 || Arc.StreamHead.Method>0x35 || Arc.StreamHead.UnpVer>VER_PACK) { uiMsg(UIERROR_STREAMUNKNOWN,Arc.FileName,FileName); ErrHandler.SetErrorCode(RARX_WARNING); return; } wchar StreamName[NM+2]; if (FileName[0]!=0 && FileName[1]==0) { wcscpy(StreamName,L".\\"); wcscpy(StreamName+2,FileName); } else wcscpy(StreamName,FileName); if (wcslen(StreamName)+strlen(Arc.StreamHead.StreamName)>=ASIZE(StreamName) || Arc.StreamHead.StreamName[0]!=':') { uiMsg(UIERROR_STREAMBROKEN,Arc.FileName,FileName); ErrHandler.SetErrorCode(RARX_CRC); return; } wchar StoredName[NM]; CharToWide(Arc.StreamHead.StreamName,StoredName,ASIZE(StoredName)); ConvertPath(StoredName+1,StoredName+1); wcsncatz(StreamName,StoredName,ASIZE(StreamName)); FindData fd; bool Found=FindFile::FastFind(FileName,&fd); if ((fd.FileAttr & FILE_ATTRIBUTE_READONLY)!=0) SetFileAttr(FileName,fd.FileAttr & ~FILE_ATTRIBUTE_READONLY); File CurFile; if (CurFile.WCreate(StreamName)) { ComprDataIO DataIO; Unpack Unpack(&DataIO); Unpack.Init(0x10000,false); DataIO.SetPackedSizeToRead(Arc.StreamHead.DataSize); DataIO.EnableShowProgress(false); DataIO.SetFiles(&Arc,&CurFile); DataIO.UnpHash.Init(HASH_CRC32,1); Unpack.SetDestSize(Arc.StreamHead.UnpSize); Unpack.DoUnpack(Arc.StreamHead.UnpVer,false); if (Arc.StreamHead.StreamCRC!=DataIO.UnpHash.GetCRC32()) { uiMsg(UIERROR_STREAMBROKEN,Arc.FileName,StreamName); ErrHandler.SetErrorCode(RARX_CRC); } else CurFile.Close(); } File HostFile; if (Found && HostFile.Open(FileName,FMF_OPENSHARED|FMF_UPDATE)) SetFileTime(HostFile.GetHandle(),&fd.ftCreationTime,&fd.ftLastAccessTime, &fd.ftLastWriteTime); if ((fd.FileAttr & FILE_ATTRIBUTE_READONLY)!=0) SetFileAttr(FileName,fd.FileAttr); }
TInputControl& TInputControl::operator=(TPacked packed) { Unpack(packed, Type, ControllerIndex, Button, Flags); return *this; }
MMsgRoutingSendDataBroadcast::MMsgRoutingSendDataBroadcast(const RoutingServerMessage& theMsgR) : RoutingServerMessage(theMsgR) { Unpack(); }
// MiniMessage MMsgObsGetDataPool::MMsgObsGetDataPool(const MiniMessage& theMsgR) : MiniMessage(theMsgR), mDataPoolId(0) { Unpack(); }
MMsgRoutingBootClient::MMsgRoutingBootClient(const RoutingServerMessage& theMsgR) : RoutingServerMessage(theMsgR) { Unpack(); }
// ---------------------------------------------------------------------------- void Main() { // Load Tile (8-15 pixel index range) LoadFile( PLASMATILE2BMPSPRRAWDATA1PCK_TRACKFILEID, VIDEOSEGMENT0000 ); Unpack( VIDEOSEGMENTC000, VIDEOSEGMENT0000 ); ShiftTile( VIDEOSEGMENTC000 ); SetPaletteFrom8( GetPalette() ); // Load Transit Data LoadFile( TRANSITLINESFX2BINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC4, 0x6880, VIDEOSEGMENT0000 ); // Load Transit Code LoadFile( MAINDRAWTRIANGLEONLYZ80BINPCK_TRACKFILEID_2, VIDEOSEGMENT0000 ); Unpack( CODESEGMENT0000, VIDEOSEGMENT0000 ); // Draw Transit Line FX PushBank( BANKC1 ); DrawTiles(MASKTYPE_NOMASK, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); bank_memcpy( 0xC6, 0x4080, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE ); bank_memcpy( 0xC7, VIDEOSEGMENT4000, VIDEOSEGMENTC000, VIDEOSEGMENTC000_SIZE ); bank_memcpy( 0xC4, 0x4080, VIDEOSEGMENT0000, VIDEOSEGMENT0000_SIZE); bank_memcpy( 0xC0, 0x7000, VIDEOSEGMENT4000, 0x1000 ); bank_memcpy( 0xC0, 0xE800, 0x5000, 0x1800 ); __asm call _IsScreenFlipped ld a, l call &2800 __endasm; // PATCH bank_memcpy( 0xC0, VIDEOSEGMENTC000, VIDEOSEGMENT4000, VIDEOSEGMENT4000_SIZE ); // Load title PushBank( BANKC1 ); LoadFile( PLASMATITLEBIGFILE_TRACKFILEID, CODESEGMENT4000 ); PopBank(); // Load Cloud LoadFile( PLASMATITLECLOUDBMPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC4, CODESEGMENT0000, VIDEOSEGMENT0000 ); // Apply Part palette LoadFile( PLASMATILE2BMPSPRRAWDATA1PCK_TRACKFILEID_2, VIDEOSEGMENT0000 ); Unpack( VIDEOSEGMENTC000, VIDEOSEGMENT0000 ); UnshiftTile( VIDEOSEGMENTC000 ); PushBank( BANKC1 ); DrawTiles(MASKTYPE_NOMASK, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); WaitVBL(); SetPalette( GetPalette() ); FlipScreen(); // Load title BankUnpack( 0xC0, VIDEOSEGMENT8000, PLASMATITLEBMPTOPBINPCK_PTR ); BankUnpack( 0xC0, VIDEOSEGMENTC000, PLASMATITLEBMPBOTTOMBINPCK_PTR ); PushBank( BANKC3 ); DrawTiles(MASKTYPE_MASK, VIDEOSEGMENT8000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); // Prepare for part bank_memcpy( 0xC6, CODESEGMENT4000, CODESEGMENT0000, CODESEGMENT0000_SIZE ); DrawCloudReverse_VIDEOSEGMENT0000(); FlipScreen(); // Load Cloud LoadFile( PLASMATITLECLOUD3BMPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC4, CODESEGMENT0000, VIDEOSEGMENT0000 ); bank_memcpy( 0xC6, CODESEGMENT4000, CODESEGMENT0000, CODESEGMENT0000_SIZE ); LoadFile( PLASMABACKGROUNDBMPTOPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC6, VIDEOSEGMENT4000, VIDEOSEGMENT0000 ); LoadFile( PLASMADATA1BIGFILEPCK_TRACKFILEID, CODESEGMENT0000 ); PushBank( BANKC1 ); Unpack( CODESEGMENT4000, CODESEGMENT0000 ); PopBank(); bank_memcpy( 0xC0, CODESEGMENTC000, CODESEGMENT4000, CODESEGMENT4000_SIZE ); bank_memcpy( 0xC6, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENT0000_SIZE ); LoadFile( PLASMABACKGROUNDBMPBOTTOMBINPCK_TRACKFILEID, CODESEGMENT0000 ); PushBank( BANKC1 ); Unpack( VIDEOSEGMENT4000, CODESEGMENT0000 ); PopBank(); LoadFile( PLASMATITLECLOUD2BMPBINPCK_TRACKFILEID, VIDEOSEGMENTC000 ); }
// TMessage ctor TMsgDirLoadFromSource::TMsgDirLoadFromSource(const TMessage& theMsgR) : TMessage(theMsgR) { Unpack(); }
// Construct from raw representation Auth1Certificate::Auth1Certificate(const unsigned char* theRawP, unsigned short theLen) : AuthCertificateBase() { mAccessList.push_back(CommunityAccess(0,0)); Unpack(theRawP, theLen); }
bool Package::_OpenForTest(xmlDocPtr doc, const string& basePath) { _opf = doc; _pathBase = basePath; return Unpack(); }