Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » how to locate renegade folder programmatically
how to locate renegade folder programmatically [message #230011] Sat, 11 November 2006 13:07 Go to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Does anyone have any information on how to locate the renegade data folder programmatically?


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: how to locate renegade folder programmatically [message #230038 is a reply to message #230011] Sat, 11 November 2006 15:24 Go to previous messageGo to next message
Cat998
Messages: 1081
Registered: January 2004
Location: Austria, Vienna
Karma: 0
General (1 Star)
Moderator/Captain

You could maybe use the Renegade install path from the registry ?

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter then "Yes"

Programming is like sex: one mistake and you have to support it for the rest of your life

Want the best answers? Ask the best questions!

"So long, and thanks for all the fish."
Re: how to locate renegade folder programmatically [message #230048 is a reply to message #230038] Sat, 11 November 2006 16:10 Go to previous messageGo to next message
Jerad2142 is currently offline  Jerad2142
Messages: 3809
Registered: July 2006
Location: USA
Karma: 6
General (3 Stars)
I have noticed your debug script places debug files in the Renegade directory, I use this script to set stuff up for my levels, I just put "data/name" in the file name spot, and it saves the file to the Renegade directory.

Re: how to locate renegade folder programmatically [message #230072 is a reply to message #230011] Sat, 11 November 2006 18:36 Go to previous messageGo to next message
Dave Anderson is currently offline  Dave Anderson
Messages: 1953
Registered: December 2004
Location: United States
Karma: 0
General (1 Star)
using namespace Microsoft::Win32;

String^ Install_Path = Convert::ToString(Registry::GetValue("HKEY_LOCAL_MACHINE\\Software\\Westwood\\Renegade\\", "InstallPath", "Error getting data."));


Since it returns the path with "Renegade.exe" at the end, simply remove the last 12 characters from the return value.

Install_Path = Install_Path->Remove(Install_Path->Length - 12, 12);


Then append the path to the data folder.

Install_Path += "\Data\";


The full method:

using namespace Microsoft::Win32;

String ^Install_Path = Convert::ToString(Registry::GetValue("HKEY_LOCAL_MACHINE\\Software\\Westwood\\Renegade\\", "InstallPath", "Error getting data."));
	Install_Path = Install_Path->Remove(Install_Path->Length - 12, 12);
	Install_Path += "\Data";



David Anderson
Founder, Software Consultant
DCOM Productions
Microsoft Partner (MSP)

[Updated on: Sat, 11 November 2006 18:46]

Report message to a moderator

Re: how to locate renegade folder programmatically [message #230535 is a reply to message #230011] Tue, 14 November 2006 19:19 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
johnwill is using C? so that wont work. good reply though.
Re: how to locate renegade folder programmatically [message #230579 is a reply to message #230535] Wed, 15 November 2006 04:36 Go to previous messageGo to next message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
That code looks like AIDS, Dave Anderson.

Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Re: how to locate renegade folder programmatically [message #230582 is a reply to message #230579] Wed, 15 November 2006 05:25 Go to previous messageGo to next message
EvilWhiteDragon is currently offline  EvilWhiteDragon
Messages: 3751
Registered: October 2005
Location: The Netherlands
Karma: 0
General (3 Stars)

Silent Kane wrote on Wed, 15 November 2006 12:36

That code looks like AIDS, Dave Anderson.

Maybe, instead of just flaming his code you could tell him actually WHAT he should improve.


http://www.blackintel.org/usr/evilwhitedragon/pointfix.gif
BlackIntel admin/founder/PR dude (not a coder)
Please visit http://www.blackintel.org/

V, V for Vendetta

People should not be afraid of their governments.
Governments should be afraid of their people.
Re: how to locate renegade folder programmatically [message #230603 is a reply to message #230011] Wed, 15 November 2006 08:45 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Well for a start the += operator is a numeric function, not a concatenation operator... you should use the strcat() function for that.

http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Wed, 15 November 2006 08:47]

Report message to a moderator

Re: how to locate renegade folder programmatically [message #230604 is a reply to message #230011] Wed, 15 November 2006 09:14 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Actually Danpaul88, it is possible to use operator overloading to make the += operator do whatever you want on your own data types.

Whether microsoft has an appropriate operator+= function in whatever .NET language that code is in I dont know.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: how to locate renegade folder programmatically [message #230779 is a reply to message #230011] Thu, 16 November 2006 16:45 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
That is C++ with Managed Extensions (C++ .Net)
Re: how to locate renegade folder programmatically [message #230786 is a reply to message #230011] Thu, 16 November 2006 18:12 Go to previous message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
.NET lol, totally figures.

Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Previous Topic: Maps for the public..
Next Topic: Projector Settings
Goto Forum:
  


Current Time: Thu Nov 14 11:09:36 MST 2024

Total time taken to generate the page: 0.01332 seconds