Portal 2 Extras Menu Patcher 1.0
Quote from Haapavuo on April 29, 2011, 8:35 amDrag & drop custom maps to add them to the Portal 2 Extras menu (for easy loading without console)!
It is very easy to use: It will automatically get your portal2.exe path & map name in the folder where the patcher is. Just set the title and subtitle. You can also set a picture for your map (not necessary).
The program can save default settings to an ini file to make patching even easier. It also supports drag & dropping .bsp, .vtf, .txt and .exp files. .txt and .exp have to be in the example format. You can easily create such files with the program and release them with your maps.
It can also copy map files to the portal2maps folder. Try drag & dropping your map file onto the program to easily patch extras.txt and copy the map file to Portal 2!
The program will also notice if the map already exists in the extras.txt and will ask the user if he wants to update the information.
You can now also patch version 7.5 .vtf files to version 7.4!
The program is made using Visual C# 2010 Express so it'll need the .NET Runtime to be installed.
Thanks for reading & testing the program! Please report if you encounter any problems with it!
File Name: Portal2ExtrasPatcher.zip
File Size: 74.7 KiB
Click here to download Portal 2 Extras Menu Patcher
Drag & drop custom maps to add them to the Portal 2 Extras menu (for easy loading without console)!
It is very easy to use: It will automatically get your portal2.exe path & map name in the folder where the patcher is. Just set the title and subtitle. You can also set a picture for your map (not necessary).
The program can save default settings to an ini file to make patching even easier. It also supports drag & dropping .bsp, .vtf, .txt and .exp files. .txt and .exp have to be in the example format. You can easily create such files with the program and release them with your maps.
It can also copy map files to the portal2maps folder. Try drag & dropping your map file onto the program to easily patch extras.txt and copy the map file to Portal 2!
The program will also notice if the map already exists in the extras.txt and will ask the user if he wants to update the information.
You can now also patch version 7.5 .vtf files to version 7.4!
The program is made using Visual C# 2010 Express so it'll need the .NET Runtime to be installed.
Thanks for reading & testing the program! Please report if you encounter any problems with it!
File Name: Portal2ExtrasPatcher.zip
File Size: 74.7 KiB
Click here to download Portal 2 Extras Menu Patcher
Quote from Beer-Me on April 29, 2011, 11:10 amGreat work so far, I think you should add another implementation.
Suggestion 1
You create a file format that map makers will use to create a custom text file that has the relevant map info (Map ID, filename, title, subtitle, picture etc). Therefore each map released could include one of these files.
You then drag + drop that text file, into your application. The app will then parse the new file type, grabbing relevant information. It will then open up the default extras.txt and add the new map data.
Suggestion 2
You create a folder in the Portal 2 directory called Extra Maps, inside of this will store each of the custom map extra files I described earlier. Your app will then loop through all the txt files within that folder and create a new extras.txt based on that information. This is incase you delete your extas.txt file, your app will still be able to generate a new one with the relevant map information.
Great work so far, I think you should add another implementation.
Suggestion 1
You create a file format that map makers will use to create a custom text file that has the relevant map info (Map ID, filename, title, subtitle, picture etc). Therefore each map released could include one of these files.
You then drag + drop that text file, into your application. The app will then parse the new file type, grabbing relevant information. It will then open up the default extras.txt and add the new map data.
Suggestion 2
You create a folder in the Portal 2 directory called Extra Maps, inside of this will store each of the custom map extra files I described earlier. Your app will then loop through all the txt files within that folder and create a new extras.txt based on that information. This is incase you delete your extas.txt file, your app will still be able to generate a new one with the relevant map information.
Check out my Portal 2 map, Entrapment!
http://forums.thinking.withportals.com/community-releases/entrapment-1-1-1-t2323.html
Quote from Nightgunner5 on April 29, 2011, 11:49 amI just started it up and was greeted with a fatal error.
- Code: Select all
************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Portal2ExtrasMod.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I just started it up and was greeted with a fatal error.
- Code: Select all
************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Portal2ExtrasMod.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Quote from Beer-Me on April 29, 2011, 11:51 amDo you have the .NET 3.0 runtimes installed?
Do you have the .NET 3.0 runtimes installed?
Check out my Portal 2 map, Entrapment!
http://forums.thinking.withportals.com/community-releases/entrapment-1-1-1-t2323.html
Quote from Nightgunner5 on April 29, 2011, 12:18 pmBeer-Me wrote:Do you have the .NET 3.0 runtimes installed?Yes, I have .NET 3.0, as well as 3.5 and 4 for that matter.
Yes, I have .NET 3.0, as well as 3.5 and 4 for that matter.
Quote from Beer-Me on April 29, 2011, 12:34 pmThe error usually occurs when an array is accessed at an invalid index location, making it outside of the index's bounds.
Looking at the source code, the area that it is likely to occur is within:
- Code: Select all
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.bsp");
if (files != null)
{
files[0] = Path.GetFileName(files[0]);
files[0] = files[0].Remove(files[0].Length - 4);
this.txt_mapfile.Text = files[0];
this.txt_ID.Text = files[0];
}He really needs to check whether files[0] is not empty (null). Hes checking to see if the array is empty, its not but the array elements are.
You should really use if (files.length > 0)
The error usually occurs when an array is accessed at an invalid index location, making it outside of the index's bounds.
Looking at the source code, the area that it is likely to occur is within:
- Code: Select all
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.bsp");
if (files != null)
{
files[0] = Path.GetFileName(files[0]);
files[0] = files[0].Remove(files[0].Length - 4);
this.txt_mapfile.Text = files[0];
this.txt_ID.Text = files[0];
}
He really needs to check whether files[0] is not empty (null). Hes checking to see if the array is empty, its not but the array elements are.
You should really use if (files.length > 0)
Check out my Portal 2 map, Entrapment!
http://forums.thinking.withportals.com/community-releases/entrapment-1-1-1-t2323.html
Quote from Haapavuo on April 29, 2011, 1:08 pmBeer-Me wrote:The error usually occurs when an array is accessed at an invalid index location, making it outside of the index's bounds.Looking at the source code, the area that it is likely to occur is within:
- Code: Select all
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.bsp");
if (files != null)
{
files[0] = Path.GetFileName(files[0]);
files[0] = files[0].Remove(files[0].Length - 4);
this.txt_mapfile.Text = files[0];
this.txt_ID.Text = files[0];
}He really needs to check whether files[0] is not empty (null). Hes checking to see if the array is empty, its not but the array elements are.
You should really use if (files.length > 0)
Thanks for your replies! I think I've fixed it now.
I will try to make the implementations you mentioned earlier...
Looking at the source code, the area that it is likely to occur is within:
- Code: Select all
string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.bsp");
if (files != null)
{
files[0] = Path.GetFileName(files[0]);
files[0] = files[0].Remove(files[0].Length - 4);
this.txt_mapfile.Text = files[0];
this.txt_ID.Text = files[0];
}
He really needs to check whether files[0] is not empty (null). Hes checking to see if the array is empty, its not but the array elements are.
You should really use if (files.length > 0)
Thanks for your replies! I think I've fixed it now.
I will try to make the implementations you mentioned earlier...
Quote from Nightgunner5 on April 29, 2011, 2:50 pmIt would be cool if it was possible to click and drag a file like this:
- Code: Select all
//include_maps:n5_sequential01.bsp:n5_sequential02.bsp:n5_sequential03.bsp
//include_materials/vgui/extras:n5_sequential01.vmt:n5_sequential01.vtf
"n5_sequential01"
{
"title" "Sequential"
"subtitle" "A custom map by Nightgunner5"
"pic" "vgui/extras/n5_sequential01"
"map" "n5_sequential01"
}Onto your program and have it automatically install everything that is needed.
It would be cool if it was possible to click and drag a file like this:
- Code: Select all
//include_maps:n5_sequential01.bsp:n5_sequential02.bsp:n5_sequential03.bsp
//include_materials/vgui/extras:n5_sequential01.vmt:n5_sequential01.vtf
"n5_sequential01"
{
"title" "Sequential"
"subtitle" "A custom map by Nightgunner5"
"pic" "vgui/extras/n5_sequential01"
"map" "n5_sequential01"
}
Onto your program and have it automatically install everything that is needed.
Quote from Haapavuo on April 29, 2011, 3:26 pmNightgunner5 wrote:It would be cool if it was possible to click and drag a file like this:
- Code: Select all
//include_maps:n5_sequential01.bsp:n5_sequential02.bsp:n5_sequential03.bsp
//include_materials/vgui/extras:n5_sequential01.vmt:n5_sequential01.vtf
"n5_sequential01"
{
"title" "Sequential"
"subtitle" "A custom map by Nightgunner5"
"pic" "vgui/extras/n5_sequential01"
"map" "n5_sequential01"
}Onto your program and have it automatically install everything that is needed.
I'll try to make that possible.
What are those commented lines? Are those important?
- Code: Select all
//include_maps:n5_sequential01.bsp:n5_sequential02.bsp:n5_sequential03.bsp
//include_materials/vgui/extras:n5_sequential01.vmt:n5_sequential01.vtf
"n5_sequential01"
{
"title" "Sequential"
"subtitle" "A custom map by Nightgunner5"
"pic" "vgui/extras/n5_sequential01"
"map" "n5_sequential01"
}
Onto your program and have it automatically install everything that is needed.
I'll try to make that possible.
What are those commented lines? Are those important?
Quote from Nightgunner5 on April 29, 2011, 3:28 pmHaapavuo wrote:Nightgunner5 wrote:It would be cool if it was possible to click and drag a file like this:
- Code: Select all
//include_maps:n5_sequential01.bsp:n5_sequential02.bsp:n5_sequential03.bsp
//include_materials/vgui/extras:n5_sequential01.vmt:n5_sequential01.vtf
"n5_sequential01"
{
"title" "Sequential"
"subtitle" "A custom map by Nightgunner5"
"pic" "vgui/extras/n5_sequential01"
"map" "n5_sequential01"
}Onto your program and have it automatically install everything that is needed.
I'll try to make that possible.
What are those commented lines? Are those important?
That's actually a working configuration file for my patcher. The commented lines tell it files to copy.
- Code: Select all
//include_maps:n5_sequential01.bsp:n5_sequential02.bsp:n5_sequential03.bsp
//include_materials/vgui/extras:n5_sequential01.vmt:n5_sequential01.vtf
"n5_sequential01"
{
"title" "Sequential"
"subtitle" "A custom map by Nightgunner5"
"pic" "vgui/extras/n5_sequential01"
"map" "n5_sequential01"
}
Onto your program and have it automatically install everything that is needed.
I'll try to make that possible.
What are those commented lines? Are those important?
That's actually a working configuration file for my patcher. The commented lines tell it files to copy.