Start of Setharian buffer: Mon Mar 05 16:29:30 2007 Session Ident: Setharian (~adrian.se@icm3-orange.orange.sk) [16:16] hope I won't get DCed [16:17] procedure YNwWorldSocket.ProcessInputBuffer; [16:17] var [16:17] cInPkt: YNwClientPacket; [16:17] pPktHeader: PWorldClientHeader; [16:17] wSize: UInt16; [16:17] begin [16:17] repeat [16:17] if fRecvBuffer.DataSize < 6 then Exit; [16:17] if not fHeaderDone then [16:17] begin [16:17] if fKeySet then HdrXorDecrypt(fHdrXorData, fRecvBuffer[fRecvBuffer.ReadPosition]); [16:17] fHeaderDone := True; [16:17] end; [16:17] pPktHeader := PWorldClientHeader(fRecvBuffer[fRecvBuffer.ReadPosition]); [16:17] if not fKeySet then [16:17] begin [16:17] if (pPktHeader^.Opcode <> CMSG_AUTH_SESSION) and [16:17] (pPktHeader^.Opcode <> CMSG_PING) then [16:17] begin [16:17] fRecvBuffer.Clear; [16:17] Disconnect; [16:17] Exit; [16:17] end; [16:17] end; [16:17] wSize := EndianSwap16(pPktHeader^.Size) + 2; [16:17] if fRecvBuffer.DataSize >= wSize then [16:17] begin [16:17] cInPkt := YNwClientPacket.Create(fRecvBuffer, wSize); [16:18] try [16:18] ProcessOpCode(cInPkt, cInPkt.Header^.Opcode); [16:18] finally [16:18] cInPkt.Free; [16:18] fHeaderDone := False; [16:18] end; [16:18] end else Exit; [16:18] until False; [16:18] end; [16:18] that's all [16:18] it should look something like this, but in C# styke [16:18] style* [16:20] hum... it your "PacketIn" stuff [16:20] hum [16:20] i will save it and take a look [16:20] it is Delphi? [16:20] :) long time i dont see it [16:20] :) [16:21] yes [16:22] fRecvBuffer - circular buffer containg all the incoming data [16:22] I guess you have an equivalent for that [16:22] that packet_something :) [16:22] I closed the bastebin, so not sure how it was named [16:22] it performed .MarshalRead or something [16:24] http://pastebin.ca/382565 [16:24] i think is it [16:24] wth did you add to the sources [16:24] they are 4-times as big [16:24] as last time I've checked [16:24] yeah, right [16:24] packetbuffer [16:26] I'll paste you one more thing [16:26] a class decl [16:26] in Delphi [16:26] actually in C++ it would be similiar [16:26] ok [16:26] but that is what I miss [16:26] in C# [16:26] TTickGenerator = class(TBaseInterfacedObject) [16:26] private [16:26] fThreads: array of TTickThreadHandle; [16:26] fSleepTimeDefault: UInt32; [16:26] fTerminated: Longbool; [16:27] fLock: TReaderWriterLock; [16:27] fEventMap: TStrPtrHashMap; [16:27] fDisabledEventCount: Int32; [16:27] fOnEventRegister: TEventRegisterEvent; [16:27] fOnEventUnregister: TEventUnregisterEvent; [16:27] fOnEventError: TEventExceptionEvent; [16:27] function SpawnThread(ExGroup: Int32; SleepTime: UInt32): TTickThreadHandle; [16:27] function GetEventCount: Int32; [16:27] function GetDisEventCount: Int32; [16:27] procedure ClearEventList; [16:27] function GenerateEventName(Event: TEventHandle): string; [16:27] function LookupEventByName(const Name: string): TEventHandle; [16:27] function LookupThreadInfoByExGroup(ExGroup: Int32): TTickThreadHandle; [16:27] function GetThreadHandle(Index: Int32): TTickThreadHandle; [16:27] procedure Execute(Thread: TThreadHandle); [16:27] procedure DoOnEventRegister(Event: TEventHandle); [16:27] procedure DoOnEventUnregister(Event: TEventHandle); [16:27] procedure DoOnEventException(Event: TEventHandle; ExcObject: Exception); [16:27] public [16:27] constructor Create(SleepTime: UInt32); [16:27] destructor Destroy; override; [16:27] procedure StartActivity; [16:27] procedure StopActivity; [16:27] { Creates and registers a new event using the params specified. } [16:27] function RegisterEvent(Method: TTimedMethod; WaitTime: Int32; Repeats: Int32; Name: string = ''; [16:27] ActivationDelay: Int32 = 0; Flags: TEventFlags = []; [16:27] ExecutionGroup: Int32 = TICK_EXGROUP_DEFAULT; Priority: TEventPriority = epNormal): TEventHandle; [16:27] function RegisterEventEx(Method: TTimedMethod; WaitTime: Int32; Repeats: Int32; [16:27] HandleClass: TEventHandleClass; Name: string = ''; ActivationDelay: Int32 = 0; Flags: TEventFlags = []; [16:27] ExecutionGroup: Int32 = TICK_EXGROUP_DEFAULT; Priority: TEventPriority = epNormal): TEventHandle; [16:27] { Unregisters and destroys an event identified by a valid handle. } [16:27] procedure UnregisterEvent(Event: TEventHandle); [16:27] procedure Terminate; [16:28] property Events[const Name: string]: TEventHandle read LookupEventByName; [16:28] property EventCount: Int32 read GetEventCount; [16:28] property DisabledEvents: Int32 read GetDisEventCount; [16:28] property Terminated: Longbool read fTerminated; [16:28] property Threads[ExecutionGroup: Int32]: TTickThreadHandle read GetThreadHandle; [16:28] property OnEventRegister: TEventRegisterEvent read fOnEventRegister write fOnEventRegister; [16:28] property OnEventUnregister: TEventUnregisterEvent read fOnEventUnregister write fOnEventUnregister; [16:28] property OnEventException: TEventExceptionEvent read fOnEventError write fOnEventError; [16:28] end; [16:28] well [16:28] as you may have noticed [16:28] all the declaration is without implementation [16:28] so you just see [16:28] the method prototypes [16:28] all at one place [16:28] ok [16:28] that's just soooo nice and clean End of Setharian buffer Mon Mar 05 16:29:30 2007