Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Programming/Scripting/Development/Web Design

Would this be useful? - Page 1

Would this be useful?

Posted by: pokechu22
Date: 2014-05-01 21:31:37
A long time ago I wrote a batch script for myself.  It's the console program that says "1 file(s) copied" in the background of some of my videos.  What it basicly does is constantly look for save-state #10, and then if it exists rename and move it into another folder, with a timestamp on it.  I use it a lot to allow accessing of older events, as you can write to it constantly and you won't loose anything.
I'm not going to share the origional script, as it is ugly and really buggy (EG: Rom names cannot have a space in them, because batch didn't feel like escaping charecters), but I'm working on a similar (but more complete) program in C#.  I'm curious if this would be imediately usefull, as I have a few other things I'm also working on.  When it's done I will share it, but does this seem like something I should spend most of my time working on?

Re: Would this be useful?

Posted by: OwnageMuch
Date: 2014-05-01 22:44:25
That actually sounds very useful, when I'm doing TAS work I often end up having a fair amount of trouble trying to organise my hundred or more savestates.

I don't know what it's like for other emulators than Dolphin but I imagine other people would have similar issues.

Re: Would this be useful?

Posted by: Zowayix
Date: 2014-05-02 02:26:30

but does this seem like something I should spend most of my time working on?


If it's something you feel is useful to yourself and you enjoy working on it, go for it. You may as well. It's not illegal to program something that you use but nobody else does. But aside from that, it does sound a bit like it could help people. Though if you're intending to actually make it for public use (as opposed to just for yourself and giving the source to people if they want it, which is an okay thing to do as well) you would want it to be configurable with which folder the savestates go into, etc.

Something to think about: Does it work (or is it going to work when made in C#) by just blindly checking for a file's existence in a loop, or that but with a sleep at the end of the loop? Or are you going to use something a bit more fancy and probably more recommended to check for files?

Re: Would this be useful?

Posted by: pokechu22
Date: 2014-05-02 08:13:43


but does this seem like something I should spend most of my time working on?


If it's something you feel is useful to yourself and you enjoy working on it, go for it. You may as well. It's not illegal to program something that you use but nobody else does. But aside from that, it does sound a bit like it could help people. Though if you're intending to actually make it for public use (as opposed to just for yourself and giving the source to people if they want it, which is an okay thing to do as well) you would want it to be configurable with which folder the savestates go into, etc.

Something to think about: Does it work (or is it going to work when made in C#) by just blindly checking for a file's existence in a loop, or that but with a sleep at the end of the loop? Or are you going to use something a bit more fancy and probably more recommended to check for files?


My C# implementation is using filesystemwatchers.  My batch one (which is one of the reasons why I'm redoing it in C#) uses a loop and the [tt]timeout /t 1[/tt] command. 

I'm working on making the newer one very configurable.  It seems that this will be useful to people, so I'm going to continue to work and try to make it functional in a useful way.

Re: Savestate tool - Status update 1

Posted by: pokechu22
Date: 2014-05-07 17:17:59
Ok, status update time.  It's been about a week, and I've been working on this for that time.  It isn't perfect, but it is at around the point the original batch file was at.  While programing this, I've learned a few things:
1, C#'s settings system is confusing.  It doesn't like user-defined classes, nor does it like dictionaries.  From stackoverflow, there were two ways to fix it: Set up XML serialization methods (I tried that and it didn't work), or modify the computer-generated code for the settings class.  The problem with doing that is that the designer likes undoing your work.  The way to fix it was to add [tt][global::System.Configuration.SettingsSerializeAs(System.Configuration.SettingsSerializeAs.Binary)][/tt] before the value.  I ended up moving that to a separate file so that visual studio didn't undo it.  For future reference, this is the code that I ended up with: 


[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SettingsSerializeAs(System.Configuration.SettingsSerializeAs.Binary)]
public global::GBSaveStateToolV2.RomDataItemDictionary ExtensionProperties
{
get
{
return ((global::GBSaveStateToolV2.RomDataItemDictionary)(this["ExtensionProperties"]));
}
set
{
this["ExtensionProperties"] = value;
}
}


2, if you have a constructor for a form, and you have a few other things pop-up during the constructor for getting required parameters, if you need to exit the constructor or program at user request you have to change the way the constructor is called:

Originally, I had this:
Application.Run(new StateUI(args[0]));
I had to change it to this:

StateUI s = new StateUI(args[0]);
if (!s.IsDisposed)
{
Application.Run(new StateUI(args[0]));
}





Also, I've had other issues.  After messing around with MessageBoxes, I ended up with some stuff in a while loop.  (if one result is chosen, keep prompting the user until data is valid).  Only, I included too much code in the loop, so I ended up starting my emulator…from a while loop.  I'm coding this on my school netbook, which isn't the fastest computer (though still decent), so having 50 instances of VisualBoyAdvance-m.exe running would have killed it.  Fortunately, the emulator is only capable of having 5 instances running at once (legacy link code?), so I just got dialog box spam.  Still, not the most enjoyable experience. 

Image1
Image2




I'm probably going to be releasing an earlier version of this program soon.  Maybe by Friday, possibly over the weekend.  Here's the features I expect to have in this release:

Some of the stuff I plan to set up in later versions:

And some things that I might eventually add:


If you have any questions, let me know.