The Source!

Moderator: Moderatoren

3 Beiträge Seite 1 von 1
acklavidian
Grünschnabel
Grünschnabel
Beiträge: 1
Registriert: 20.01.2011 00:10


I am a avid oblivion modder, and was wondering if I could see the source for the Nehrim Launcher. I want to make one of my own. Any tips or anything would be helpful. I mainly use c++ outside of Oblivion I also am familiar with many other languages, but anything that could get me started in the right direction with that would be great. Thanks
Fenixp
Bettler
Bettler
Beiträge: 6
Registriert: 02.02.2011 23:34


I couldn't know, but judging from it using .net framework, it probably is C#. And making the launcher probably ain't that hard either: Basically a link to the Oblivion.exe in Nehrim folder to boot the game up, importing and then writing into .ini files of Oblivion to change settings, and update just connects to servers and searches for newest patches. Just what I think as a programmer - it may of course be entirely different, for I have never seen the source codes. It's a neat work thou.

Oh right, plug-in selection is also written in an external text file.
Hoxyd
SureAI
SureAI
Schwarzer Wächter
Schwarzer Wächter
Beiträge: 4695
Registriert: 02.10.2005 16:09
Hat sich bedankt: 130 Mal
Danksagung erhalten: 228 Mal


Yeah, the launcher is written in Visual Basic.Net and is basically a read, write and execute program. As a C++ programmer it shouldn't be a big thing to create something similar. The launcher has about 10000 lines of code at the moment, so not that easy to get an overview.

