Removed all excess whitespace and standardized line endings.

This commit is contained in:
m3rein
2020-09-05 21:23:16 +02:00
parent caed5bd757
commit 240af4e5e7
219 changed files with 929 additions and 929 deletions

View File

@@ -208,4 +208,4 @@ end
def nil_or_empty?(string)
return string.nil? || !string.is_a?(String) || string.size == 0
end
end

View File

@@ -32,8 +32,8 @@ class Win32API
def call(*args)
if @w32name!="GetAsyncKeyState"
File.open("winapi.txt","ab") { |f|
f.write("call(#{@w32dll},#{@w32name},#{args.inspect})\r\n")
File.open("winapi.txt","ab") { |f|
f.write("call(#{@w32dll},#{@w32name},#{args.inspect})\r\n")
}
end
debug_call(*args)
@@ -605,4 +605,4 @@ module RPG
# def play
# end
end
end
end

View File

@@ -22,7 +22,7 @@ class Win32API
wndthreadid = @@GetWindowThreadProcessId.call(nextwindow,processid)
if wndthreadid==threadid
@@RGSSWINDOW = nextwindow
return @@RGSSWINDOW
return @@RGSSWINDOW
end
end
end until nextwindow==0
@@ -62,7 +62,7 @@ class Win32API
hWnd = pbFindRgssWindow
window.call(hWnd,9)
end
def Win32API.fillScreen
setWindowLong = Win32API.new('user32','SetWindowLong','LLL','L')
setWindowPos = Win32API.new('user32','SetWindowPos','LLIIIII','I')
@@ -75,8 +75,8 @@ class Win32API
Win32API.focusWindow
return [width,height]
end
def Win32API.restoreScreen
def Win32API.restoreScreen
setWindowLong = Win32API.new('user32','SetWindowLong','LLL','L')
setWindowPos = Win32API.new('user32','SetWindowPos','LLIIIII','I')
metrics = Win32API.new('user32','GetSystemMetrics','I','I')
@@ -101,4 +101,4 @@ end
# Well done for finding this place.
# DO NOT EDIT THESE
ESSENTIALS_VERSION = "18"
ERROR_TEXT = ""
ERROR_TEXT = ""

View File

@@ -3,7 +3,7 @@ module Win32
buf = "\0" * len
Win32API.new("kernel32", "RtlMoveMemory", "ppl", "").call(buf, self, len)
buf
end
end
end
@@ -41,13 +41,13 @@ module Winsock
#-----------------------------------------------------------------------------
def self.closesocket(*args)
Win32API.new(DLL, "closesocket", "p", "l").call(*args)
end
end
#-----------------------------------------------------------------------------
# * Connect
#-----------------------------------------------------------------------------
def self.connect(*args)
Win32API.new(DLL, "connect", "ppl", "l").call(*args)
end
end
#-----------------------------------------------------------------------------
# * Get host (Using Adress)
#-----------------------------------------------------------------------------
@@ -95,7 +95,7 @@ module Winsock
#-----------------------------------------------------------------------------
def self.inet_ntoa(*args)
Win32API.new(DLL, "inet_ntoa", "l", "p").call(*args)
end
end
#-----------------------------------------------------------------------------
# * Listen
#-----------------------------------------------------------------------------
@@ -125,7 +125,7 @@ module Winsock
#-----------------------------------------------------------------------------
def self.setsockopt(*args)
Win32API.new(DLL, "setsockopt", "pllpl", "l").call(*args)
end
end
#-----------------------------------------------------------------------------
# * Shutdown
#-----------------------------------------------------------------------------
@@ -136,7 +136,7 @@ module Winsock
# * Socket
#-----------------------------------------------------------------------------
def self.socket(*args)
Win32API.new(DLL, "socket", "lll", "l").call(*args)
Win32API.new(DLL, "socket", "lll", "l").call(*args)
end
#-----------------------------------------------------------------------------
# * Get Last Error
@@ -162,12 +162,12 @@ class Socket
#-----------------------------------------------------------------------------
# * Constants
#-----------------------------------------------------------------------------
AF_UNSPEC = 0
AF_UNSPEC = 0
AF_UNIX = 1
AF_INET = 2
AF_IPX = 6
AF_APPLETALK = 16
PF_UNSPEC = 0
PF_UNSPEC = 0
PF_UNIX = 1
PF_INET = 2
PF_IPX = 6
@@ -244,13 +244,13 @@ class Socket
AI_V4MAPPED = 2048
#--------------------------------------------------------------------------
# * Returns the associated IP address for the given hostname.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def self.getaddress(host)
gethostbyname(host)[3].unpack("C4").join(".")
end
#--------------------------------------------------------------------------
# * Returns the associated IP address for the given hostname.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def self.getservice(serv)
case serv
when Numeric
@@ -271,7 +271,7 @@ class Socket
end
#--------------------------------------------------------------------------
# * Returns the user's hostname.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def self.gethostname
buf = "\0" * 256
Winsock.gethostname(buf, 256)
@@ -305,7 +305,7 @@ class Socket
end
#--------------------------------------------------------------------------
# * Creates an INET-sockaddr struct.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def self.sockaddr_in(port, host)
begin
[AF_INET, getservice(port)].pack("sn") + gethostbyname(host)[3] + [].pack("x8")
@@ -319,7 +319,7 @@ class Socket
end
#--------------------------------------------------------------------------
# * Creates a new socket and connects it to the given host and port.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def self.open(*args)
socket = new(*args)
if block_given?
@@ -333,14 +333,14 @@ class Socket
end
#--------------------------------------------------------------------------
# * Creates a new socket.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def initialize(domain, type, protocol)
SocketError.check if (@fd = Winsock.socket(domain, type, protocol)) == -1
@fd
end
#--------------------------------------------------------------------------
# * Accepts incoming connections.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def accept(flags = 0)
buf = "\0" * 16
SocketError.check if Winsock.accept(@fd, buf, flags) == -1
@@ -348,21 +348,21 @@ class Socket
end
#--------------------------------------------------------------------------
# * Binds a socket to the given sockaddr.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def bind(sockaddr)
SocketError.check if (ret = Winsock.bind(@fd, sockaddr, sockaddr.size)) == -1
ret
end
#--------------------------------------------------------------------------
# * Closes a socket.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def close
SocketError.check if (ret = Winsock.closesocket(@fd)) == -1
ret
end
#--------------------------------------------------------------------------
# * Connects a socket to the given sockaddr.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def connect(sockaddr)
#return if Network.testing? == 2
SocketError.check if (ret = Winsock.connect(@fd, sockaddr, sockaddr.size)) == -1
@@ -370,28 +370,28 @@ class Socket
end
#--------------------------------------------------------------------------
# * Listens for incoming connections.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def listen(backlog)
SocketError.check if (ret = Winsock.listen(@fd, backlog)) == -1
ret
end
#--------------------------------------------------------------------------
# * Checks waiting data's status.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def select(timeout) # timeout in seconds
SocketError.check if (ret = Winsock.select(1, [1, @fd].pack("ll"), 0, 0, [timeout.to_i,
SocketError.check if (ret = Winsock.select(1, [1, @fd].pack("ll"), 0, 0, [timeout.to_i,
(timeout * 1000000).to_i].pack("ll"))) == -1
ret
end
#--------------------------------------------------------------------------
# * Checks if data is waiting.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def ready?
not select(0) == 0
end
end
#--------------------------------------------------------------------------
# * Reads data from socket.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def read(len)
buf = "\0" * len
Win32API.new("msvcrt", "_read", "lpl", "l").call(@fd, buf, len)
@@ -399,7 +399,7 @@ class Socket
end
#--------------------------------------------------------------------------
# * Returns received data.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def recv(len, flags = 0)
retString=""
remainLen=len
@@ -415,7 +415,7 @@ class Socket
end
#--------------------------------------------------------------------------
# * Sends data to a host.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def send(data, flags = 0)
SocketError.check if (ret = Winsock.send(@fd, data, data.size, flags)) == -1
ret
@@ -423,7 +423,7 @@ class Socket
#--------------------------------------------------------------------------
# * Recieves file from a socket
# size : file size
# scene : update scene boolean
# scene : update scene boolean
#--------------------------------------------------------------------------
def recv_file(size,scene=false,file="")
data = []
@@ -464,12 +464,12 @@ class Socket
break if ch == "\n"
message += ch
end
# Return recieved data
# Return recieved data
return message
end
#--------------------------------------------------------------------------
# * Writes data to socket.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def write(data)
Win32API.new("msvcrt", "_write", "lpl", "l").call(@fd, data, 1)
end
@@ -490,7 +490,7 @@ end
class TCPSocket < Socket
#--------------------------------------------------------------------------
# * Creates a new socket and connects it to the given host and port.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def self.open(*args)
socket = new(*args)
if block_given?
@@ -504,7 +504,7 @@ class TCPSocket < Socket
end
#--------------------------------------------------------------------------
# * Creates a new socket and connects it to the given host and port.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
def initialize(host, port)
super(AF_INET, SOCK_STREAM, IPPROTO_TCP)
connect(Socket.sockaddr_in(port, host))
@@ -526,7 +526,7 @@ class SocketError < StandardError
#if not Network.testing? == 1
raise Errno.const_get(Errno.constants.detect { |c| Errno.const_get(c).new.errno == errno })
#else
# errno != 0 ? (Network.testresult(true)) : (Network.testresult(false))
# errno != 0 ? (Network.testresult(true)) : (Network.testresult(false))
#end
end
end
@@ -669,7 +669,7 @@ def pbDownloadToString(url)
return data
rescue
return ""
end
end
end
def pbDownloadToFile(url, file)
@@ -685,7 +685,7 @@ def pbPostToString(url, postdata)
return data
rescue
return ""
end
end
end
def pbPostToFile(url, postdata, file)
@@ -693,4 +693,4 @@ def pbPostToFile(url, postdata, file)
pbPostData(url, postdata,file)
rescue
end
end
end

View File

@@ -3,7 +3,7 @@ module Console
GENERIC_READ = 0x80000000
GENERIC_WRITE = 0x40000000
FILE_SHARE_READ = 0x00000001
FILE_SHARE_WRITE = 0x00000002
FILE_SHARE_WRITE = 0x00000002
CONSOLE_TEXTMODE_BUFFER = 0x00000001
def Console::AllocConsole
@@ -76,7 +76,7 @@ module Console
echo "Debug Output:\n"
echo "-------------------------------\n\n"
SetConsoleActiveScreenBuffer(@bufferHandle)
end
end
def self.readInput
length=20
@@ -113,7 +113,7 @@ module Console
def self.readInput2
buffer=0.chr
done=false
input=""
input=""
eventsread=0.chr*4
while !done
if ReadConsole(buffer)==0
@@ -155,4 +155,4 @@ module Kernel
echo(string)
echo("\r\n")
end
end
end

View File

@@ -665,7 +665,7 @@ class Bitmap
SwapRgb = Win32API.new('./rubyscreen.dll', 'SwapRgb', 'pi', '') rescue nil
def setData(x)
RtlMoveMemory_ip.call(self.address, x, x.length)
RtlMoveMemory_ip.call(self.address, x, x.length)
end
def getData
@@ -677,7 +677,7 @@ class Bitmap
def swap32(x)
return ((x>>24)&0x000000FF)|
((x>>8)&0x0000FF00)|
((x<<8)&0x00FF0000)|
((x<<8)&0x00FF0000)|
((x<<24)&0xFF000000)
end
@@ -716,7 +716,7 @@ class Bitmap
b=0;c=2;while b!=len
data2[b]=data[c]
data2[c]=data[b]
b+=4;c+=4;
b+=4;c+=4;
end
end
#$times.push(Time.now-ttt)
@@ -754,4 +754,4 @@ class Bitmap
end
return @address
end
end
end

View File

@@ -340,7 +340,7 @@ module PluginManager
return if !installed?(plugin_name)
return @@Plugins[plugin_name][:link]
end
# Returns the credits of the specified plugin.
def self.credits(plugin_name)
return if !installed?(plugin_name)
@@ -373,4 +373,4 @@ module PluginManager
end
return 0
end
end
end