Commit graph

53 commits

Author SHA1 Message Date
6cd6d45a71 libeuropa/io: Remove usage of *_map from PakReader
I'm not sure how I want to handle this yet, but for now, using a vector<pair<...>> is the easiest way currently to retain insertion order. Using a hash table IS probably a better idea, and I'm looking to maybe importing Boost multimaps to allow that, but for now, /shrug.
2025-01-15 20:07:47 -05:00
d9e30b8466 tools/eupak: Add a new non-verbose file listing to eupak info
Looks cool! Might remove the old one tbh.
2025-01-15 20:06:19 -05:00
ee89213a57 tools/eupak: Add check for if user provides a valid directory path
Oops.
2025-01-15 19:37:01 -05:00
d9dae6e6ac tools/eupak: Refactor ExtractTask to ITask
Completing this refactor.. Nice.
2025-01-15 19:34:31 -05:00
addf2071f4 tools/eupak: Refactor out Arguments from public view
They aren't needed for public view anymore.
2025-01-15 19:26:43 -05:00
e30913b018 tools/eupak: Refactor InfoTask to ITask pattern 2025-01-15 19:25:31 -05:00
7fee38be55 tools/eupak: Heavily refactor tasks.
This starts the beginning of probably one of the bigger refactor jobs, and one I've been hinting at and FIXME jabbing for a while now.

Basically, tasks now are a lot closer coupled to their arguments. This is a good thing since it means that changing or adding features only requires modifying the task, not needlessly modifying main over and over.

CreateTask is the only one that works currently for this commit and has been converted to the new ITask model.
2025-01-15 18:43:33 -05:00
447b134118 eupak: Make it a error to specify --sector-aligned outside of -V jedistarfighter
Should make it less error prone. I mean, I could probably have just made this a warning but it's better to make it clear it doesn't do anything/work.
2025-01-12 16:42:27 -05:00
05d4b706b4 libeuropa/io: Refactor PakWriter for pakv5 sector alignment support
This really could be classed a "fix", since adding support for it when reading broke writing. Now we do the right thing.

This makes sector-alignment a no-op when writing other archive versions. I might make it an error to specify -s with a non-JSF package version.
2025-01-12 16:37:44 -05:00
dc95b3ba9c libeuropa/structs: Fix Pak V3 TOC entry
As it turns out, the unix time is NOT junk in them. The short I identified is *before* it. Oops

The hexpat is also fixed up so it can analyze v3, v4, and v5 successfully.
2025-01-12 16:22:02 -05:00
1aebeffb3f libeuropa/io: Refactor some stuff
Meh.
2025-01-12 16:15:06 -05:00
9757b79e7e libeuropa/io: Get JSF STREAMS extraction working
As it turns out the thing I marked as "header size" is more likely just a discarded revision.

Anyways, to detail this: pak version 5 adds fields to the header for sector alignment. The reader now handles this and reads the sectoralignment TOC entry, which now allows STREAMS (and any other packages with this set?) to extract properly.

Woohoo.
2025-01-12 16:05:58 -05:00
a9ed7adb64 tools/eupak: Clean up some comments 2025-01-08 14:00:03 -05:00
64d15eff30 tools/eupak: Add -s/--sector-aligned option to eupak create
This allows to build sector aligned packages.. now that they, like, actually work.
2025-01-08 13:54:08 -05:00
974f173a7b libeuropa/io: Move some stuff in PakWriter.cpp to util/ headers
I wanted to do this anyways, so hey.
2025-01-08 13:36:19 -05:00
6fa9f7122b libeuropa/io: Fix PakWriter AlignBy() so it actually works
Oops. This makes sector alignment actually work for writing sector aligned paks now.
2025-01-08 13:25:49 -05:00
341f914e1d *: Add some hardening compile options.
Also fix some warnings and potential issues that building the entire EuropaTools codebase under those flags showed.

Later on once we drop the libpixel and stbiw dependencies, we can probably turn on -Werror for release builds.
2025-01-08 13:08:49 -05:00
bdc55f5483 *: Relicense to MIT
A ironically more-free license. Also no more foot fungus (or other various shitty things a certain RMS has done.)
2025-01-07 18:02:27 -05:00
f7b80326ff eupak: Fix creation timestamps
Also, PakWriter will now write a proper creation time. For unit testing/etc, I may
instead have it just take in a system_clock::time_point, but idk.
2025-01-07 17:56:35 -05:00
3786b760fe *: Various cleanup 2025-01-07 15:13:10 -05:00
307e92768c *: Correct all license headers 2025-01-07 14:17:50 -05:00
68dc4c0c11 hexpat: Document TOC size field in PAK hexpat
never did so I guess
2025-01-07 14:13:22 -05:00
175a5ff40a libeuropa/io: clean up PakWriter a bit more
also use visitor pattern instead of get_if chain
2025-01-07 14:10:03 -05:00
7cbff3d81f libeuropa/io: Use WritePString() in PakWriter 2025-01-07 13:59:02 -05:00
3fa2f023f7 libeuropa/io: Fix some stuff
also rewrite ReadPString() to actually use the length
2025-01-07 13:47:20 -05:00
b36a7c1ecd libeuropa/io: Fix embarassing mistake
Oops. This caused the -V argument to not even matter in `eupak create`, since it would just create ver3 archives no matter what you set. My bad.
2025-01-06 20:13:57 -05:00
53428ef199 libeuropa/io: Fix bug
forgot how constness works oops
2025-01-06 19:18:44 -05:00
5060bc4fb6 libeuropa/io: Rewrite PakFile to use a sumtype to store pak file data
This allows pak writer file data to cleanly come from one of two possible sources:

