mirror of
https://github.com/TheUltimateHacker/ShiftOS.git
synced 2025-01-22 16:12:14 +00:00
Mod work
Improved SRIP mod communication system and tested with mod, will soon release mod template files and documentation. Currently only has 4 commands, please add more. This is a starter.
This commit is contained in:
parent
a276b027fb
commit
965207dac5
5 changed files with 79 additions and 46 deletions
4
ShiftOS/Audio Player.Designer.vb
generated
4
ShiftOS/Audio Player.Designer.vb
generated
|
@ -288,10 +288,10 @@ Partial Class Audio_Player
|
||||||
'
|
'
|
||||||
Me.lbtitletext.AutoSize = True
|
Me.lbtitletext.AutoSize = True
|
||||||
Me.lbtitletext.BackColor = System.Drawing.Color.Transparent
|
Me.lbtitletext.BackColor = System.Drawing.Color.Transparent
|
||||||
Me.lbtitletext.Font = New System.Drawing.Font("Felix Titling", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
Me.lbtitletext.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||||
Me.lbtitletext.Location = New System.Drawing.Point(26, 7)
|
Me.lbtitletext.Location = New System.Drawing.Point(26, 7)
|
||||||
Me.lbtitletext.Name = "lbtitletext"
|
Me.lbtitletext.Name = "lbtitletext"
|
||||||
Me.lbtitletext.Size = New System.Drawing.Size(129, 18)
|
Me.lbtitletext.Size = New System.Drawing.Size(102, 18)
|
||||||
Me.lbtitletext.TabIndex = 19
|
Me.lbtitletext.TabIndex = 19
|
||||||
Me.lbtitletext.Text = "Audio Player"
|
Me.lbtitletext.Text = "Audio Player"
|
||||||
'
|
'
|
||||||
|
|
|
@ -572,4 +572,8 @@
|
||||||
Private Sub picsongtrack_MouseUp(sender As Object, e As MouseEventArgs) Handles picsongtrack.MouseUp
|
Private Sub picsongtrack_MouseUp(sender As Object, e As MouseEventArgs) Handles picsongtrack.MouseUp
|
||||||
tmrsongtrack.Interval = 200
|
tmrsongtrack.Interval = 200
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub lblintro_Click(sender As Object, e As EventArgs) Handles lblintro.Click
|
||||||
|
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
|
@ -21,6 +21,8 @@
|
||||||
Public redlevel As Integer
|
Public redlevel As Integer
|
||||||
Public pinklevel As Integer
|
Public pinklevel As Integer
|
||||||
|
|
||||||
|
Public sendToMod = False ' If true will output the rgb value for use of mod
|
||||||
|
|
||||||
#Region "Template Code"
|
#Region "Template Code"
|
||||||
|
|
||||||
Private Sub Template_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
Private Sub Template_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||||
|
@ -1648,6 +1650,12 @@
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub pnlnewcolour_Click(sender As Object, e As EventArgs) Handles pnlnewcolour.Click
|
Private Sub pnlnewcolour_Click(sender As Object, e As EventArgs) Handles pnlnewcolour.Click
|
||||||
|
If sendToMod = True Then
|
||||||
|
If Not My.Computer.FileSystem.DirectoryExists(NewAPI.modOutputPath) Then My.Computer.FileSystem.CreateDirectory(NewAPI.modOutputPath)
|
||||||
|
Dim sw As System.IO.StreamWriter = New IO.StreamWriter(NewAPI.modOutputPath & "\givecolour.srip") ' ShiftOS Request/Receive* Information Protocol (SRIP) *Depends on the direction
|
||||||
|
sw.WriteLine(pnlnewcolour.BackColor.ToArgb())
|
||||||
|
sw.Close()
|
||||||
|
End If
|
||||||
Select Case colourtochange
|
Select Case colourtochange
|
||||||
Case "Username Text Color"
|
Case "Username Text Color"
|
||||||
Shifter.usernametextcolor = pnlnewcolour.BackColor
|
Shifter.usernametextcolor = pnlnewcolour.BackColor
|
||||||
|
@ -1906,10 +1914,6 @@
|
||||||
Case "OrcWrite highlight text colour dono"
|
Case "OrcWrite highlight text colour dono"
|
||||||
OrcWrite.Button7.BackColor = pnlnewcolour.BackColor
|
OrcWrite.Button7.BackColor = pnlnewcolour.BackColor
|
||||||
OrcWrite.RichTextBox1.SelectionBackColor = pnlnewcolour.BackColor
|
OrcWrite.RichTextBox1.SelectionBackColor = pnlnewcolour.BackColor
|
||||||
Case "mod dono"
|
|
||||||
'Dim sw As New System.IO.StreamWriter(NewAPI.varpath & "\colourpickeroutput")
|
|
||||||
'sw.WriteLine(pnlnewcolour.BackColor.ToArgb)
|
|
||||||
'sw.Close()
|
|
||||||
Case "artpallet1" : ArtPad.colourpallet1.BackColor = pnlnewcolour.BackColor
|
Case "artpallet1" : ArtPad.colourpallet1.BackColor = pnlnewcolour.BackColor
|
||||||
Case "artpallet2" : ArtPad.colourpallet2.BackColor = pnlnewcolour.BackColor
|
Case "artpallet2" : ArtPad.colourpallet2.BackColor = pnlnewcolour.BackColor
|
||||||
Case "artpallet3" : ArtPad.colourpallet3.BackColor = pnlnewcolour.BackColor
|
Case "artpallet3" : ArtPad.colourpallet3.BackColor = pnlnewcolour.BackColor
|
||||||
|
|
|
@ -718,6 +718,9 @@ Public Class File_Skimmer
|
||||||
infobox.showinfo("Application Not Found", "ShiftOS could not find an application able the open audio files.")
|
infobox.showinfo("Application Not Found", "ShiftOS could not find an application able the open audio files.")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
ElseIf path Like "*.smf" Then
|
||||||
|
NewAPI.OpenModFile(path)
|
||||||
|
|
||||||
ElseIf path Like "*.saa" Then
|
ElseIf path Like "*.saa" Then
|
||||||
File_Crypt.DecryptFile(path & "\" & path, ShiftOSDesktop.ShiftOSPath + "Shiftum42\Drivers\HDD.dri", ShiftOSDesktop.sSecretKey)
|
File_Crypt.DecryptFile(path & "\" & path, ShiftOSDesktop.ShiftOSPath + "Shiftum42\Drivers\HDD.dri", ShiftOSDesktop.sSecretKey)
|
||||||
Dim sr As StreamReader = New StreamReader(ShiftOSDesktop.ShiftOSPath + "Shiftum42\Drivers\HDD.dri")
|
Dim sr As StreamReader = New StreamReader(ShiftOSDesktop.ShiftOSPath + "Shiftum42\Drivers\HDD.dri")
|
||||||
|
@ -810,8 +813,6 @@ Public Class File_Skimmer
|
||||||
ElseIf path Like "*.stp" Then
|
ElseIf path Like "*.stp" Then
|
||||||
Installer.Show()
|
Installer.Show()
|
||||||
Installer.txtfilepath.Text = (path)
|
Installer.txtfilepath.Text = (path)
|
||||||
ElseIf path Like "*.smf" Then
|
|
||||||
NewAPI.UseCode(path)
|
|
||||||
ElseIf path Like "*.trm" Then
|
ElseIf path Like "*.trm" Then
|
||||||
Terminal.Show()
|
Terminal.Show()
|
||||||
Terminal.runterminalfile(path)
|
Terminal.runterminalfile(path)
|
||||||
|
|
|
@ -2,12 +2,48 @@
|
||||||
Private Command As String
|
Private Command As String
|
||||||
Private NewModForm As New ModForm
|
Private NewModForm As New ModForm
|
||||||
|
|
||||||
|
' This stores the message and title values for the infobox, since they are created with 2 commands.
|
||||||
|
Dim modInfoMessage As String = "ShiftOS has been modified to create this infobox, use infobox.message = <your message> to customise it."
|
||||||
|
Dim modInfoTitle As String = "Info from Mod, customise it with infobox.title = <title>"
|
||||||
|
Dim isInfo As Integer = 0
|
||||||
|
' Tells other programs where to place output files
|
||||||
|
Public modOutputPath As String
|
||||||
|
Dim modInPath As String
|
||||||
|
|
||||||
Public Sub UseCode(ByVal Path As String)
|
Dim WithEvents trmReadModInput As New Timer
|
||||||
|
|
||||||
|
Public Sub ReadModInput(ByVal sender As Object, ByVal e As EventArgs) Handles trmReadModInput.Tick
|
||||||
|
If My.Computer.FileSystem.FileExists(modInPath) Then
|
||||||
|
UseCode(modInPath, modOutputPath)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub OpenModFile(path As String)
|
||||||
|
' Mod files are zips containing "config.set" and application files.
|
||||||
|
My.Computer.FileSystem.DeleteDirectory(ShiftOSDesktop.ShiftOSPath & "\Shiftum42\Temp\ModLoader", FileIO.DeleteDirectoryOption.DeleteAllContents)
|
||||||
|
My.Computer.FileSystem.CreateDirectory(ShiftOSDesktop.ShiftOSPath & "\Shiftum42\Temp\ModLoader")
|
||||||
|
|
||||||
|
System.IO.Compression.ZipFile.ExtractToDirectory(path, ShiftOSDesktop.ShiftOSPath & "\Shiftum42\Temp\ModLoader")
|
||||||
|
' Config contents: line1 = what exe to launch, line2 = path mod with write to, line 3 = folder mod will read from, line4 = connection delay in milliseconds
|
||||||
|
Dim configdata(3) As String
|
||||||
|
configdata = System.IO.File.ReadAllLines(ShiftOSDesktop.ShiftOSPath & "\Shiftum42\Temp\ModLoader\config.set")
|
||||||
|
Try
|
||||||
|
Process.Start(ShiftOSDesktop.ShiftOSPath & "\Shiftum42\Temp\ModLoader\" & configdata(0))
|
||||||
|
modOutputPath = configdata(2)
|
||||||
|
modInPath = configdata(1)
|
||||||
|
Catch ex As Exception
|
||||||
|
infobox.showinfo("Mod Error", "There is an error in the modification's config file. Please contact the developer of you mod. If you are the developer, remember: line1 = what exe to launch, line2 = path mod with write to, line 3 = folder mod will read from, line4 = connection delay in milliseconds")
|
||||||
|
End Try
|
||||||
|
trmReadModInput.Interval = configdata(3)
|
||||||
|
trmReadModInput.Start()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Public Sub UseCode(ByVal InPath As String, ByVal OutPath As String)
|
||||||
Dim sr As System.IO.StreamReader
|
Dim sr As System.IO.StreamReader
|
||||||
|
|
||||||
sr = My.Computer.FileSystem.OpenTextFileReader(Path)
|
sr = My.Computer.FileSystem.OpenTextFileReader(InPath)
|
||||||
Dim linenum As Integer = IO.File.ReadAllLines(Path).Length
|
Dim linenum As Integer = IO.File.ReadAllLines(InPath).Length
|
||||||
Dim i As Integer = 1
|
Dim i As Integer = 1
|
||||||
While i <= linenum
|
While i <= linenum
|
||||||
Command = sr.ReadLine()
|
Command = sr.ReadLine()
|
||||||
|
@ -15,13 +51,24 @@
|
||||||
i = i + 1
|
i = i + 1
|
||||||
End While
|
End While
|
||||||
sr.Close()
|
sr.Close()
|
||||||
|
My.Computer.FileSystem.DeleteFile(modInPath)
|
||||||
|
modOutputPath = OutPath
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub DoCommandAPI()
|
Private Sub DoCommandAPI()
|
||||||
If Command Like "infobox = *" Then
|
If Command Like "infobox.title = *" Then
|
||||||
Try
|
Try
|
||||||
Dim Message As String = Command.Substring(10)
|
Dim title As String = Command.Substring(16)
|
||||||
infobox.showinfo("Message from a ShiftOS Mod Files", Message)
|
modInfoTitle = title
|
||||||
|
isInfo = isInfo + 1
|
||||||
|
Catch ex As Exception
|
||||||
|
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
||||||
|
End Try
|
||||||
|
ElseIf Command Like "infobox.message = *" Then
|
||||||
|
Try
|
||||||
|
Dim Message As String = Command.Substring(18)
|
||||||
|
modInfoMessage = Message
|
||||||
|
isInfo = isInfo + 1
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
||||||
End Try
|
End Try
|
||||||
|
@ -39,42 +86,19 @@
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
||||||
End Try
|
End Try
|
||||||
ElseIf Command Like "window.create" Then
|
ElseIf Command Like "getcolour.title = *" Then
|
||||||
Try
|
Try
|
||||||
NewModForm.Show()
|
Dim title As String = Command.Substring(18)
|
||||||
Catch ex As Exception
|
Colour_Picker.colourtochange = title
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
Colour_Picker.Show()
|
||||||
End Try
|
Colour_Picker.sendToMod = True
|
||||||
ElseIf Command Like "label.create = *" Then
|
|
||||||
Try
|
|
||||||
NewModForm.CreateLabel(Command.Substring(15))
|
|
||||||
Catch ex As Exception
|
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
|
||||||
End Try
|
|
||||||
ElseIf Command Like "label.select = *" Then
|
|
||||||
Try
|
|
||||||
NewModForm.SelectLabel(Command.Substring(15))
|
|
||||||
Catch ex As Exception
|
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
|
||||||
End Try
|
|
||||||
ElseIf Command Like "SelectedLabel.Location.X = *" Then
|
|
||||||
Try
|
|
||||||
NewModForm.MoveSelectedLabelLocationX(Command.Substring(27))
|
|
||||||
Catch ex As Exception
|
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
|
||||||
End Try
|
|
||||||
ElseIf Command Like "SelectedLabel.Location.Y = *" Then
|
|
||||||
Try
|
|
||||||
NewModForm.MoveSelectedLabelLocationY(Command.Substring(27))
|
|
||||||
Catch ex As Exception
|
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
|
||||||
End Try
|
|
||||||
ElseIf Command Like "SelectedLabel.Text = *" Then
|
|
||||||
Try
|
|
||||||
NewModForm.SelectedLabelText(Command.Substring(21))
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
infobox.showinfo("Critical Modification Application Error", "A critical error occured whilst trying to add to your codepoint value - please contact the developer of your mod")
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
|
If isInfo > 2 Then
|
||||||
|
infobox.showinfo(modInfoTitle, modInfoMessage)
|
||||||
|
isInfo = 0
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
End Module
|
End Module
|
||||||
|
|
Loading…
Reference in a new issue