mirror of
https://github.com/jie65535/JMods.git
synced 2025-06-02 17:39:12 +08:00
first commit
This commit is contained in:
commit
20c2ec8c03
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
debug.log
|
50
Debugger.py
Normal file
50
Debugger.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import socket
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# 监听的地址和端口
|
||||||
|
HOST = '127.0.0.1'
|
||||||
|
PORT = 12345
|
||||||
|
|
||||||
|
# 定义信号处理函数
|
||||||
|
def signal_handler(sig, frame):
|
||||||
|
print('\nExiting...')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# 设置信号处理程序
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
signal.signal(signal.SIGTERM, signal_handler)
|
||||||
|
|
||||||
|
# 创建TCP socket
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server_socket:
|
||||||
|
# 设置socket选项,允许地址重用
|
||||||
|
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
# 绑定地址和端口
|
||||||
|
server_socket.bind((HOST, PORT))
|
||||||
|
# 开始监听
|
||||||
|
server_socket.listen(1)
|
||||||
|
print(f"Listening on {HOST}:{PORT}...")
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
# 接受连接
|
||||||
|
conn, addr = server_socket.accept()
|
||||||
|
with conn:
|
||||||
|
print(f"Connected by {addr}")
|
||||||
|
|
||||||
|
# 打开/创建debug.log文件
|
||||||
|
with open("debug.log", "a") as log_file:
|
||||||
|
while True:
|
||||||
|
data = conn.recv(1024)
|
||||||
|
if not data:
|
||||||
|
print(f"Connection closed by {addr}")
|
||||||
|
break
|
||||||
|
# 将收到的消息写入到控制台和日志文件中
|
||||||
|
msg = data.decode('utf-8')
|
||||||
|
print(msg)
|
||||||
|
log_file.write(msg)
|
||||||
|
log_file.flush()
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\nKeyboardInterrupt: Exiting...')
|
||||||
|
sys.exit(0)
|
BIN
JCursor/Cursor.png
Normal file
BIN
JCursor/Cursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
67
JCursor/JCursor.lua
Normal file
67
JCursor/JCursor.lua
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
--- STEAMODDED HEADER
|
||||||
|
--- MOD_NAME: J Cursor
|
||||||
|
--- MOD_ID: JCursor
|
||||||
|
--- MOD_AUTHOR: [Jie65535]
|
||||||
|
--- MOD_DESCRIPTION: Custom Cursor (./Mods/JCursor/Cursor.png)
|
||||||
|
|
||||||
|
----------------------------------------------
|
||||||
|
------------MOD CODE -------------------------
|
||||||
|
|
||||||
|
SMODS.registerUIElement("JCursor", {
|
||||||
|
{
|
||||||
|
n = G.UIT.R,
|
||||||
|
config = {
|
||||||
|
padding = 0.2,
|
||||||
|
align = "cm"
|
||||||
|
},
|
||||||
|
nodes = {
|
||||||
|
UIBox_button({
|
||||||
|
minw = 3.85,
|
||||||
|
button = "openModDirectory",
|
||||||
|
label = {
|
||||||
|
"Open directory"
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
UIBox_button({
|
||||||
|
minw = 3.85,
|
||||||
|
button = "refreshCursor",
|
||||||
|
label = {
|
||||||
|
"Refresh cursor"
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
local function getModDirectory()
|
||||||
|
return "/Mods/JCursor"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getCursorFile()
|
||||||
|
return getModDirectory() .. "/Cursor.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function setCursor(filename)
|
||||||
|
cursor = love.mouse.newCursor(filename, 0, 0)
|
||||||
|
love.mouse.setCursor(cursor)
|
||||||
|
end
|
||||||
|
|
||||||
|
function G.FUNCS.openModDirectory(arg_736_0)
|
||||||
|
sendDebugMessage("openModDirectory")
|
||||||
|
love.system.openURL("file://" .. love.filesystem.getSaveDirectory() .. getModDirectory())
|
||||||
|
end
|
||||||
|
|
||||||
|
function G.FUNCS.refreshCursor(arg_736_0)
|
||||||
|
sendDebugMessage("refreshCursor")
|
||||||
|
setCursor(getCursorFile())
|
||||||
|
end
|
||||||
|
|
||||||
|
local defaultCursor = getCursorFile()
|
||||||
|
if love.filesystem.exists(defaultCursor) then
|
||||||
|
setCursor(defaultCursor)
|
||||||
|
end
|
||||||
|
|
||||||
|
sendDebugMessage("JCursor loaded!")
|
||||||
|
|
||||||
|
----------------------------------------------
|
||||||
|
------------MOD CODE END----------------------
|
14
JDumper.lua
Normal file
14
JDumper.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
--- STEAMODDED HEADER
|
||||||
|
--- MOD_NAME: J Dumper
|
||||||
|
--- MOD_ID: JDumper
|
||||||
|
--- MOD_AUTHOR: [Jie65535]
|
||||||
|
--- MOD_DESCRIPTION: Dump all game information!
|
||||||
|
|
||||||
|
----------------------------------------------
|
||||||
|
------------MOD CODE -------------------------
|
||||||
|
|
||||||
|
|
||||||
|
sendDebugMessage("J Dumper Activated!")
|
||||||
|
|
||||||
|
----------------------------------------------
|
||||||
|
------------MOD CODE END----------------------
|
Loading…
Reference in New Issue
Block a user