[FF7] command line tools for LGP archives - LGP/UnLGP (v.5)

  • Thread starter Thread starter Aali
  • Start date Start date
Status
Not open for further replies.
^ Don't worry about not getting it right, Celebrated One. They say "Failure is not the antonym of success; it is a component of great achivements."

By the way, the version numbering is a bit suggestive, as they are sub-zero. Tell us Aali, are you planning a major release? A major v1.0 or something?
 
lol. Well its still good to see active updates even if its just fixing things.
Also FleetCommand so you really need TortoiseHG for this project ? since its only 4 src files its just as fast to just download the RAW files in your internet explorer (or whatever you use for browsing the internet) then save them to the same folder and you wont have to install any extra programs.
 
^ Oh, I know that, Kranmer. It was implicit speech.

By the way, thank you too, Kranmer. Thank you for providing the forum with up-to-date executable LGP/UNLGP. I believe you too deserve being thanked.
 
well i would have liked to have created a GUI for this but there is just 1 very small problem. I dont know how.
 
If that is all your problem, ... Maybe I can tell you how... I don't develop a GUI version myself for the reason mentioned above but it is against no law to tell others how to do that.

But first and foremost, do you know any visual/RAD programming languages? Such as Delphi or C#?
 
Last edited:
not really, i have learned a little of most but i cant actually fully code in any language (i am more of an editor of existing code and compiler then a creator). i doubt i would be able to make one so i think i will just forget about it and just use the normal command line system for now but thanks for the offer anyway.
I just wish there was a way of making a generic GUI that could run any DOS cmd using somthing simple like a script or somthing along those lines so that it could be used with any DOS program.
 
Third time's a charm; pushed another update. This one should not create those semi-broken lgps and unlgp should no longer barf on the same semi-broken files.
Lol, I'll go ahead and test this one (in-game too) and post back with my results.  Thanks to both of you, Aali and Kranmer, for being so quick to update the command line  :-)

EDIT​
Hurrah! Everything in magic.lgp is working flawlessly with the .5 release :D

Also, I thought this little document would be handy for some of the less computer savvy http://www.mediafire.com/download.php?kwlvlyzjz2y
 
Last edited:
I would do a GUI if I know how to [2]

I can only code in vb tho...  :-(
 
I create new in C put magic.lgp and unlgp.exe in this folder, drag and drop magic.lgp into unlgp.exe and i see this, not have anything continue.  :oops:
untitled-2.png
 
Ultimate Dragon after a long time that screen should disappear and you should be left with the files. If they are not in the same folder there is a high chance it will have extracted to a either your root (for example the root of your C drive) or it will extract to C:\Documents and Settings\user (user will be whatever your username is) i aint 100% sure why this is but can be gotten around if you use a command after you extract if you dont drag and drop.
 
Thank you kranmer. I create .bat file like this and it work  :-)
unlgp.bat
Code: [Select]
Code:
unlgp magic.lgp
lgp.bat
Code: [Select]
Code:
lgp magiclgp magic.lgp
 
I would do a GUI if I know how to [2]

I can only code in vb tho...  :-(
Got your message too. Do you know anything about C, C++, or C#? At least, can your read and understand LGP Tools code?
 
Got your message too. Do you know anything about C, C++, or C#? At least, can your read and understand LGP Tools code?
I don't know C neither C++.
Some C# i may understand as it's quite like vb.net.
If i can understand lgp tools code? well, some parts yes... some dont. I'll try to figure now..
If u r willing to help me add @ msn.  :-)
 
I don't know C neither C++.
Some C# i may understand as it's quite like vb.net.
If i can understand lgp tools code? well, some parts yes... some dont. I'll try to figure now..
Then your job is much tougher than that of someone like Kramner but still possible. If you are persistent, then let's get started.

First and foremost, you must start learning a bit of C/C++ so that you at least have a grasp of struct data types and of reading and writing from a structured file the way LGP Tools does. (Otherwise, the only way I can help you will be to embed me into your brain.) Why don't you start with Microsoft Express training material on C++? There are quite a few guides there.

