A wild lurker appears!
Quote from: ForeverZer0 on August 02, 2014, 05:51:59 pm
Download (8 kB)
Give that a try. Feel free to distribute/share as you please.
Let me know if you need any adjustments.
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
namespace XpAceEditor
{
static class Program
{
[DllImport("Kernel32", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool WritePrivateProfileString(string lpAppName,
string lpKeyName, string lpString, string lpFileName);
[DllImport("User32")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
[DllImport("Kernel32")]
private static extern IntPtr GetConsoleWindow();
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
if (!File.Exists("Game.ini") || !File.Exists("Game.rxproj"))
{
Console.WriteLine("Missing files!\nGame.ini and Game.rxproj must be located in same folder.");
Console.ReadLine();
Environment.Exit(0);
}
// Hide the console window
var hWnd = GetConsoleWindow();
ShowWindow(hWnd, 0);
// Get current attributes, and remove read-only if needed
var ini = Path.Combine(Environment.CurrentDirectory, "Game.ini");
var attributes = File.GetAttributes(ini);
if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
attributes &= ~FileAttributes.ReadOnly;
File.SetAttributes(ini, attributes);
}
var proc = new Process();
proc.StartInfo.FileName = "Game.rxproj";
proc.Start();
// Wait 10 seconds for the editor to start up
Thread.Sleep(10000);
// Set the library name and read-only attribute
WritePrivateProfileString("Game", "Library", "RGSS301.dll", ini);
File.SetAttributes(ini, attributes | FileAttributes.ReadOnly);
// Wait for editor to exit and set attributes back to how they were
proc.WaitForExit();
File.SetAttributes(ini, attributes);
}
}
}
EDIT:
I forgot to mention, you must wait 10 seconds after hitting the launcher for it to take effect. I just picked an arbitrary amount of time to make sure the editor got through all its startup stuff.
So I'm more than a little late to the party when it comes to RMXP, but as a relative newcomer to RM in general (didn't hop on the bandwagon until I got RMXP & RMVXA in a Humble Bundle offer), I only recently found out about XPAce and wanted to give it a try. I got it installed just fine in a new project, but since I'm running XP through Steam, my Game.ini keeps getting overwritten. I know it's a long shot, but does anybody still have a link to ForeverZer0's modified launcher (see above)? I'd try compiling it myself, but I'm nearly out of space on my SSD and don't have enough room to install Visual Studio.
And just to clarify, can XPAce be used in commercial projects or is it for non-commercial use only? As I understand it, scripts such as
XPA Tilemap are labeled for non-commercial use, so does that extend to XPA itself? I looked over the licensing info in the XPA documentation but I may have missed something since I didn't see it stated explicitly. Apologies if it's a stupid question, just wanted to make extra sure. For the record, I do have licenses for both RMVXA and RMXP, along with the latest RMMV.
Thanks to everyone who's kept this project and the many other awesome XP scripts updated over the years. This site is a treasure trove of XP goodness and I'm truly grateful that it's stuck around for all this time. Kudos to you guys!