silksong-coop-mod 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/INSTALL.bat ADDED
@@ -0,0 +1,16 @@
1
+ @echo off
2
+ chcp 65001 >nul 2>&1
3
+ title Silksong co-op (SSMP) installer
4
+
5
+ rem Runs the real installer next to this file. -ExecutionPolicy Bypass applies to this one run only and changes
6
+ rem nothing on the machine. pwsh is preferred when present, because it handles text encoding better.
7
+
8
+ where pwsh >nul 2>&1
9
+ if %errorlevel%==0 (
10
+ pwsh -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1"
11
+ ) else (
12
+ powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0install.ps1"
13
+ )
14
+
15
+ echo.
16
+ pause
package/INSTALL.txt ADDED
@@ -0,0 +1,258 @@
1
+ 丝之歌联机模组(SSMP 自制版)——一键安装
2
+ ==========================================
3
+
4
+ 这是 SSMP 联机模组的一个自制版本,比公开版多了「双人存档」:
5
+ 两个人共用一条流程,任务、世界变化、剧情道具会互相同步。
6
+
7
+ 重要:两个人必须装【同一份】这个压缩包,不能一个人用公开版。
8
+
9
+ 【从这一版开始,版本不一致会被直接拦住。】
10
+ 加入房间时会比对双方的版本,不一样就不让连,并且明确告诉你
11
+ 「你们装的版本不同」,而不是连上之后表现出一堆对不上的怪事。
12
+
13
+ ※ 代价是:这一版【不认识任何旧版本】。
14
+ 所以【两个人必须一起换成这一版】,只有一个人装的话,
15
+ 你们会连不上——这是正常的,不是坏了。
16
+ 这笔账只付一次,以后就不会再有「一个人更了一个人没更」还不知情的情况。
17
+
18
+ (顺带更正我之前在这里写错的话:我原先说「版本不一致配对时会提示」,
19
+ 那时候是【不对的】,当时根本没有任何东西在比对版本。现在才是真的。)
20
+
21
+ 【这个包是完全离线的】模组加载器已经放在包里,
22
+ 安装过程不需要联网,不用梯子,也不受任何网站能不能打开的影响。
23
+
24
+
25
+ 一、怎么装(双击一下就行)
26
+ --------------------------
27
+
28
+ 1. 把这个压缩包【完整解压】到任意位置(比如桌面)。
29
+ 不要只解压出单个文件,INSTALL.bat、SSMP 文件夹和
30
+ BepInEx_win_x64_5.4.23.4.zip 必须在一起。
31
+
32
+ 2. 双击 INSTALL.bat。
33
+
34
+ 3. 等它跑完,看到绿色的 Done 就好了。
35
+
36
+ 它会自己做这几件事:
37
+ - 找到你的 Silksong 安装位置(找不到会让你把路径粘进去)
38
+ - 先把你的存档备份成 zip,放在这个文件夹里的 save-backups\ 下
39
+ (只留最近 3 份,更旧的会自动删掉;它不会碰别的文件)
40
+ - 用包里自带的加载器装好(不联网)
41
+ - 把联机插件放进去
42
+ - 最后检查一遍有没有装成功
43
+
44
+ 窗口里的提示是英文的,因为 Windows 自带的 PowerShell 显示中文
45
+ 经常是乱码,英文反而不会出错。
46
+
47
+
48
+ 二、这个脚本安全吗
49
+ ------------------
50
+
51
+ - 它只往【游戏目录】写东西,外加一个存档备份。
52
+ 不改注册表、不改系统设置、不装任何后台程序、不联网。
53
+ - 不需要管理员权限(除非你的游戏装在 C:\Program Files 里)。
54
+ - 想卸载:把游戏目录里的 BepInEx 文件夹、winhttp.dll、
55
+ doorstop_config.ini、.doorstop_version、changelog.txt
56
+ 删掉就完全干净了。
57
+
58
+ 包里那个 BepInEx_win_x64_5.4.23.4.zip 是 BepInEx 官方在 GitHub
59
+ 上发布的原版文件,没有改动过,大小 638,940 字节。
60
+
61
+ 有一点要提前说:BepInEx 这类模组加载器的工作方式,是在游戏
62
+ exe 旁边放一个 dll,让游戏启动时连带加载它。这是所有同类
63
+ 加载器的通用做法,但这个手法和某些恶意软件相同,所以
64
+ 【杀毒软件有时会报毒】。看到告警是这个原因,不是脚本在干别的。
65
+
66
+ 真正的风险不在系统,在存档:模组有可能弄坏存档,
67
+ 所以脚本会先备份。
68
+
69
+
70
+ 三、怎么一起玩
71
+ --------------
72
+
73
+ 1. 【从 Steam 启动游戏】,不要直接双击 exe。
74
+
75
+ 2. 一个人开房:选 "Steam" 那一页,点 Create Lobby。
76
+ 开完房不会直接进游戏,而是停在一个【等待室】里。
77
+
78
+ 3. 房主在等待室里点 INVITE FRIEND,会直接弹出 Steam 的邀请框,
79
+ 不用自己去找 Steam 覆盖层。对方接受邀请就会进到同一个等待室。
80
+
81
+ 4. 两个人各自点一次 I'M READY。
82
+ 名单上能看到对方是 READY 还是 NOT READY。
83
+ 【两个人都 READY 之后】,两边才会同时打开各自的选存档界面。
84
+ 反悔就再点一次取消。
85
+
86
+ 5. 进游戏后,屏幕上方会出现一行字,
87
+ 写着「按 L 和 XXX 组成双人存档」。
88
+ 两个人都按一下 L 就配对好了。
89
+ 不想配对就别理它,它会自己消失。
90
+
91
+ 【用手柄的话按下左摇杆(L3)】,和 L 是同一件事。
92
+ 屏幕上那行字会自己判断你在用键盘还是手柄,显示你真正该按的那个。
93
+
94
+ (配对键原来是 J,这一版改成了 L。因为 J 是游戏自己
95
+ 「打开背包并翻到笔记页」的默认键,按一下会同时干两件事。
96
+ L 在游戏的默认键位里没人用。)
97
+
98
+ 6. 之后这两个存档必须两个人都在线才能打开。
99
+ 如果对方不来、或者两边一直停在「Waiting for XXX」不动,
100
+ 你会被定住不能移动,屏幕上会写着在等谁。
101
+ 【这时按 K】就能退出双人存档、自己单独玩。
102
+ 注意:这只解开你这边,对方要自己也按一次 K。
103
+
104
+ ※ 不要去聊天框打 /coopsave off。被定住的时候聊天框打不开;
105
+ 而且只要对方还在线,那条指令也只是【请求对方同意】,
106
+ 并不会放你走。K 才是真正的出路。
107
+
108
+
109
+ 四、第一次玩的建议
110
+ ------------------
111
+
112
+ * 两个人都【开新档】。
113
+ 配对会检查双方已击败的 Boss 是否一致,老档大概率对不上。
114
+
115
+ * 连接和等待室都已经实测跑通过(中国 ↔ 马来西亚,走 Steam 中继)。
116
+
117
+ * 【之前卡在「Waiting for XXX」的原因已经找到并修掉了】
118
+ 服务器把所有玩家的网络数据放在同一个拼包缓冲区里,而且是先拼字节、
119
+ 后判断这包是谁发的。双人存档要同步的世界进度是全游戏唯一一个
120
+ 大到需要拆包发送的数据,一拆包,两个人的数据就会被粘在一起,
121
+ 连接的分帧从此错乱、五秒后超时重连,于是校验永远走不完。
122
+
123
+ 这也解释了为什么配对、聊天、看到对方走路一直都正常——
124
+ 那些包都很小,从来不需要拆。
125
+
126
+ 现在每条连接各用各的缓冲区。
127
+ 【这个修复已经实机验证通过】,两个人已经正常连上并一起玩过了。
128
+ 万一还卡:按 K 脱身,然后把两边的日志都发回来。
129
+
130
+ 备份脚本会自动做,位置见上面第一节。
131
+
132
+ * 【从这一版开始,敌人和 Boss 才是真正同步的】
133
+ 在这之前,控制这件事的开关默认是关的,而且没有任何界面能打开它,
134
+ 所以你们其实是各打各的:同一只怪在你这边死了、在她那边还站着,
135
+ 打完的记录也只记在动手的那个人身上。
136
+ 现在这个开关被固定为常开,配置文件里存着的旧设置不再起作用。
137
+ 【两个人都必须重装这一版】,只有一个人装是没用的。
138
+
139
+ 顺带说一句:Boss 的击败记录本来就是各记各的,不会互相抄,
140
+ 这是当初定好的规则(剧情进度共享,战绩和拾取各归各的)。
141
+ 所以如果一个人已经打过、另一个人没打过,
142
+ 那只怪在没打过的那个人的世界里还在,两个人可以一起再打一遍,
143
+ 这次两边都会拿到记录。
144
+
145
+ * 【茧:平时各看各的;但你死了之后,队友可以把你拉起来】
146
+ 平时的规则没变:你只看得见【自己】的茧,对方也碰不到你的。
147
+
148
+ 新加的是救人。你死掉之后【不会立刻回长椅】,会先在原地等一会儿,
149
+ 最多 45 秒。这段时间里,你的茧会出现在【队友】那边,
150
+ 她打【5 下】就能把你拉起来:
151
+ 在你倒下的地方站起来,血量是你上限的【一半】(向下取整),
152
+ 茧里的钱和丝也一起还给你,等于这一次没白死。
153
+
154
+ 等的时候屏幕上有一行字,写着在等谁、对方已经打了几下。
155
+ 不想等了就【按 K】,立刻回长椅、按原来的规则结算,
156
+ 你的茧同时从队友那边消失。等满 45 秒没人来,也一样自动回长椅。
157
+ (注意:这里的 K 只是「不等了」,不会解除你们的双人存档。)
158
+
159
+ 【两个人都死了,就都直接回长椅】,不会互相干等,
160
+ 也不会出现谁站在那儿等一个同样躺着的人。
161
+
162
+ 这一条是刚写的,【还没有实机验证过】。
163
+ 真卡住不动了(按理说等满 45 秒一定会自己回长椅),
164
+ Alt+F4 强退就行,存档还停在上一次保存的地方。
165
+
166
+ 这里原本藏着一个很隐蔽的问题,已经修掉:
167
+ 两个人的茧在各自游戏里【名字完全一样】,而模组会把「打碎世界物件」
168
+ 这类命中按名字转发给对方重放。于是她打她自己的茧,
169
+ 你这边被打碎的是【你的】茧——而且和你们死在哪儿没关系,
170
+ 隔着半个房间照样会中。茧里的钱是记在存档里的,
171
+ 被这样打掉会直接结算掉、还会抹掉你那个茧的记录。
172
+ 现在茧被排除在转发之外,对方攻击的副本也碰不到它。
173
+ 你自己打自己的茧,一切照旧。
174
+
175
+ * 【修掉了「后进房间的人,满屋子怪全定住」】
176
+ 只要你走进一个对方已经清过的房间,那些怪在你这边会全部卡死不动。
177
+ 原因是服务器只记得「这怪没血了」,却不记得「它死过」,
178
+ 于是你这边的怪变成了一具零血的活尸:它每一帧都想死,
179
+ 每一帧都被模组挡回去,一个房间能刷出七千多次,整屋子就此卡住。
180
+ 现在补状态时会把这类怪真正结算掉一次,进门看到的是尸体而不是活尸。
181
+
182
+ * 【昵称会记住了】
183
+ 以前只有「直连 IP」和「直连开房」两条路会保存昵称,而你们用的是 Steam
184
+ 开房 / 加入 / 房间列表,这几条一条都不保存 —— 所以不是你忘了填,
185
+ 是它在你的用法下从来没存过。现在填一次就记住,下次自动带出来。
186
+
187
+ * 【进游戏之后不用再碰键盘了】
188
+ 配对(L)和放弃等待(K)这两个动作,手柄都可以【按下左摇杆】来完成。
189
+ 选左摇杆是因为它是游戏唯一没占用的按钮 —— 扳机、肩键、四个面键、
190
+ 右摇杆按下、旁边那两个键,游戏全都用掉了。
191
+ 这两个动作不会同时出现(没配对时才问你要不要配对,配对了才谈得上放弃),
192
+ 所以共用一个键不会冲突。
193
+ 聊天键故意没给手柄绑:手柄本来就打不了字,绑了也只是开一个填不进去的框。
194
+
195
+ ※ 联机大厅(连接、房间列表、等待室)目前仍然要用鼠标键盘,这是你定的。
196
+
197
+ * 【手柄在选存档界面按不进去,这一版尝试修了】
198
+ 原因是模组会自己建一套界面输入系统,而负责「在菜单里把它关掉」的代码
199
+ 是挂在场景切换上的 —— 但模组本身就是在主菜单里启动的,此后到进游戏
200
+ 之前根本不会再切场景,所以它整个菜单流程都开着。现在它一建出来
201
+ 就先判断一次当前场景。
202
+
203
+ 顺便解释那个最奇怪的地方:为什么手柄能上下切换存档却按不进去,
204
+ 键盘却可以。游戏判定「确认」时分成两支——
205
+ 键盘那支除了确认键还认【跳跃键】,手柄那支【只认确认键】,没有替补。
206
+ 所以确认信号一旦出不来,键盘还有后路,手柄直接没辙。
207
+
208
+ ※ 这一条【没有实机验证过】。如果还是按不进去,
209
+ 把游戏目录下 BepInEx\LogOutput.log 发我:这一版特意在进选存档界面时
210
+ 写了一行「Save selection is driven by ...」,那行字会直接说明
211
+ 是谁在管这个界面,不用再猜。
212
+
213
+ * 聊天框默认按 Y 打开,打 /help 可以看到所有指令。
214
+
215
+ * 【修掉了「在聊天框打字会误触发快捷键」】
216
+ 以前模组只屏蔽了游戏自己的操作,没屏蔽它自己的快捷键。
217
+ 所以在聊天框里打一句带 k 的话(比如「ok」)就等于按了一次 K ——
218
+ 配上新的救人机制,那就是当场放弃等救援、直接回长椅;
219
+ 打带配对键的字则会发一次配对请求。
220
+ 现在聊天框一打开,模组自己的快捷键就整个关掉,关掉聊天再恢复。
221
+ 另外 Enter 以前在聊天关着的时候也会白触发一次,现在不会了。
222
+
223
+ * 【模组界面跟着游戏语言走】
224
+ 以前模组自己的字全是英文,游戏明明是中文的,
225
+ 一到模组这儿就换语言。
226
+ 现在游戏设成中文,联机界面、聊天里的提示、
227
+ 等人和救人的提示都是中文;设成别的语言还是英文。
228
+ 在游戏选项里中途换语言也会立刻跟着变,不用重开游戏。
229
+
230
+
231
+ 五、出问题的话
232
+ --------------
233
+
234
+ 游戏目录下 BepInEx\LogOutput.log 是日志,
235
+ 出问题把它发回来就能定位。
236
+
237
+ 如果是卡在「Waiting for XXX」,日志里这两句最有用:
238
+ Starting a check —— 会列出三个存档 key,一眼能看出哪个对不上
239
+ Turned down a hello —— 说明有一条握手消息被丢掉了,以及丢的原因
240
+
241
+
242
+ 六、这东西是谁写的
243
+ ------------------
244
+
245
+ 联机功能本身、以及这里几乎全部的代码,都是 Extremelyd1 写的
246
+ (原项目:github.com/Extremelyd1/SSMP)。
247
+ 这一份只是在它上面加了「两个人共用一条流程」的双人存档,
248
+ 沿用和原作相同的 LGPL-2.1 许可证。
249
+
250
+ ※ 有任何问题请找我,【不要去原作者的 Discord 或 issues 页面】。
251
+ 这些改动不是人家写的,人家既复现不了也没义务解释。
252
+
253
+ 包里还有两个别人的东西:
254
+ BouncyCastle.Cryptography.dll —— 第三方加密库,MIT 许可证,
255
+ 版权归 The Legion of the Bouncy Castle Inc.,
256
+ 完整条款见同目录下的 LICENSE-BouncyCastle.md。
257
+ BepInEx_win_x64_5.4.23.4.zip —— BepInEx 官方发布的原包,
258
+ 一个字节都没有改过。
package/LICENSE ADDED
@@ -0,0 +1,458 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 2.1, February 1999
3
+
4
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ [This is the first released version of the Lesser GPL. It also counts
10
+ as the successor of the GNU Library Public License, version 2, hence
11
+ the version number 2.1.]
12
+
13
+ Preamble
14
+
15
+ The licenses for most software are designed to take away your
16
+ freedom to share and change it. By contrast, the GNU General Public
17
+ Licenses are intended to guarantee your freedom to share and change
18
+ free software--to make sure the software is free for all its users.
19
+
20
+ This license, the Lesser General Public License, applies to some
21
+ specially designated software packages--typically libraries--of the
22
+ Free Software Foundation and other authors who decide to use it. You
23
+ can use it too, but we suggest you first think carefully about whether
24
+ this license or the ordinary General Public License is the better
25
+ strategy to use in any particular case, based on the explanations below.
26
+
27
+ When we speak of free software, we are referring to freedom of use,
28
+ not price. Our General Public Licenses are designed to make sure that
29
+ you have the freedom to distribute copies of free software (and charge
30
+ for this service if you wish); that you receive source code or can get
31
+ it if you want it; that you can change the software and use pieces of
32
+ it in new free programs; and that you are informed that you can do
33
+ these things.
34
+
35
+ To protect your rights, we need to make restrictions that forbid
36
+ distributors to deny you these rights or to ask you to surrender these
37
+ rights. These restrictions translate to certain responsibilities for
38
+ you if you distribute copies of the library or if you modify it.
39
+
40
+ For example, if you distribute copies of the library, whether gratis
41
+ or for a fee, you must give the recipients all the rights that we gave
42
+ you. You must make sure that they, too, receive or can get the source
43
+ code. If you link other code with the library, you must provide
44
+ complete object files to the recipients, so that they can relink them
45
+ with the library after making changes to the library and recompiling
46
+ it. And you must show them these terms so they know their rights.
47
+
48
+ We protect your rights with a two-step method: (1) we copyright the
49
+ library, and (2) we offer you this license, which gives you legal
50
+ permission to copy, distribute and/or modify the library.
51
+
52
+ To protect each distributor, we want to make it very clear that
53
+ there is no warranty for the free library. Also, if the library is
54
+ modified by someone else and passed on, the recipients should know
55
+ that what they have is not the original version, so that the original
56
+ author's reputation will not be affected by problems that might be
57
+ introduced by others.
58
+
59
+ Finally, software patents pose a constant threat to the existence of
60
+ any free program. We wish to make sure that a company cannot
61
+ effectively restrict the users of a free program by obtaining a
62
+ restrictive license from a patent holder. Therefore, we insist that
63
+ any patent license obtained for a version of the library must be
64
+ consistent with the full freedom of use specified in this license.
65
+
66
+ Most GNU software, including some libraries, is covered by the
67
+ ordinary GNU General Public License. This license, the GNU Lesser
68
+ General Public License, applies to certain designated libraries, and
69
+ is quite different from the ordinary General Public License. We use
70
+ this license for certain libraries in order to permit linking those
71
+ libraries into non-free programs.
72
+
73
+ When a program is linked with a library, whether statically or using
74
+ a shared library, the combination of the two is legally speaking a
75
+ combined work, a derivative of the original library. The ordinary
76
+ General Public License therefore permits such linking only if the
77
+ entire combination fits its criteria of freedom. The Lesser General
78
+ Public License permits more lax criteria for linking other code with
79
+ the library.
80
+
81
+ We call this license the "Lesser" General Public License because it
82
+ does Less to protect the user's freedom than the ordinary General
83
+ Public License. It also provides other free software developers Less
84
+ of an advantage over competing non-free programs. These disadvantages
85
+ are the reason we use the ordinary General Public License for many
86
+ libraries. However, the Lesser license provides advantages in certain
87
+ special circumstances.
88
+
89
+ For example, on rare occasions, there may be a special need to
90
+ encourage the widest possible use of a certain library, so that it becomes
91
+ a de-facto standard. To achieve this, non-free programs must be
92
+ allowed to use the library. A more frequent case is that a free
93
+ library does the same job as widely used non-free libraries. In this
94
+ case, there is little to gain by limiting the free library to free
95
+ software only, so we use the Lesser General Public License.
96
+
97
+ In other cases, permission to use a particular library in non-free
98
+ programs enables a greater number of people to use a large body of
99
+ free software. For example, permission to use the GNU C Library in
100
+ non-free programs enables many more people to use the whole GNU
101
+ operating system, as well as its variant, the GNU/Linux operating
102
+ system.
103
+
104
+ Although the Lesser General Public License is Less protective of the
105
+ users' freedom, it does ensure that the user of a program that is
106
+ linked with the Library has the freedom and the wherewithal to run
107
+ that program using a modified version of the Library.
108
+
109
+ The precise terms and conditions for copying, distribution and
110
+ modification follow. Pay close attention to the difference between a
111
+ "work based on the library" and a "work that uses the library". The
112
+ former contains code derived from the library, whereas the latter must
113
+ be combined with the library in order to run.
114
+
115
+ GNU LESSER GENERAL PUBLIC LICENSE
116
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
+
118
+ 0. This License Agreement applies to any software library or other
119
+ program which contains a notice placed by the copyright holder or
120
+ other authorized party saying it may be distributed under the terms of
121
+ this Lesser General Public License (also called "this License").
122
+ Each licensee is addressed as "you".
123
+
124
+ A "library" means a collection of software functions and/or data
125
+ prepared so as to be conveniently linked with application programs
126
+ (which use some of those functions and data) to form executables.
127
+
128
+ The "Library", below, refers to any such software library or work
129
+ which has been distributed under these terms. A "work based on the
130
+ Library" means either the Library or any derivative work under
131
+ copyright law: that is to say, a work containing the Library or a
132
+ portion of it, either verbatim or with modifications and/or translated
133
+ straightforwardly into another language. (Hereinafter, translation is
134
+ included without limitation in the term "modification".)
135
+
136
+ "Source code" for a work means the preferred form of the work for
137
+ making modifications to it. For a library, complete source code means
138
+ all the source code for all modules it contains, plus any associated
139
+ interface definition files, plus the scripts used to control compilation
140
+ and installation of the library.
141
+
142
+ Activities other than copying, distribution and modification are not
143
+ covered by this License; they are outside its scope. The act of
144
+ running a program using the Library is not restricted, and output from
145
+ such a program is covered only if its contents constitute a work based
146
+ on the Library (independent of the use of the Library in a tool for
147
+ writing it). Whether that is true depends on what the Library does
148
+ and what the program that uses the Library does.
149
+
150
+ 1. You may copy and distribute verbatim copies of the Library's
151
+ complete source code as you receive it, in any medium, provided that
152
+ you conspicuously and appropriately publish on each copy an
153
+ appropriate copyright notice and disclaimer of warranty; keep intact
154
+ all the notices that refer to this License and to the absence of any
155
+ warranty; and distribute a copy of this License along with the
156
+ Library.
157
+
158
+ You may charge a fee for the physical act of transferring a copy,
159
+ and you may at your option offer warranty protection in exchange for a
160
+ fee.
161
+
162
+ 2. You may modify your copy or copies of the Library or any portion
163
+ of it, thus forming a work based on the Library, and copy and
164
+ distribute such modifications or work under the terms of Section 1
165
+ above, provided that you also meet all of these conditions:
166
+
167
+ a) The modified work must itself be a software library.
168
+
169
+ b) You must cause the files modified to carry prominent notices
170
+ stating that you changed the files and the date of any change.
171
+
172
+ c) You must cause the whole of the work to be licensed at no
173
+ charge to all third parties under the terms of this License.
174
+
175
+ d) If a facility in the modified Library refers to a function or a
176
+ table of data to be supplied by an application program that uses
177
+ the facility, other than as an argument passed when the facility
178
+ is invoked, then you must make a good faith effort to ensure that,
179
+ in the event an application does not supply such function or
180
+ table, the facility still operates, and performs whatever part of
181
+ its purpose remains meaningful.
182
+
183
+ (For example, a function in a library to compute square roots has
184
+ a purpose that is entirely well-defined independent of the
185
+ application. Therefore, Subsection 2d requires that any
186
+ application-supplied function or table used by this function must
187
+ be optional: if the application does not supply it, the square
188
+ root function must still compute square roots.)
189
+
190
+ These requirements apply to the modified work as a whole. If
191
+ identifiable sections of that work are not derived from the Library,
192
+ and can be reasonably considered independent and separate works in
193
+ themselves, then this License, and its terms, do not apply to those
194
+ sections when you distribute them as separate works. But when you
195
+ distribute the same sections as part of a whole which is a work based
196
+ on the Library, the distribution of the whole must be on the terms of
197
+ this License, whose permissions for other licensees extend to the
198
+ entire whole, and thus to each and every part regardless of who wrote
199
+ it.
200
+
201
+ Thus, it is not the intent of this section to claim rights or contest
202
+ your rights to work written entirely by you; rather, the intent is to
203
+ exercise the right to control the distribution of derivative or
204
+ collective works based on the Library.
205
+
206
+ In addition, mere aggregation of another work not based on the Library
207
+ with the Library (or with a work based on the Library) on a volume of
208
+ a storage or distribution medium does not bring the other work under
209
+ the scope of this License.
210
+
211
+ 3. You may opt to apply the terms of the ordinary GNU General Public
212
+ License instead of this License to a given copy of the Library. To do
213
+ this, you must alter all the notices that refer to this License, so
214
+ that they refer to the ordinary GNU General Public License, version 2,
215
+ instead of to this License. (If a newer version than version 2 of the
216
+ ordinary GNU General Public License has appeared, then you can specify
217
+ that version instead if you wish.) Do not make any other change in
218
+ these notices.
219
+
220
+ Once this change is made in a given copy, it is irreversible for
221
+ that copy, so the ordinary GNU General Public License applies to all
222
+ subsequent copies and derivative works made from that copy.
223
+
224
+ This option is useful when you wish to copy part of the code of
225
+ the Library into a program that is not a library.
226
+
227
+ 4. You may copy and distribute the Library (or a portion or
228
+ derivative of it, under Section 2) in object code or executable form
229
+ under the terms of Sections 1 and 2 above provided that you accompany
230
+ it with the complete corresponding machine-readable source code, which
231
+ must be distributed under the terms of Sections 1 and 2 above on a
232
+ medium customarily used for software interchange.
233
+
234
+ If distribution of object code is made by offering access to copy
235
+ from a designated place, then offering equivalent access to copy the
236
+ source code from the same place satisfies the requirement to
237
+ distribute the source code, even though third parties are not
238
+ compelled to copy the source along with the object code.
239
+
240
+ 5. A program that contains no derivative of any portion of the
241
+ Library, but is designed to work with the Library by being compiled or
242
+ linked with it, is called a "work that uses the Library". Such a
243
+ work, in isolation, is not a derivative work of the Library, and
244
+ therefore falls outside the scope of this License.
245
+
246
+ However, linking a "work that uses the Library" with the Library
247
+ creates an executable that is a derivative of the Library (because it
248
+ contains portions of the Library), rather than a "work that uses the
249
+ library". The executable is therefore covered by this License.
250
+ Section 6 states terms for distribution of such executables.
251
+
252
+ When a "work that uses the Library" uses material from a header file
253
+ that is part of the Library, the object code for the work may be a
254
+ derivative work of the Library even though the source code is not.
255
+ Whether this is true is especially significant if the work can be
256
+ linked without the Library, or if the work is itself a library. The
257
+ threshold for this to be true is not precisely defined by law.
258
+
259
+ If such an object file uses only numerical parameters, data
260
+ structure layouts and accessors, and small macros and small inline
261
+ functions (ten lines or less in length), then the use of the object
262
+ file is unrestricted, regardless of whether it is legally a derivative
263
+ work. (Executables containing this object code plus portions of the
264
+ Library will still fall under Section 6.)
265
+
266
+ Otherwise, if the work is a derivative of the Library, you may
267
+ distribute the object code for the work under the terms of Section 6.
268
+ Any executables containing that work also fall under Section 6,
269
+ whether or not they are linked directly with the Library itself.
270
+
271
+ 6. As an exception to the Sections above, you may also combine or
272
+ link a "work that uses the Library" with the Library to produce a
273
+ work containing portions of the Library, and distribute that work
274
+ under terms of your choice, provided that the terms permit
275
+ modification of the work for the customer's own use and reverse
276
+ engineering for debugging such modifications.
277
+
278
+ You must give prominent notice with each copy of the work that the
279
+ Library is used in it and that the Library and its use are covered by
280
+ this License. You must supply a copy of this License. If the work
281
+ during execution displays copyright notices, you must include the
282
+ copyright notice for the Library among them, as well as a reference
283
+ directing the user to the copy of this License. Also, you must do one
284
+ of these things:
285
+
286
+ a) Accompany the work with the complete corresponding
287
+ machine-readable source code for the Library including whatever
288
+ changes were used in the work (which must be distributed under
289
+ Sections 1 and 2 above); and, if the work is an executable linked
290
+ with the Library, with the complete machine-readable "work that
291
+ uses the Library", as object code and/or source code, so that the
292
+ user can modify the Library and then relink to produce a modified
293
+ executable containing the modified Library. (It is understood
294
+ that the user who changes the contents of definitions files in the
295
+ Library will not necessarily be able to recompile the application
296
+ to use the modified definitions.)
297
+
298
+ b) Use a suitable shared library mechanism for linking with the
299
+ Library. A suitable mechanism is one that (1) uses at run time a
300
+ copy of the library already present on the user's computer system,
301
+ rather than copying library functions into the executable, and (2)
302
+ will operate properly with a modified version of the library, if
303
+ the user installs one, as long as the modified version is
304
+ interface-compatible with the version that the work was made with.
305
+
306
+ c) Accompany the work with a written offer, valid for at
307
+ least three years, to give the same user the materials
308
+ specified in Subsection 6a, above, for a charge no more
309
+ than the cost of performing this distribution.
310
+
311
+ d) If distribution of the work is made by offering access to copy
312
+ from a designated place, offer equivalent access to copy the above
313
+ specified materials from the same place.
314
+
315
+ e) Verify that the user has already received a copy of these
316
+ materials or that you have already sent this user a copy.
317
+
318
+ For an executable, the required form of the "work that uses the
319
+ Library" must include any data and utility programs needed for
320
+ reproducing the executable from it. However, as a special exception,
321
+ the materials to be distributed need not include anything that is
322
+ normally distributed (in either source or binary form) with the major
323
+ components (compiler, kernel, and so on) of the operating system on
324
+ which the executable runs, unless that component itself accompanies
325
+ the executable.
326
+
327
+ It may happen that this requirement contradicts the license
328
+ restrictions of other proprietary libraries that do not normally
329
+ accompany the operating system. Such a contradiction means you cannot
330
+ use both them and the Library together in an executable that you
331
+ distribute.
332
+
333
+ 7. You may place library facilities that are a work based on the
334
+ Library side-by-side in a single library together with other library
335
+ facilities not covered by this License, and distribute such a combined
336
+ library, provided that the separate distribution of the work based on
337
+ the Library and of the other library facilities is otherwise
338
+ permitted, and provided that you do these two things:
339
+
340
+ a) Accompany the combined library with a copy of the same work
341
+ based on the Library, uncombined with any other library
342
+ facilities. This must be distributed under the terms of the
343
+ Sections above.
344
+
345
+ b) Give prominent notice with the combined library of the fact
346
+ that part of it is a work based on the Library, and explaining
347
+ where to find the accompanying uncombined form of the same work.
348
+
349
+ 8. You may not copy, modify, sublicense, link with, or distribute
350
+ the Library except as expressly provided under this License. Any
351
+ attempt otherwise to copy, modify, sublicense, link with, or
352
+ distribute the Library is void, and will automatically terminate your
353
+ rights under this License. However, parties who have received copies,
354
+ or rights, from you under this License will not have their licenses
355
+ terminated so long as such parties remain in full compliance.
356
+
357
+ 9. You are not required to accept this License, since you have not
358
+ signed it. However, nothing else grants you permission to modify or
359
+ distribute the Library or its derivative works. These actions are
360
+ prohibited by law if you do not accept this License. Therefore, by
361
+ modifying or distributing the Library (or any work based on the
362
+ Library), you indicate your acceptance of this License to do so, and
363
+ all its terms and conditions for copying, distributing or modifying
364
+ the Library or works based on it.
365
+
366
+ 10. Each time you redistribute the Library (or any work based on the
367
+ Library), the recipient automatically receives a license from the
368
+ original licensor to copy, distribute, link with or modify the Library
369
+ subject to these terms and conditions. You may not impose any further
370
+ restrictions on the recipients' exercise of the rights granted herein.
371
+ You are not responsible for enforcing compliance by third parties with
372
+ this License.
373
+
374
+ 11. If, as a consequence of a court judgment or allegation of patent
375
+ infringement or for any other reason (not limited to patent issues),
376
+ conditions are imposed on you (whether by court order, agreement or
377
+ otherwise) that contradict the conditions of this License, they do not
378
+ excuse you from the conditions of this License. If you cannot
379
+ distribute so as to satisfy simultaneously your obligations under this
380
+ License and any other pertinent obligations, then as a consequence you
381
+ may not distribute the Library at all. For example, if a patent
382
+ license would not permit royalty-free redistribution of the Library by
383
+ all those who receive copies directly or indirectly through you, then
384
+ the only way you could satisfy both it and this License would be to
385
+ refrain entirely from distribution of the Library.
386
+
387
+ If any portion of this section is held invalid or unenforceable under any
388
+ particular circumstance, the balance of the section is intended to apply,
389
+ and the section as a whole is intended to apply in other circumstances.
390
+
391
+ It is not the purpose of this section to induce you to infringe any
392
+ patents or other property right claims or to contest validity of any
393
+ such claims; this section has the sole purpose of protecting the
394
+ integrity of the free software distribution system which is
395
+ implemented by public license practices. Many people have made
396
+ generous contributions to the wide range of software distributed
397
+ through that system in reliance on consistent application of that
398
+ system; it is up to the author/donor to decide if he or she is willing
399
+ to distribute software through any other system and a licensee cannot
400
+ impose that choice.
401
+
402
+ This section is intended to make thoroughly clear what is believed to
403
+ be a consequence of the rest of this License.
404
+
405
+ 12. If the distribution and/or use of the Library is restricted in
406
+ certain countries either by patents or by copyrighted interfaces, the
407
+ original copyright holder who places the Library under this License may add
408
+ an explicit geographical distribution limitation excluding those countries,
409
+ so that distribution is permitted only in or among countries not thus
410
+ excluded. In such case, this License incorporates the limitation as if
411
+ written in the body of this License.
412
+
413
+ 13. The Free Software Foundation may publish revised and/or new
414
+ versions of the Lesser General Public License from time to time.
415
+ Such new versions will be similar in spirit to the present version,
416
+ but may differ in detail to address new problems or concerns.
417
+
418
+ Each version is given a distinguishing version number. If the Library
419
+ specifies a version number of this License which applies to it and
420
+ "any later version", you have the option of following the terms and
421
+ conditions either of that version or of any later version published by
422
+ the Free Software Foundation. If the Library does not specify a
423
+ license version number, you may choose any version ever published by
424
+ the Free Software Foundation.
425
+
426
+ 14. If you wish to incorporate parts of the Library into other free
427
+ programs whose distribution conditions are incompatible with these,
428
+ write to the author to ask for permission. For software which is
429
+ copyrighted by the Free Software Foundation, write to the Free
430
+ Software Foundation; we sometimes make exceptions for this. Our
431
+ decision will be guided by the two goals of preserving the free status
432
+ of all derivatives of our free software and of promoting the sharing
433
+ and reuse of software generally.
434
+
435
+ NO WARRANTY
436
+
437
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438
+ WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440
+ OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444
+ LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445
+ THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
+
447
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449
+ AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450
+ FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451
+ CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452
+ LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453
+ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454
+ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455
+ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456
+ DAMAGES.
457
+
458
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,15 @@
1
+ MIT License (https://opensource.org/licenses/MIT)
2
+
3
+ Copyright (c) 2000-2026 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org).
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5
+ associated documentation files (the "Software"), to deal in the Software without restriction,
6
+ including without limitation the rights to use, copy, modify, merge, publish, distribute,
7
+ sub license, and/or sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions: The above copyright notice and this
9
+ permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
12
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
14
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
15
+ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # silksong-coop-mod 0.4.0
2
+
3
+ The files a player needs to install a two-player co-op build of **SSMP**, packaged so they can be fetched from
4
+ a mirror that is reachable inside mainland China. This is not a Node library: nothing here is imported or run
5
+ by `npm install`.
6
+
7
+ ## Install
8
+
9
+ Download and unpack the tarball, then double-click `INSTALL.bat`. `INSTALL.txt` explains the rest, in Chinese.
10
+
11
+ The BepInEx loader is included, so the install needs no network access at all.
12
+
13
+ ## Credit and licence
14
+
15
+ The multiplayer mod is the work of [Extremelyd1](https://github.com/Extremelyd1/SSMP). This is a modified copy
16
+ that adds a shared two-player save; please do not take questions about it to the original author. Distributed
17
+ under the GNU LGPL 2.1 - see `LICENSE`. Built from https://github.com/Candy-649/SSMP at `deba6cf`.
package/SSMP/SSMP.dll ADDED
Binary file
package/install.ps1 ADDED
@@ -0,0 +1,250 @@
1
+ # Installs the BepInEx mod loader and the SSMP co-op plugin into Hollow Knight: Silksong.
2
+ #
3
+ # The loader ships inside this archive, so a normal install needs no network at all. Downloading is only a fallback
4
+ # for when the bundled copy is missing, and the host that serves it is blocked on some networks.
5
+ #
6
+ # Console output is English on purpose: Windows PowerShell 5.1 reads a UTF-8 file without a BOM as ANSI, which turns
7
+ # any other language into mojibake on a machine that has not been set up for it. The readable explanation lives in
8
+ # INSTALL.txt next to this script.
9
+ #
10
+ # Everything this script writes goes into the game folder, plus one backup of the save folder. It changes no system
11
+ # setting and needs no administrator rights unless the game itself sits in a protected folder.
12
+
13
+ $ErrorActionPreference = 'Stop'
14
+
15
+ $GameExe = 'Hollow Knight Silksong.exe'
16
+ $GameDirName = 'Hollow Knight Silksong'
17
+
18
+ # How many save backups to keep. Older ones are removed after a new one is made, so reinstalling a few times does not
19
+ # leave a pile behind. Only backups this script made, in the folder this script made, are ever touched.
20
+ $KeepBackups = 3
21
+ $ApiUrl = 'https://thunderstore.io/api/experimental/package/silksong_modding/BepInExPack_Silksong/'
22
+
23
+ # Used only when the version cannot be looked up. The package that is merely a redirect stub, BepInEx/
24
+ # BepInExPack_Silksong, must never be used here: it downloads successfully and contains nothing.
25
+ $FallbackUrl = 'https://thunderstore.io/package/download/silksong_modding/BepInExPack_Silksong/1.0.3/'
26
+ $FallbackVersion = '1.0.3'
27
+
28
+ function Write-Step($text) { Write-Host ""; Write-Host "==> $text" -ForegroundColor Cyan }
29
+ function Write-Ok($text) { Write-Host " $text" -ForegroundColor Green }
30
+ function Write-Warn2($text) { Write-Host " $text" -ForegroundColor Yellow }
31
+
32
+ function Find-Game {
33
+ $candidates = New-Object System.Collections.Generic.List[string]
34
+
35
+ # Steam records where it is installed, and where its other libraries are
36
+ try {
37
+ $steamPath = (Get-ItemProperty 'HKCU:\Software\Valve\Steam' -ErrorAction Stop).SteamPath
38
+ if ($steamPath) {
39
+ $steamPath = $steamPath -replace '/', '\'
40
+ $candidates.Add((Join-Path $steamPath "steamapps\common\$GameDirName"))
41
+
42
+ $vdf = Join-Path $steamPath 'steamapps\libraryfolders.vdf'
43
+ if (Test-Path $vdf) {
44
+ foreach ($line in (Get-Content $vdf)) {
45
+ if ($line -match '"path"\s+"(.+?)"') {
46
+ $libPath = $matches[1] -replace '\\\\', '\'
47
+ $candidates.Add((Join-Path $libPath "steamapps\common\$GameDirName"))
48
+ }
49
+ }
50
+ }
51
+ }
52
+ } catch {
53
+ # No Steam in the registry is not fatal; the guesses below and the prompt still apply
54
+ }
55
+
56
+ # Common places people put a second Steam library
57
+ foreach ($drive in (Get-PSDrive -PSProvider FileSystem).Name) {
58
+ $candidates.Add("${drive}:\STEAM\steamapps\common\$GameDirName")
59
+ $candidates.Add("${drive}:\SteamLibrary\steamapps\common\$GameDirName")
60
+ $candidates.Add("${drive}:\Steam\steamapps\common\$GameDirName")
61
+ }
62
+
63
+ foreach ($candidate in ($candidates | Select-Object -Unique)) {
64
+ if (Test-Path (Join-Path $candidate $GameExe)) { return $candidate }
65
+ }
66
+
67
+ return $null
68
+ }
69
+
70
+ function Backup-Saves {
71
+ $lowLow = Join-Path $env:USERPROFILE 'AppData\LocalLow'
72
+ if (-not (Test-Path $lowLow)) { Write-Warn2 'No LocalLow folder found, skipping the save backup.'; return }
73
+
74
+ # Found rather than assumed, so that a different folder name does not silently skip the backup
75
+ $saveDirs = Get-ChildItem $lowLow -Directory -Recurse -Depth 1 -ErrorAction SilentlyContinue |
76
+ Where-Object { $_.Name -like '*Silksong*' }
77
+
78
+ if (-not $saveDirs) { Write-Warn2 'No Silksong save folder found, skipping the save backup.'; return }
79
+
80
+ # Kept in a folder beside this script rather than on the desktop. These are only ever wanted if an install goes
81
+ # wrong, and piling them onto someone's desktop is a poor price for that. The trade is that deleting the unpacked
82
+ # installer takes them with it, which is why the script says where they are.
83
+ $backupDir = Join-Path $PSScriptRoot 'save-backups'
84
+
85
+ foreach ($dir in $saveDirs) {
86
+ $stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
87
+ # The folder name is part of it: two save folders backed up within the same second would otherwise write the
88
+ # same file name, and the -Force below would quietly overwrite the first backup with the second
89
+ $target = Join-Path $backupDir "silksong-saves-backup-$($dir.Name)-$stamp.zip"
90
+ try {
91
+ New-Item -ItemType Directory -Path $backupDir -Force | Out-Null
92
+ Compress-Archive -Path $dir.FullName -DestinationPath $target -Force
93
+ Write-Ok "Saves backed up to: $target"
94
+
95
+ # Deliberately narrow: only this folder, only names this script writes, and only after the new backup
96
+ # exists, so a failed backup never costs you the older ones
97
+ Get-ChildItem -Path $backupDir -Filter 'silksong-saves-backup-*.zip' -File -ErrorAction SilentlyContinue |
98
+ Sort-Object LastWriteTime -Descending |
99
+ Select-Object -Skip $KeepBackups |
100
+ ForEach-Object {
101
+ Remove-Item -LiteralPath $_.FullName -Force -ErrorAction SilentlyContinue
102
+ Write-Ok "Removed an older backup: $($_.Name)"
103
+ }
104
+ } catch {
105
+ Write-Warn2 "Could not back up $($dir.FullName): $($_.Exception.Message)"
106
+ }
107
+ }
108
+ }
109
+
110
+ function Get-LoaderArchive($work) {
111
+ # The bundled copy first: it is the whole point of shipping one, and it works on networks where the download host
112
+ # is blocked. Any BepInEx archive placed next to this script is accepted, so a manually downloaded one works too.
113
+ $bundled = Get-ChildItem $PSScriptRoot -Filter 'BepInEx*.zip' -File -ErrorAction SilentlyContinue |
114
+ Select-Object -First 1
115
+ if ($bundled) {
116
+ Write-Ok "Using the copy that came with this installer: $($bundled.Name)"
117
+ return $bundled.FullName
118
+ }
119
+
120
+ Write-Warn2 'No BepInEx archive next to this script, downloading one instead.'
121
+
122
+ $url = $FallbackUrl
123
+ $version = "$FallbackVersion (fallback)"
124
+ try {
125
+ $info = Invoke-RestMethod -Uri $ApiUrl -UseBasicParsing -TimeoutSec 30
126
+ if ($info.latest.download_url) {
127
+ $url = $info.latest.download_url
128
+ $version = $info.latest.version_number
129
+ }
130
+ } catch {
131
+ Write-Warn2 "Could not ask for the newest version ($($_.Exception.Message))."
132
+ }
133
+
134
+ Write-Ok "Version: $version"
135
+
136
+ $zipPath = Join-Path $work 'bepinex.zip'
137
+ $oldProgress = $ProgressPreference
138
+ $ProgressPreference = 'SilentlyContinue'
139
+ try {
140
+ Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing -TimeoutSec 300
141
+ } catch {
142
+ throw ("Could not download the mod loader: $($_.Exception.Message)`n" +
143
+ " Your network may be blocking it. Ask for an installer with the loader included, or put a`n" +
144
+ " BepInEx zip next to this script and run it again.")
145
+ } finally {
146
+ $ProgressPreference = $oldProgress
147
+ }
148
+
149
+ # A download that succeeds but is far too small is the empty redirect package, which would install nothing at all
150
+ if ((Get-Item $zipPath).Length -lt 500KB) {
151
+ throw 'That download is too small to be the mod loader. It is probably the empty redirect package.'
152
+ }
153
+
154
+ return $zipPath
155
+ }
156
+
157
+ function Find-PayloadRoot($extractedDir) {
158
+ # The layer to copy is the one holding the loader itself, whatever the archive wraps it in. Matching on the
159
+ # contents rather than on a folder name means a repackaged archive still installs correctly.
160
+ $all = @(Get-Item $extractedDir) + @(Get-ChildItem $extractedDir -Recurse -Directory)
161
+ foreach ($dir in $all) {
162
+ $hasBepInEx = Test-Path (Join-Path $dir.FullName 'BepInEx')
163
+ $hasProxy = (Test-Path (Join-Path $dir.FullName 'winhttp.dll')) -or
164
+ (Test-Path (Join-Path $dir.FullName 'version.dll'))
165
+ if ($hasBepInEx -and $hasProxy) { return $dir.FullName }
166
+ }
167
+
168
+ return $null
169
+ }
170
+
171
+ try {
172
+ Write-Host ""
173
+ Write-Host " Silksong co-op (SSMP) installer" -ForegroundColor White
174
+ Write-Host " --------------------------------"
175
+
176
+ Write-Step 'Looking for the game'
177
+ $game = Find-Game
178
+ if (-not $game) {
179
+ Write-Warn2 "Could not find $GameDirName automatically."
180
+ Write-Host " Paste the folder that contains $GameExe and press Enter:"
181
+ $game = (Read-Host ' Game folder').Trim('"', ' ')
182
+ if (-not (Test-Path (Join-Path $game $GameExe))) {
183
+ throw "No $GameExe in: $game"
184
+ }
185
+ }
186
+ Write-Ok "Game folder: $game"
187
+
188
+ Write-Step 'Backing up saves first'
189
+ Backup-Saves
190
+
191
+ $work = Join-Path ([System.IO.Path]::GetTempPath()) ("ssmp-install-" + [Guid]::NewGuid().ToString('N'))
192
+ New-Item -ItemType Directory -Path $work -Force | Out-Null
193
+
194
+ Write-Step 'Getting the BepInEx mod loader'
195
+ $archive = Get-LoaderArchive $work
196
+
197
+ Write-Step 'Installing the mod loader into the game folder'
198
+ $extracted = Join-Path $work 'extracted'
199
+ Expand-Archive -Path $archive -DestinationPath $extracted -Force
200
+
201
+ $payload = Find-PayloadRoot $extracted
202
+ if (-not $payload) {
203
+ throw 'Could not find the loader inside the archive (no folder with both BepInEx and winhttp.dll).'
204
+ }
205
+
206
+ foreach ($item in (Get-ChildItem $payload -Force)) {
207
+ Copy-Item -Path $item.FullName -Destination $game -Recurse -Force
208
+ }
209
+ Write-Ok 'Mod loader copied'
210
+
211
+ Write-Step 'Installing the co-op plugin'
212
+ $pluginSource = Join-Path $PSScriptRoot 'SSMP'
213
+ if (-not (Test-Path $pluginSource)) {
214
+ throw 'No SSMP folder next to this script. Unzip the whole archive first, then run the installer from inside it.'
215
+ }
216
+
217
+ $pluginTarget = Join-Path $game 'BepInEx\plugins\SSMP'
218
+ New-Item -ItemType Directory -Path $pluginTarget -Force | Out-Null
219
+ foreach ($dll in (Get-ChildItem $pluginSource -Filter '*.dll')) {
220
+ Copy-Item -Path $dll.FullName -Destination $pluginTarget -Force
221
+ Write-Ok "Installed $($dll.Name)"
222
+ }
223
+
224
+ Write-Step 'Checking the result'
225
+ $checks = @(
226
+ (Join-Path $game 'winhttp.dll'),
227
+ (Join-Path $game 'BepInEx'),
228
+ (Join-Path $pluginTarget 'SSMP.dll')
229
+ )
230
+ $missing = $checks | Where-Object { -not (Test-Path $_) }
231
+ if ($missing) {
232
+ throw "These are missing after the install:`n " + ($missing -join "`n ")
233
+ }
234
+
235
+ if (Test-Path $work) { Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue }
236
+
237
+ Write-Host ""
238
+ Write-Host " Done. Start the game from Steam: the main menu now has 'Start Multiplayer'." -ForegroundColor Green
239
+ # Deliberately not a summary of how to play: that changed twice already, and a second copy of it here is a
240
+ # second copy to keep correct. INSTALL.txt is the one place that describes it.
241
+ Write-Host " Both players need this same installer. INSTALL.txt says how to play together." -ForegroundColor Green
242
+ Write-Host ""
243
+ } catch {
244
+ Write-Host ""
245
+ Write-Host " FAILED: $($_.Exception.Message)" -ForegroundColor Red
246
+ Write-Host ""
247
+ Write-Host " Nothing was started. You can run this installer again." -ForegroundColor Yellow
248
+ Write-Host ""
249
+ exit 1
250
+ }
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "silksong-coop-mod",
3
+ "version": "0.4.0",
4
+ "description": "Offline installer payload for a two-player co-op build of the SSMP Silksong multiplayer mod. Not a Node library.",
5
+ "license": "LGPL-2.1-or-later",
6
+ "author": "Candy-649 (https://github.com/Candy-649)",
7
+ "homepage": "https://github.com/Candy-649/SSMP",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Candy-649/SSMP.git"
11
+ },
12
+ "keywords": [
13
+ "silksong",
14
+ "bepinex",
15
+ "mod",
16
+ "installer"
17
+ ],
18
+ "files": [
19
+ "INSTALL.bat",
20
+ "INSTALL.txt",
21
+ "install.ps1",
22
+ "LICENSE",
23
+ "LICENSE-BouncyCastle.md",
24
+ "BepInEx_win_x64_5.4.23.4.zip",
25
+ "SSMP/",
26
+ "README.md"
27
+ ]
28
+ }