Page 1 of 2

Help with *.arc files

Posted: Sun Feb 17, 2008 6:47 pm
by robotnick
The contents of this post was deleted because of possible forum rules violation.

Re: Help with *.arc files

Posted: Sun Feb 17, 2008 7:04 pm
by Savage
Plz next time try to upload in another file hosting
Thanks
Let's to see this file

Re: Help with *.arc files

Posted: Mon Feb 18, 2008 2:27 am
by Rheini
Well the data is completely encrypted. I managed to decrypt everything. It is a simple xor algorithm. The directory can be decrypted with the global xorValue (data is treated as dwords, see the first file as an example, the last 3 bytes aren't encrypted there)
Each file is encrypted using its own xorValue.

However, the best way to deal with arc archives is to write a program for the system.dll. All functions to modify ARC archives are available in there.

my 010 editor binary template:

Code: Select all

char magic[4];
uint version;
uint numFiles;
uint dirOffset;

FSeek(FileSize()-4);
uint xorValue<format=hex>;

FSeek(dirOffset);
struct Entry
{
	char filename[128]; // 0 terminated
	char pathname[256]; // 0 terminated
	uint offset;
	uint size;
	uint xorValue; // the value used
} directory[numFiles];
after applying it, you need to select the directory and binary xor it with the global xorValue to get the correct values.

I attached the first 3 decrypted files as an example.

Re: Help with *.arc files

Posted: Mon Feb 18, 2008 2:54 pm
by Rheini
Rheini wrote:However, the best way to deal with arc archives is to write a program for the system.dll. All functions to modify ARC archives are available in there.
Well, it's harder than I thought. Got to figure out all the class hierarchy relations.

Code: Select all

namespace lexis
{
	namespace system
	{
		class TE_DLL_API IArchive
		{
		public:
			struct FileEntry
			{
				uint uk1;
				uint uk2;
				uint uk3;
				uint uk4;
				uint uk5;
				uint uk6;
				uint uk7;
				uint uk8;
				uint uk9;
				uint uk10;
				uint uk11;
				uint uk12;
				uint uk13;
				uint uk14;
				uint uk15;
				uint offsetInFIle; // Offset of the file in the ARC0 ?!
				uint filesize;
			}; // ????
			struct FindData {}; // ???
			IArchive();
			IArchive(const IArchive& rhs);
			~IArchive();
			string getName();
		};

		class TE_DLL_API ArchiveARC
		{
		public:
			ArchiveARC();
			ArchiveARC(const ArchiveARC& rhs);
			~ArchiveARC();
			int addFile(string name, const char* name2, uint id); // bool
			uint addFolder(string name);
			uint clear();
			uint close();
			uint findFile(string name, IArchive::FileEntry fileEntry);
			void* findFileBegin(IArchive::FindData findData);
			void* findFileNext(IArchive::FindData findData);
			virtual uint load(const string& name);
			uint open(uint id);
			int readFile(const IArchive::FileEntry& fileEntry, void* destBuffer);
			uint removeFile(const IArchive::FileEntry& fileEntry);
			uint save(string filename);

		};

		class TE_DLL_API ArchiveFilter
		{
		public:
			ArchiveFilter();
			ArchiveFilter(const ArchiveFilter& rhs);
			~ArchiveFilter();
			IArchive* addArchive(string name);
			int findFile(string name, IArchive::FileEntry& fileEntry); // bool
			uint forAllArchives(int (*callbackFunc) (IArchive*,void*), void*);
			IArchive* getArchive(string name);
			string getExtension();
			string getName();
			void registerArchives(string name);
			void setExtension(string ext);
			void setName(string name);
		};
	}
}
Anyone got experience with C++-DLLs (exported classes and stuff)?

Re: Help with *.arc files

Posted: Tue Feb 19, 2008 11:35 pm
by Mr.Mouse
Hmm, I've only "google" experience from the past, when I created a dlll in C++ that I needed as a wrapper. But that would not help you. .. . :(

Re: Help with *.arc files

Posted: Tue Feb 19, 2008 11:59 pm
by Rheini
The problem is the exe doesn't use many functions, mainly just createInstance or getInstance functions.
This seems like compiler generated stuff.
So I can't really see how the ARC management code is called. :(

Re: Help with *.arc files

Posted: Wed Feb 20, 2008 10:01 pm
by Rick
Rheini wrote:The problem is the exe doesn't use many functions, mainly just createInstance or getInstance functions.
This seems like compiler generated stuff.
So I can't really see how the ARC management code is called. :(
Interfaces and vtable calls. I'm working on this game now myself.

Re: Help with *.arc files

Posted: Wed Feb 20, 2008 11:53 pm
by Rick
I have a functional extractor now, I will post it later if I confirm it to be working correctly.

Re: Help with *.arc files

Posted: Thu Feb 21, 2008 7:09 am
by Rheini
Rick wrote:
Rheini wrote:The problem is the exe doesn't use many functions, mainly just createInstance or getInstance functions.
This seems like compiler generated stuff.
So I can't really see how the ARC management code is called. :(
Interfaces and vtable calls. I'm working on this game now myself.
So you have knowledge about that stuff? Would you tell me where you got that from? Are there any tutorials out there (or something like that)?

Re: Help with *.arc files

Posted: Thu Feb 21, 2008 9:39 pm
by Rick
Rheini wrote:So you have knowledge about that stuff? Would you tell me where you got that from? Are there any tutorials out there (or something like that)?
Yes I do, it's mostly from experimenting myself rather than tutorials, though I believe there is some information on vtables and such.

Attached is ExtractArc.zip (with a single file, ExtractArc.exe), command-line application, specify archive file as first argument, will extract contents to current directory. 'system.dll' from the game directory is required to be present in the directory of ExtractArc.exe. I suggest placing ExtractArc in the game directory then changing to the resources directory and doing ..\ExtractArc.exe archiveName.arc.

You can override any file in the archives by placing it in the same path it was extracted to in either the main game directory or resources, eg, scripts\start.lua in scripts.arc can be in .\scripts\start.lua or .\resources\scripts\start.lua (the game checks both paths for existence of this file before checking archives for it).

Re: Help with *.arc files

Posted: Thu Feb 21, 2008 10:36 pm
by robotnick
It's working great Rick!! Thanks to everybody! :) :)

Re: Help with *.arc files

Posted: Fri Feb 22, 2008 5:24 pm
by Rheini
There's another game from that developer, probably they use the same system for that one.
http://www.gamershell.com/download_22691.shtml

Re: Help with *.arc files

Posted: Sun Feb 24, 2008 1:49 pm
by Rick
Rheini wrote:There's another game from that developer, probably they use the same system for that one.
http://www.gamershell.com/download_22691.shtml
The Experiment and Experience 112 are the same game. The Experiment is the US title for Experience 112.

Re: Help with *.arc files

Posted: Mon Mar 10, 2008 9:56 pm
by qorilla
Hi!

Thanks for this extractor program!
My question is, would it be possible to somehow pack new archives? I mean repacking the archive, with some changes to some files in it.

Thank you very much!

Re: Help with *.arc files

Posted: Sat Mar 15, 2008 10:33 am
by Rick
qorilla wrote:Hi!

Thanks for this extractor program!
My question is, would it be possible to somehow pack new archives? I mean repacking the archive, with some changes to some files in it.

Thank you very much!
Probably, but what is the need when you can just use overriding the files as I mentioned earlier?