After that, I'll lay out the details of encapsulating the file I/O into appropriate classes (which is the tough part of the work) and help you binding them into a GUI (which should be easy, given the fact you already know VB.NET.)
If u r willing to help me add @ msn.  :-)
I'm afraid that's not an option. I cannot be disrupted during the work hours. We should keep the discussion in this thread (which is relevant) as much as possible. I'll check it everyday after returning from work.
 
@ Fleet Command :

Understanding of structured data types also manipulating structures data : DONE!


Also... I've just realized I can use that for the issue I'm having in my prog in this thread.  :-o
 
Last edited:
OUTSTANDING! I didn't expect you to do it in such a short time.

So, now you have complete understanding of this part of code, right?
Code: [Select]
Code:
struct toc_entry { char name[20]; unsigned int offset; unsigned char unknown1; unsigned short conflict; __attribute__((__packed__)); struct file_header { char name[20]; unsigned int size; } __attribute__((__packed__)); struct lookup_table_entry { unsigned short toc_offset; unsigned short num_files; } __attribute__((__packed__)); struct conflict_entry { char name[128]; unsigned short toc_index; } __attribute__((__packed__));
Especially, you do know what does __attribute__((__packed__)) actually do, right?

Good, now let's start with building classes. At first, I advise you to initially build an application that only extracts files from LGP, then expand it to one that also archives files into LGP. But a precaution: I know C# and Delphi very well but I don't remember anything about VB.NET anymore. But I'm going to assume VB.NET is only grammatically different from C#. (At least for our purpose.) If it isn't, let me know and we'll try to resolve any conflict.

(I don't know why my eyes hurts...)

Start by building a test program that opens LGP archive, counts the number of files in it and announces the count in a message box. Then, you'll expand it into a full-fledged LGP extractor. For now, download lgp.c, unlgp.c, lgp.h and MinGW. (You'll need some of MinGW source codes, such as stat.h.) Also, start a Visual Basic project (Windows Form) and put a Menu Bar on it with just a File menu and an Open command. Put an Open Dialog Box into the form and set its properties, so it can open "LGP Archive (*.LGP)" and "All files (*.*)".

Create a DeLGP class. (Are classes case-sensitive in VB.NET too? In C#, they are. In Delphi, they aren't.) Class constructor gets one parameter: the whole path to the LGP file. The constructor checks whether the file exists, whether NTFS permissions on it allows read-only access and opens the file as read-only. (Don't implement the opening of the file yet.)

Then, the main job: Build a LGPStream class as a Structured Storage class and add a File Stream plus the structs in LGP.h to it. You are not going to have the benefit of using packed structs, so prepare for extra job when reading and writing structs. There is a reason for that: The precious Unicode! You are going to read non-unicode strings from archive but write Unicode strings to disk, and vice versa. (Aali's LGP Tools read non-unicode and write non-unicode. You don't do this.)

Once you are done, let me see how you've done this critical part. Meanwhile, I'll be downloading a Visual Basic 2008 Express, just in case.
 
I'm quite sure I'm not doing it right at classes code, but whatever.. that's what I've got so far

LGP_VBNET_TEST
 
Last edited:
Man, you are better than me.

Just started to verify it. I'm not yet through, but I've spotted the first flaw: You defined whatever data that was defined as "char" and "unsigned char" in Aali's code as "char" in your own code, which is wrong. In C and C++ "char", "signed char" and "unsigned char" are only 8-bits long while in .NET, they are 16-bits long and store Unicode characters. Consider using "System.SByte" (or its VB.NET equivalent) instead of "char" and "System.Byte" (or its VB.NET equivalent) instead of "unsigned char".

I'm getting busy right now, but don't worry, if I ever died, you're better than me.

EDIT: Oh, forgot to mention: You'll be using either a bit of type-casting (Byte -> Char or vice versa) or unpacked data read/write of bytes in 16-bit aligned manner. I prefer type casting.
 
Last edited:
Status
Not open for further replies.
Back
Top