This commit is contained in:
mysticbbs 2013-05-06 20:07:28 -04:00
parent de20817ca8
commit cd4983db0b
5 changed files with 34 additions and 24 deletions

View File

@ -11,7 +11,7 @@ Procedure BitSet (B: Byte; Size: Byte; Var Temp; IsOn: Boolean);
Implementation
Const
Bit : Array[1..32] of LongInt = (
Bit : Array[1..32] of Cardinal = (
$00000001, $00000002,
$00000004, $00000008,
$00000010, $00000020,

View File

@ -1,7 +1,7 @@
{$I M_OPS.PAS} {$R-}
Unit m_Input_Windows;
{$I M_OPS.PAS}
Interface
Uses
@ -21,7 +21,7 @@ Type
Procedure AddBuffer (Ch: Char);
Function RemapScanCode (ScanCode: Word; CtrlKeyState: dWord; Keycode: Word) : Byte;
Function ProcessQueue : Boolean;
Function KeyWait (MS: LongInt) : Boolean;
Function KeyWait (MS: Cardinal) : Boolean;
Function KeyPressed : Boolean;
Function ReadKey : Char;
End;
@ -168,7 +168,7 @@ Begin
Until NumRead = 0;
End;
Function TInputWindows.KeyWait (MS: LongInt) : Boolean;
Function TInputWindows.KeyWait (MS: Cardinal) : Boolean;
Begin
If BufPos <> BufSize Then Begin
Result := True;

View File

@ -85,6 +85,7 @@ End;
Function TIOBase.WriteBuf (Var Buf; Len: LongInt) : LongInt;
Begin
Result := 0;
End;
Procedure TIOBase.BufFlush;
@ -101,30 +102,37 @@ End;
Function TIOBase.ReadChar : Char;
Begin
Result := #0;
End;
Function TIOBase.PeekChar (Num: Byte) : Char;
Begin
Result := #0;
End;
Function TIOBase.ReadBuf (Var Buf; Len: LongInt) : LongInt;
Begin
Result := 0;
End;
Function TIOBase.ReadLine (Var Str: String) : LongInt;
Begin
Result := 0;
End;
Function TIOBase.WriteStr (Str: String) : LongInt;
Begin
Result := 0;
End;
Function TIOBase.WriteLine (Str: String) : LongInt;
Begin
Result := 0;
End;
Function TIOBase.WaitForData (TimeOut: LongInt) : LongInt;
Begin
Result := 0;
End;
End.

View File

@ -65,7 +65,7 @@ Type
Function WaitForData (TimeOut: LongInt) : LongInt; Override;
Function Connect (Address: String; Port: Word) : Boolean;
Function ResolveAddress (Host: String) : LongInt;
Procedure WaitInit (Port: Word);
Procedure WaitInit (NetInterface: String; Port: Word);
Function WaitConnection : TIOSocket;
Function PeekChar (Num: Byte) : Char; Override;
@ -564,7 +564,7 @@ Begin
Result := fpConnect(FSocketHandle, @Sin, SizeOf(Sin)) = 0;
End;
Procedure TIOSocket.WaitInit (Port: Word);
Procedure TIOSocket.WaitInit (NetInterface: String; Port: Word);
Var
SIN : TINetSockAddr;
Opt : LongInt;
@ -576,10 +576,12 @@ Begin
fpSetSockOpt (FSocketHandle, SOL_SOCKET, SO_REUSEADDR, @Opt, SizeOf(Opt));
SIN.sin_family := PF_INET;
SIN.sin_addr.s_addr := 0;
// SIN.sin_addr.s_addr := 0;
SIN.sin_addr := StrToNetAddr(NetInterface);
SIN.sin_port := htons(Port);
{$IFDEF TNDEBUG}
TNLOG('Attempting to bind to interface ' + NetInterface + ' (' + strI2S(SIN.sin_addr.s_addr) + ')');
TNLOG('WaitInit Bind');
If fpBind(FSocketHandle, @SIN, SizeOf(SIN)) <> 0 Then
TNLOG('WaitInit Bind Failed')

View File

@ -170,38 +170,38 @@ End;
Procedure TOutputWindows.ClearEOL;
Var
Count : Byte;
Res : LongInt;
Count : Byte;
BufSize : TCoord;
BufCoord : TCoord;
Region : TSmallRect;
Begin
Count := Window.Right - Cursor.X + 1;
FillDWord (Buffer[Cursor.Y + 1][Cursor.X + 1], Count, (Word(TextAttr) SHL 16) OR Word($0020));
If Active Then Begin
FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);
FillConsoleOutputAttribute (ConOut, TextAttr, Count, Cursor, @Res);
BufSize.X := Count - 1;
BufSize.Y := 1;
BufCoord.X := 0;
BufCoord.Y := 0;
Region.Left := Cursor.X;
Region.Top := Cursor.Y;
Region.Right := Cursor.X + Count - 1;
Region.Bottom := Cursor.Y;
WriteConsoleOutput(ConOut, @Buffer[Cursor.Y + 1][Cursor.X + 1], BufSize, BufCoord, Region);
End;
End;
(*
Procedure TOutputWindows.ClearEOL;
Var
Buf : Array[1..80] of TCharInfo;
Count : Byte;
Res : LongInt;
Begin
If Window.Right = Cursor.X Then Exit;
Count := Window.Right - Cursor.X + 1;
Count := 0;
While Count <= Window.Right - Cursor.X Do Begin
Inc (Count);
Buf[Count].Attributes := TextAttr;
Buf[Count].UnicodeChar := ' ';
End;
Move(Buf[1], Buffer[Cursor.Y + 1][Cursor.X + 1], SizeOf(TCharInfo) * Count);
FillDWord (Buffer[Cursor.Y + 1][Cursor.X + 1], Count, (Word(TextAttr) SHL 16) OR Word($0020));
If Active Then Begin
FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);