But as an example the full code of the data file selection in Visual Basic. Maybe this could help.
Code: Alles auswählen
   '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    '   DATAFILES BROWSER
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    Dim ESM_ESP_Path As String = My.Computer.FileSystem.CurrentDirectory + "\Data\"
    Dim Plugins_txt_Path As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
    Dim SaveDatafiles As String

    Dim DataFileCounter As Integer = 0

    Dim CheckData As Byte

    Dim b As Integer = 0
    Dim x As Integer = 0
    Dim y As Integer = 0

    'Click Data Files Accept Button
    Private Sub SpieldateienBackButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPluginDataAccecpt.Click
        My.Computer.Audio.Play(My.Resources.SoundDataFiles01, AudioPlayMode.Background)
        ButtonStartNehrim.Visible = True
        ListIndex.Enabled = False
        ButtonListDown.Enabled = False
        ButtonListUp.Enabled = False
        CheckboxSpieldateien.Visible = False
        ButtonPluginDataAccecpt.Visible = False
        ButtonListDown.Visible = False
        ButtonListUp.Visible = False
        ListIndex.Visible = False


        b = 0
        Dim listelems As Integer
        listelems = 0
        Dim SaveDatafiles As System.IO.StreamWriter = New StreamWriter(Plugins_txt_Path + "\Oblivion\Plugins.txt")

        SaveDatafiles.WriteLine("# This file is used to tell Oblivion which data files to load.")
        SaveDatafiles.WriteLine("# Use the ""data files"" option in the Oblivion launcher to choose which files")
        SaveDatafiles.WriteLine("# you want.  Please do not modify this file.")
        SaveDatafiles.WriteLine("")
        listelems = Me.CheckboxSpieldateien.Items.Count
        Do While listelems > b
            If (Me.CheckboxSpieldateien.GetItemChecked(b)) Then
                SaveDatafiles.WriteLine(Me.CheckboxSpieldateien.Items(b))
            End If

            b = b + 1
        Loop

        b = 0

        SaveDatafiles.Close()

        Me.CheckboxSpieldateien.Items.Clear()
        ESM_ESP_Path = ("")
    End Sub

    Dim ChangeEntry As String

    'Click Data Files Button
    Private Sub ButtonSpielDateien_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPluginData.Click
        My.Computer.Audio.Play(My.Resources.SoundDataFiles01, AudioPlayMode.Background)

        If (My.Computer.FileSystem.DirectoryExists("Data\")) Then
            ButtonStartNehrim.Visible = False
            ButtonPluginDataAccecpt.Visible = True
            CheckboxSpieldateien.Visible = True
            CheckboxSpieldateien.ScrollAlwaysVisible = True
            ButtonListDown.Visible = True
            ButtonListUp.Visible = True
            ListIndex.Visible = True


            If (My.Computer.FileSystem.FileExists(Plugins_txt_Path + "\Oblivion\Plugins.txt")) Then 'Files in Plugins.txt
                CheckData = 1
            Else
                Dim SaveDatafiles As System.IO.StreamWriter = New StreamWriter(Plugins_txt_Path + "\Oblivion\Plugins.txt")
                SaveDatafiles.WriteLine("# This file is used to tell Oblivion which data files to load.")
                SaveDatafiles.WriteLine("# Use the ""data files"" option in the Oblivion launcher to choose which files")
                SaveDatafiles.WriteLine("# you want.  Please do not modify this file.")
                SaveDatafiles.WriteLine("")
                SaveDatafiles.Close()
                CheckData = 1
            End If

            Dim CurrentLine As String = 0
            Dim PreDataFileCounter As Integer
            PreDataFileCounter = 0


            If (CheckData = 1) Then

                Dim SaveDatafiles As System.IO.StreamReader = File.OpenText(Plugins_txt_Path + "\Oblivion\Plugins.txt")
                CurrentLine = 0

                Do Until (CurrentLine.Contains(".es") Or SaveDatafiles.Peek = -1)
                    PreDataFileCounter = PreDataFileCounter + 1
                    CurrentLine = SaveDatafiles.ReadLine()
                Loop

                If (CurrentLine.Contains(".es") = True) Then
                    PreDataFileCounter = PreDataFileCounter - 1
                    SaveDatafiles.Close()
                    CheckData = 2
                Else
                    SaveDatafiles.Close()
                    CheckData = 2
                End If

            End If

            If (CheckData = 2) Then

                DataFileCounter = 0
                Dim plugintxtliste(500) As String
                Dim err As Integer
                Dim SaveDatafiles As System.IO.StreamReader = File.OpenText(Plugins_txt_Path + "\Oblivion\Plugins.txt")

                Do Until SaveDatafiles.EndOfStream

                    If (DataFileCounter < PreDataFileCounter) Then
                        SaveDatafiles.ReadLine()
                        DataFileCounter = DataFileCounter + 1
                    ElseIf (DataFileCounter >= PreDataFileCounter) Then
                        plugintxtliste(b) = SaveDatafiles.ReadLine
                        b = b + 1
                    End If
                Loop

                SaveDatafiles.Close()
                y = b
                ESM_ESP_Path = My.Computer.FileSystem.CurrentDirectory + "\Data\"
                For Each Me.ESM_ESP_Path In My.Computer.FileSystem.GetFiles(ESM_ESP_Path, FileIO.SearchOption.SearchTopLevelOnly, "*.es*")
                    Do While x < y
                        If (0 = (String.Compare(plugintxtliste(x), IO.Path.GetFileName(ESM_ESP_Path)))) Then    'Listenelement	= Element aus Plugins.txt
                            err = 1
                        End If
                        x = x + 1
                    Loop
                    If err = 1 Then
                        err = 0
                    Else
                        plugintxtliste(y) = IO.Path.GetFileName(ESM_ESP_Path) 'Neues Listenelement mit Index
                        y = y + 1
                    End If
                    x = 0
                Next
                Do While x < y
                    Me.CheckboxSpieldateien.Items.Add(plugintxtliste(x))
                    If x < b Then
                        Me.CheckboxSpieldateien.SetItemChecked(x, True)
                    End If
                    x = x + 1
                Loop
                x = 0
                y = 0
                b = 0
                CheckData = 2
            End If

        Else
            'MsgBox("Es kann kein Data-Verzeichnis gefunden werden.") No data directory can be found.
            MsgBox(MsgNoDataFolderNote) ' No data directory can be found.
            Exit Sub
        End If
    End Sub

    'Show Index Number 
    Private Sub ListIndex_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckboxSpieldateien.SelectedIndexChanged
        ListIndex.Enabled = True
        ListIndex.Text = CheckboxSpieldateien.SelectedIndex
        ButtonListDown.Enabled = True
        ButtonListUp.Enabled = True
    End Sub

    'Click Data File Down Button
    Private Sub ButtonListDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonListDown.Click
        My.Computer.Audio.Play(My.Resources.SoundUpDown01, AudioPlayMode.Background)
        With sender
            Dim index As Integer = CheckboxSpieldateien.SelectedIndex
            Dim check As Integer
            If (CheckboxSpieldateien.SelectedIndex <> -1) Then
                ButtonListDown.Enabled = True
                ButtonListUp.Enabled = True
                If index < CheckboxSpieldateien.Items.Count - 1 Then
                    Dim AktuellesItem As Object = CheckboxSpieldateien.SelectedItem
                    check = CheckboxSpieldateien.GetItemCheckState(index)
                    CheckboxSpieldateien.Items.RemoveAt(index)
                    CheckboxSpieldateien.Items.Insert(index + 1, AktuellesItem)
                    CheckboxSpieldateien.SelectedIndex = index + 1
                    If check = 1 Then
                        CheckboxSpieldateien.SetItemChecked(index + 1, True)
                    End If
                End If
            Else
                Exit Sub
            End If
        End With

    End Sub

    'Click Data File Up Button
    Private Sub ButtonListUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonListUp.Click
        My.Computer.Audio.Play(My.Resources.SoundUpDown01, AudioPlayMode.Background)
        With sender
            Dim index As Integer = CheckboxSpieldateien.SelectedIndex
            Dim check As Integer
            If (CheckboxSpieldateien.SelectedIndex <> -1) Then
                ButtonListDown.Enabled = True
                ButtonListUp.Enabled = True
                If index > 0 Then
                    Dim AktuellesItem As Object = CheckboxSpieldateien.SelectedItem
                    check = CheckboxSpieldateien.GetItemCheckState(index)
                    CheckboxSpieldateien.Items.RemoveAt(index)
                    CheckboxSpieldateien.Items.Insert(index - 1, AktuellesItem)
                    CheckboxSpieldateien.SelectedIndex = index - 1
                    If check = 1 Then
                        CheckboxSpieldateien.SetItemChecked(index - 1, True)
                    End If
                End If
            Else
                Exit Sub
            End If
        End With

    End Sub
The programmer guy from the Oblivion total conversion MERP created also an launcher with Visual Basic for there project. Check this video out.

http://www.youtube.com/watch?v=gcl8K3qc ... r_embedded
3 Beiträge Seite 1 von 1

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast