How to change AudioDevice value in a config?

Discussions about Coding and Scripting
sn260591
Average
Posts: 75
Joined: Sat Jun 01, 2013 10:38 am

How to change AudioDevice value in a config?

Post by sn260591 »

I tried this code:

Code: Select all

Class'Engine.Engine'.Default.AudioDevice = Class<AudioSubsystem>(DynamicLoadObject("Galaxy.GalaxyAudioSubsystem",Class'Class'));
Class'Engine.Engine'.Static.StaticSaveConfig();
But this way makes incorrect entries in ini:
Image
How to make so that entries were without "Class''"?
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: How to change AudioDevice value in a config?

Post by JackGriffin »

Why are you trying to change defaults on a client? Don't make us get out the pitchforks.

You do not do things like this. Why in the world would you have a good reason to want to?
So long, and thanks for all the fish
sn260591
Average
Posts: 75
Joined: Sat Jun 01, 2013 10:38 am

Re: How to change AudioDevice value in a config?

Post by sn260591 »

I just want to be able to change the Audio Device from the game menu. It has no relation to a multiplayer.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: How to change AudioDevice value in a config?

Post by JackGriffin »

There's a reason why it's not there. You have to reload your game after changing that, it's not something you do on the fly. Well, unless you want to see your desktop.
So long, and thanks for all the fish
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: How to change AudioDevice value in a config?

Post by sektor2111 »

I have generated an XC_Engine.Int file for accessing properties. Look what was saved later

Code: Select all

[XC_Engine.XC_GameEngine]
...
ServerActors=IpDrv.UdpBeacon
ServerActors=IpServer.UdpServerQuery
GameRenderDevice=Class'D3D9Drv.D3D9RenderDevice'
AudioDevice=Class'Galaxy.GalaxyAudioSubsystem'
Console=Class'XConsole.XConsole'
NetworkDevice=Class'IpDrv.TcpNetDriver'
Language=None
As I could see it doesn't seems to disturb properties... or does it do in Audio devices chapter ? It was added "Class".
sn260591
Average
Posts: 75
Joined: Sat Jun 01, 2013 10:38 am

Re: How to change AudioDevice value in a config?

Post by sn260591 »

JackGriffin wrote:You have to reload your game after changing that, it's not something you do on the fly.
I know about it and I am going to use automatic restart of game.

sektor2111, it does not work with original Engine. Game crashes after launch
Image
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: How to change AudioDevice value in a config?

Post by sektor2111 »

Now I'm sure about they have to be defined in native form without word "class". "Class" seems to trigger unexistent things which indeed drive to an instant crash. Interesting to find these. Did you tried "SetPropertyText" ? ConsoleCommand ?
Chris
Experienced
Posts: 134
Joined: Mon Nov 24, 2014 9:27 am

Re: How to change AudioDevice value in a config?

Post by Chris »

Did Epic forget to remove tokens for UClassProperty when using the '.default.'?

Seems like you would be able to use the ConsoleCommand() instead.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: How to change AudioDevice value in a config?

Post by sektor2111 »

Chris, I did a small menu section saving "engine.engine" config. You don't wanna see newer INI, engine simply screws properties.
"class" is added, CacheSizeMegs=... UseSound=True have a copy under "[engine.engine]" section exactly as "[engine.gameengine]". Well, that's explaining some "features", result is just trash if you trigger a SaveConfig() from Uscript. I was trying to make a menu section for adding XC_Engine. I'm not sure if is doable as long as saving configuration went badly garbled. NetworkDriver works just using INT but not GameEngine value.
sn260591
Average
Posts: 75
Joined: Sat Jun 01, 2013 10:38 am

Re: How to change AudioDevice value in a config?

Post by sn260591 »

Chris wrote:Seems like you would be able to use the ConsoleCommand() instead.
I also tried to do so:

Code: Select all

DynamicLoadObject("Galaxy.GalaxyAudioSubsystem",Class'Class');
GetPlayerOwner().ConsoleCommand("set ini:Engine.Engine.AudioDevice class Galaxy.GalaxyAudioSubsystem");
It changes variable value in a random access memory, but doesn't save it in a config.

sektor2111, you can explain to me how to use SetPropertyText, please?
User avatar
Dr.Flay
Godlike
Posts: 3347
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK
Contact:

Re: How to change AudioDevice value in a config?

Post by Dr.Flay »

Can you not just copy the way it is already done in the existing int files ?
Sound.png
Sound.png (8.31 KiB) Viewed 2450 times
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: How to change AudioDevice value in a config?

Post by sektor2111 »

sn260591 wrote: sektor2111, you can explain to me how to use SetPropertyText, please?
Look at Core.Object class for syntax hints. I have also an example from something against spamming:

Code: Select all

	ForEach AllActors ( class 'UnrealShare.SpawnPoint', So )
	{
		if ( So != None && So.class == class 'UnrealShare.SpawnPoint' )
		{
			Sn = Spawn(class 'MH_A_V1.SpawnPoint',,,So.Location+vect(0,0,1),So.Rotation);
			if ( Sn != None )
			{
//				Log (Sn$" spawned for "$So);
				if (So.Tag != '') Sn.SetPropertyText("Tag",So.GetPropertyText("Tag"));
				if (So.Event != '') Sn.SetPropertyText("Event",So.GetPropertyText("Event"));
				Sn.SetPropertyText("factory",So.GetPropertyText("factory"));
				So.SetPropertyText("Tag",("None"));
//				log (Sn$" new tag is "$Sn.Tag);
//				log ( So.Tag$" is the Tag from "$So);
			}
		}
	}
But I cannot be sure if will work with engine section as long as saving configuration is doing nasty things and maybe you'll need some C++ help. I'm gonna try these too.
sn260591
Average
Posts: 75
Joined: Sat Jun 01, 2013 10:38 am

Re: How to change AudioDevice value in a config?

Post by sn260591 »

Thanks, but it's not working.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: How to change AudioDevice value in a config?

Post by sektor2111 »

I figured... looks like they can be changed only using INT files.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: How to change AudioDevice value in a config?

Post by JackGriffin »

I get the whole 'lets tinker with this' idea but why would you ever want to try to force a change for this via script?
So long, and thanks for all the fish
Post Reply