-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
73 changed files
with
3,754 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,37 @@ | ||
# StardewAutoGC | ||
## StardewAutoGC | ||
一个不怎么有用但又很有用的星露谷模组 | ||
为什么没用呢,因为核心代码就一句话 | ||
为什么有用呢,因为快成必备模组了(王境泽定律) | ||
|
||
### 功能 | ||
清理无用内存占用(对于运行库来说是无用的那部分) | ||
尽可能避免或预警 32 位游戏 4GB 内存上限爆炸,对于 64 位游戏也能当个不错的监视功能 | ||
|
||
**自动在每天结束时** 或者手动调用 GC 释放内存 | ||
很多情况下可以用来解决玄学卡顿(记住只是玄学的,该卡的还是要卡) | ||
|
||
对于 32 位的游戏,此模组还会激活内存预警,到达 3500 MB 时弹出提醒 | ||
|
||
### 按 右 Alt 键 手动触发 | ||
再问打死,**右边的 Alt 键**,不是左边的,你不会左右都不分吧 | ||
目前不能改键,因为做不来 | ||
|
||
### NEXUSMODS 9293 | ||
https://www.nexusmods.com/stardewvalley/mods/9293 | ||
|
||
### 版本适配 | ||
这里只是工程,当然也有生成好的可以直接用的模组(自己找) | ||
|
||
StardewAutoGC 文件夹的版本适配于:官方32位(1.5.4)和非官方64位(1.5.4) | ||
StardewAutoGC_NET5 文件夹的版本仅适配于:官方64位(1.5.5) | ||
|
||
### 截图 | ||
图中的样式效果和渲染效果为 7861 和 1213 | ||
清理效果请以实际为准,清不下去就是真的清不下去 | ||
![img](img\1.png) | ||
|
||
如果你运行的是 32 位的游戏,程序会在占用达到 3500MB 时警告你 | ||
![img](img\2.png) | ||
|
||
### 多语言 | ||
两个模组版本均支持多语言,增加 i18n 语言文件即可 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Imports Microsoft.Xna.Framework | ||
Imports StardewModdingAPI | ||
Imports StardewModdingAPI.Events | ||
Imports StardewModdingAPI.Utilities | ||
Imports StardewValley | ||
Imports StardewValley.Menus | ||
|
||
Public Class ModEntry | ||
Inherits [Mod] | ||
Public Overrides Sub Entry(helper As IModHelper) | ||
|
||
AddHandler helper.Events.GameLoop.DayEnding, AddressOf Me.每一天结束时事件 | ||
AddHandler helper.Events.Input.ButtonPressed, AddressOf Me.按钮按下时事件 | ||
AddHandler helper.Events.GameLoop.GameLaunched, AddressOf Me.启动完毕事件 | ||
End Sub | ||
|
||
Public Shared 是否启用内存极限警告 As Boolean = False | ||
|
||
Public Sub 启动完毕事件(sender As Object, e As GameLaunchedEventArgs) | ||
If IntPtr.Size = 4 Then | ||
Me.Monitor.Log(Helper.Translation.Get("ActiveRAMwarning"), LogLevel.Alert) | ||
是否启用内存极限警告 = True | ||
End If | ||
End Sub | ||
|
||
|
||
Public Sub 每一天结束时事件(sender As Object, e As DayEndingEventArgs) | ||
Dim a As Long = Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024 | ||
GC.Collect() | ||
Dim b As Long = Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024 | ||
|
||
Dim T1 As String = Helper.Translation.Get("Auto.Part1") | ||
Dim T2 As String = Helper.Translation.Get("Auto.Part2") | ||
Dim T3 As String = Helper.Translation.Get("Auto.Part3") | ||
|
||
Dim c As String = T1 & T2 & a & " MB " & T3 & b & " MB" | ||
Me.Monitor.Log(c, LogLevel.Debug) | ||
Game1.addHUDMessage(New HUDMessage(c, "")) | ||
|
||
If 是否启用内存极限警告 = True Then | ||
If b >= 3500 Then | ||
Dim x1 As String = Helper.Translation.Get("RAMwarning.Part1") | ||
Dim x2 As String = Helper.Translation.Get("RAMwarning.Part2") | ||
Me.Monitor.Log(x1, LogLevel.Alert) | ||
Me.Monitor.Log(x2, LogLevel.Alert) | ||
Game1.activeClickableMenu = New DialogueBox(x1 & "^" & x2) | ||
End If | ||
End If | ||
End Sub | ||
|
||
Public Sub 按钮按下时事件(sender As Object, e As ButtonPressedEventArgs) | ||
If e.Button = SButton.RightAlt Then | ||
Dim a As Long = Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024 | ||
GC.Collect() | ||
Dim b As Long = Process.GetCurrentProcess().PrivateMemorySize64 / 1024 / 1024 | ||
|
||
Dim T1 As String = Helper.Translation.Get("Manual.Part1") | ||
Dim T2 As String = Helper.Translation.Get("Manual.Part2") | ||
Dim T3 As String = Helper.Translation.Get("Manual.Part3") | ||
|
||
Dim c As String = T1 & T2 & a & " MB " & T3 & b & " MB" | ||
Me.Monitor.Log(c, LogLevel.Info) | ||
Game1.addHUDMessage(New HUDMessage(c, "")) | ||
|
||
If 是否启用内存极限警告 = True Then | ||
If b >= 3500 Then | ||
Dim x1 As String = Helper.Translation.Get("RAMwarning.Part1") | ||
Dim x2 As String = Helper.Translation.Get("RAMwarning.Part2") | ||
Me.Monitor.Log(x1, LogLevel.Alert) | ||
Me.Monitor.Log(x2, LogLevel.Alert) | ||
Game1.activeClickableMenu = New DialogueBox(x1 & "^" & x2) | ||
End If | ||
End If | ||
|
||
End If | ||
End Sub | ||
|
||
End Class | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<MySubMain>false</MySubMain> | ||
<SingleInstance>false</SingleInstance> | ||
<ShutdownMode>0</ShutdownMode> | ||
<EnableVisualStyles>true</EnableVisualStyles> | ||
<AuthenticationMode>0</AuthenticationMode> | ||
<ApplicationType>1</ApplicationType> | ||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit> | ||
</MyApplicationData> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Imports System | ||
Imports System.Reflection | ||
Imports System.Runtime.InteropServices | ||
|
||
' 有关程序集的一般信息由以下 | ||
' 控制。更改这些特性值可修改 | ||
' 与程序集关联的信息。 | ||
|
||
'查看程序集特性的值 | ||
|
||
<Assembly: AssemblyTitle("StardewAutoGC")> | ||
<Assembly: AssemblyDescription("")> | ||
<Assembly: AssemblyCompany("1059 Studio")> | ||
<Assembly: AssemblyProduct("StardewAutoGC")> | ||
<Assembly: AssemblyCopyright("Copyright © 1059 Studio 2021")> | ||
<Assembly: AssemblyTrademark("")> | ||
|
||
<Assembly: ComVisible(False)> | ||
|
||
'如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID | ||
<Assembly: Guid("b46092cf-a660-4f1c-b0aa-27ef43c4649b")> | ||
|
||
' 程序集的版本信息由下列四个值组成: | ||
' | ||
' 主版本 | ||
' 次版本 | ||
' 生成号 | ||
' 修订号 | ||
' | ||
'可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 | ||
'通过使用 "*",如下所示: | ||
' <Assembly: AssemblyVersion("1.0.*")> | ||
|
||
<Assembly: AssemblyVersion("1.0.0.0")> | ||
<Assembly: AssemblyFileVersion("1.2.0.0")> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<!-- | ||
Microsoft ResX Schema | ||
Version 2.0 | ||
The primary goals of this format is to allow a simple XML format | ||
that is mostly human readable. The generation and parsing of the | ||
various data types are done through the TypeConverter classes | ||
associated with the data types. | ||
Example: | ||
... ado.net/XML headers & schema ... | ||
<resheader name="resmimetype">text/microsoft-resx</resheader> | ||
<resheader name="version">2.0</resheader> | ||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
<value>[base64 mime encoded serialized .NET Framework object]</value> | ||
</data> | ||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
<comment>This is a comment</comment> | ||
</data> | ||
There are any number of "resheader" rows that contain simple | ||
name/value pairs. | ||
Each data row contains a name, and value. The row also contains a | ||
type or mimetype. Type corresponds to a .NET class that support | ||
text/value conversion through the TypeConverter architecture. | ||
Classes that don't support this are serialized and stored with the | ||
mimetype set. | ||
The mimetype is used for serialized objects, and tells the | ||
ResXResourceReader how to depersist the object. This is currently not | ||
extensible. For a given mimetype the value must be set accordingly: | ||
Note - application/x-microsoft.net.object.binary.base64 is the format | ||
that the ResXResourceWriter will generate, however the reader can | ||
read any of the formats listed below. | ||
mimetype: application/x-microsoft.net.object.binary.base64 | ||
value : The object must be serialized with | ||
: System.Serialization.Formatters.Binary.BinaryFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.soap.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
value : The object must be serialized into a byte array | ||
: using a System.ComponentModel.TypeConverter | ||
: and then encoded with base64 encoding. | ||
--> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
<xsd:complexType> | ||
<xsd:choice maxOccurs="unbounded"> | ||
<xsd:element name="metadata"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" /> | ||
<xsd:attribute name="type" type="xsd:string" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="assembly"> | ||
<xsd:complexType> | ||
<xsd:attribute name="alias" type="xsd:string" /> | ||
<xsd:attribute name="name" type="xsd:string" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="data"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> | ||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="resheader"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:choice> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
</root> |
Oops, something went wrong.