- A file on the filesystem (in which the PakWriter will open the file, tee it into the package file efficently, and then close it)
- A data buffer (which functions like before)

PakReader however will always output data buffers.
2025-01-06 17:12:58 -05:00
788fcd9677 hexpat: Add hexpat and MRP Python script for .msh files
Documentation is always nice.
2025-01-05 20:36:48 -05:00
73e16a8b72 readme: Update to point to cngit
It's the canonical place I want the repo to be.
2025-01-05 20:20:11 -05:00
b74ca42d72 libeuropa/io: Fix PakWriter/PakFile zero-size-bug
This bug was introduced during refactoring (to allow pmdl export support); it causes the writer to not write any file data.

Additionally the writer now sorts by creation time. I'm not sure if greater or less are the correct order.
2025-01-05 20:15:54 -05:00
2c0237933c Initial support for Ver3/.PMDL archives
................. fuck

This really needs to be cleaned up before I'm willing to call it "good" but ultimately the API changes here needed to be done anyhow
2023-08-01 18:18:40 -04:00
5272175a21 tools: Add jsfscramble (Jedi Starfighter cheat scrambler tool) 2023-05-08 18:58:27 -04:00
e698d1da3b *: Remove map flattening copy
Memory size decrease and possible huge performance improvement! Yay!
2022-09-22 19:15:06 -05:00
cf9d84cb24 *: Implement detailed progress reporting when creating
Ditto!
2022-09-22 19:07:56 -05:00
e82d693dfc eupak: Implement creation command
Ditto. Also has a cute little progress indicator (more detailed
progress will probably have to be done later..)

Removes pakcreate, as it's now replaced by eupak for good.
2022-09-22 12:32:28 -05:00
a27ab63c96 eupak: Add bodge for MinGW compilation
also fix paktest, oops.
2022-09-22 05:58:53 -05:00
a95d104e7f *: Introduce "eupak" utility
I have been preparing for this for a while. Instead of having a bunch
of strewn out utilities, let's just have one solid multitool
which is nice to use.

This commit also removes europa_pack_extractor, as it's now unnesscary
and replaced with a better utility, that does more.

Creation wasn't implemented yet, but I really need to sleep. It can be done later, and pakcreate can be used as a temporary stopgap.
2022-09-22 05:43:35 -05:00
87b02d8659 cmake: Use FetchContent for dependencies, add argparse dep 2022-09-21 03:18:13 -05:00
4b7a0ea612 cmake: change library name to just "europa" 2022-09-21 03:00:17 -05:00
f79c92c742 chore(*): .h -> .hpp
Preferences change a bit.
2022-09-21 02:59:16 -05:00
8d607675d0 chore(cmake): cmake license header, update a bit
Instead of using set_target_properties on all tool binaries,
instead we can use target_compile_features([xxx] PUBLIC cxx_std_20).

This properly alienates projects which depend on libeuropa, allowing the src/tools CMakeLists to be trimmed down quite a bit.

Also fixes a build break I accidentally introduced.
2022-09-21 02:55:57 -05:00
6228bf77e8 chore(*): fix spdx headers for right license
Oops!
2022-09-21 02:49:57 -05:00
cab58d0d34 Mishmash commit
While working with scrc I made the pak files output sorted by size. This doesn't
seem to have helped with performance but I guess it might be nice to maybe
do the conversion in hand.. or just make the writer take a vector of pair to use.
2022-09-21 02:31:33 -05:00
4452b87780 Fix io::PakWriter, add pakcreate
Also improves paktest.

Pakcreate is a new utility for creating completely new archives from a directory.

Usage:
pakcreate [input path] [output .PAK/pmdl filename] [--jedi]

Options:
--jedi : Make Jedi Starfighter archive
2022-09-15 04:11:53 -05:00
81dad9965c bump libpixel (msvc builds should work now, i hope.) 2022-09-07 04:17:26 -05:00
29404402aa dammit 2022-09-07 04:14:47 -05:00
4d72803725 oops, fix paktest 2022-09-07 04:09:48 -05:00
fae513fdfe Try to optimize things a bit
PakReader won't read everything in ReadData(), it now only reads the header and TOC.

Files now need to be read in separately.

Adds progress bar to europa_pack_extractor.

Moved code around.
2022-09-07 04:07:40 -05:00
5d03f49e21 Add possibly not WIP package writer
Don't have a tool for building "fresh" packages yet, but the "paktest" tests regurgitating a pak into a new pak file.

Usage is:

./paktest [pak file]

it will write to "new.pak" always, which meh. It's just a test utility.
2022-09-05 19:59:46 -05:00