diff --git a/bin/PakTool-readme.txt b/bin/PakTool-readme.txt deleted file mode 100644 index df6f3714..00000000 --- a/bin/PakTool-readme.txt +++ /dev/null @@ -1,167 +0,0 @@ -PakTool v1.02 - -PakTool is a command line tool developed by Parax made to handle Retro Studios .pak files. It can extract and repack files from any Retro game, as well as dump a list of files. It will also automatically decompress files and can even handle compression embedded within file formats! - -Check out the Retro Modding Wiki for information on the structure of Retro's pak formats: -http://www.metroid2002.com/retromodding/wiki/PAK_(File_Format) - -================= -Table of Contents -================= - -1. Changelog -2. Games -3. Usage -3.1. Extract -3.2. Repack -3.3. List Dump -4. Note on Tropical Freeze -5. Future updates - -============ -1. Changelog -============ - -v1.02 1/24/16 -- Fixed incorrect compression type for MP2 demo paks. - -v1.01 5/30/15 -- Fixed incorrect DKCR pak names. -- Added pak list for Trilogy. - -v1.0 2/19/15 -- Duplicate files are now ignored in unpack mode, significantly improving performance. -- File formats with embedded compression can now be decompressed in Extract Mode and recompressed in Repack Mode, allowing for the decompression of MREA files as well as Tropical Freeze models, textures, and shaders at unpack time. -- You can now place PakTool in a game's root directory and specify that game's title in Extract and List Dump modes to automatically unpack every one of that game's paks. (thanks DJGrenola) -- Repacking is now supported for Metroid Prime 3 and Donkey Kong Country Returns. -- Repacking now requires you to enter the game you're repacking for. This sets both the output pak format and the compression used, and replaces the old compression type parameter. -- A new "auto" mode has been added for Repack Mode; now you can just specify the pak name and PakTool will automatically set the files folder, the output pak name, and the list file. This only works if all those things use the default names, though! -- Tropical Freeze files with pak metadata now have it appended to the end of the file. - -v0.86 11/11/14 -- Donkey Kong Country: Tropical Freeze support added. No auto-decompression for now. - -v0.85 9/09/14 -- Fixed a bug with Metroid Prime 3 decompression where uncompressed data clusters weren't being copied to the output buffer correctly. This primarily affected textures, preventing the headers from being dumped correctly. -- List files are now required in repack mode; paks created with a list of every file in the provided folder are not only inoptimal, but they wouldn't have even worked ingame at all, so it didn't make sense to keep the functionality. -- Dump mode will now use the name of the input pak as the name of the file list if no name is explicitly provided. -- Donkey Kong Country Returns support added. - -v0.8 7/25/14 -- Added support for LZO compression for Metroid Prime 2. -- Added support for Metroid Prime 3 paks. Extraction, decompression, and file list dumping are all fully functional; however, there's no support for repacking yet. -- Compression now defaults to being off. -- Fixed crashing issue that occurred occasionally in repack mode. - -v0.6 7/21/14 -- File names are now dumped into the file list text files and can be reused to repack. -- A single MLVL is no longer required to repack. - -v0.5 6/21/14 -- Initial release - -======== -2. Games -======== - -Some modes can take a parameter specifying a certain game. Extract Mode and List Dump Mode can use this parameter to automatically dump every pak belonging to the specified game. Repack Mode needs this to choose the correct output pak format and compression algorithm. The following arguments, and some variations on them, are accepted: - -MP1 - Metroid Prime -MP2 - Metroid Prime 2: Echoes -MP3 - Metroid Prime 3: Corruption -DKCR - Donkey Kong Country Returns -DKCTF - Donkey Kong Country: Tropical Freeze -MP1Demo - Metroid Prime Kiosk Demo -MP2Demo - Metroid Prime 2 Demo Disc -MP3Proto - Metroid Prime 3 E3 Prototype -Trilogy - Metroid Prime: Trilogy - -======== -3. Usage -======== - -Usage: PakTool [mode] [options] - -The tool has three main functions. - ------------- -3.1. Extract ------------- - -PakTool will read an input pak and extract all files contained within it to a folder. Any compressed files will be automatically decompressed. This can either be used with a single pak (in which case the -x can be omitted, and unpack mode will be assumed), or a game can be specified with the Extract Game mode, -xg, which will automatically unpack every pak belonging to that game. For Extract Game to work, PakTool should be placed in the game's root directory. - -Usage: PakTool -x [input pak] - Alt: PakTool -xg [game] - -Optional: -o [output directory] -e - - -o [output directory]: Specify the output directory. By default, PakTool will create a new directory in the same directory as the input pak called "[name]-pak". With the -o option, you can specify a different output directory. If this option is used with a single pak, then the files will be extracted directly to the chosen output directory. Otherwise, a separate subdirectory will be created for each pak; the game's original directory structure will be preserved within the specified output directory. - - -e: Some files contain compressed data as part of their actual format, rather than being part of the pak format. If -e is specifed, PakTool will decompress any files that contain embedded compression. This means MREA files in Metroid Prime 2/Metroid Prime 3/DKCR, and CMDL/SMDL/WMDL/TXTR/MTRL files in Tropical Freeze. - ------------ -3.2. Repack ------------ - -PakTool will repack the files in a directory into a new custom pak that can be loaded ingame. The "game" parameter will set both the output pak format, as well as the type of compression used in the pak. Files are repacked in the order specified by the list file. You can use List Dump Mode to generate a list file first, modify it if necessary, then use it to repack. - -You can also use the Repack Auto mode, using -ra, to automatically set the input folder, the output pak, and the list file all at the same time. For example, if you run "PakTool -ra MP1 Metroid1", then PakTool will look for a folder called "Metroid1-pak/", a list file named "Metroid1-pak.txt", and will save to "Metroid1.pak". This will only work properly if everything is extracted with the default names. - -Usage: PakTool -r [GAME] [INPUT FOLDER] [OUTPUT.pak] [LIST.txt] - Alt: PakTool -ra [GAME] [FOLDER/PAK/LIST NAME] - -Optional: -e / -n - - -e: This is the reverse of the -e setting from Extract Mode; it will recompress files with embedded compression as part of their format, if they were previously decompressed. Since Tropical Freeze isn't supported in repack mode, this only affects MREA files. - - -n: Disable compression entirely. Your paks will be much larger with this flag set, but it may be more convenient if you want to hex edit the pak directly. Paks without any compressed files are still compatible with the game. - -Keep in mind that -e and -n can't be used simultaneously. - --------------- -3.3. List Dump --------------- - -PakTool will simply dump a list of files and filenames contained within the pak. This list can then be reused in Repack Mode to create new paks. This can either be used with a single pak, or a game can be specified with the Dump Game mode, -dg, which will automatically dump a list for every pak belonging to that game. For Dump Game to work, PakTool should be placed in the game's root directory. - -Usage: PakTool -d [input pak] - Alt: PakTool -dg [game] - -Optional: -o [output] - - -o [output directory]: Specify the output directory. By default, PakTool will create a text file in the same directory as the input pak. With the -o option, you can specify a different output directory. If this parameter is specified with Dump Game mode, then the game's original directory structure will be preserved within the specified output directory. - -========================== -4. Note on Tropical Freeze -========================== - -Tropical Freeze's pak format allows the pak to hold extra data for certain files in a section labeled "META". The main area where this comes into play is compression. Compression in Tropical Freeze is handled much differently than with the previous pak formats. A few formats are compressed: - -- Models (CMDL, SMDL, WMDL), as well as textures (TXTR), have a "GPU " section which is compressed with a custom LZSS implementation. -- Shaders (MTRL) are compressed with zlib. - -However, the metadata required to decompress those files - the compressed and decompressed sizes, the number and sizes of compressed buffers, etc. - are located in the pak, in the META section, rather than the file itself. This means if the files are unpacked directly and left as-is, then they're completely useless, because they come without some extremely important metadata. - -To remedy this, any file that contains metadata will have an extra META section appended to the end of the file data. This extra META section uses the standard Tropical Freeze section header format, followed by a dump of that file's metadata. This extra data will not be added to the size value in that file's RFRM header, which makes it easy to locate and seek to. - -PakTool also has the ability to directly decompress these files at unpack time. For textures and shaders, this is simple; compressed data is simply replaced with the decompressed equivalent. The RFRM and section header sizes are both updated with the new sizes. The extra META section will not be appended to the end of the file in this case. - -However, on models, this introduces another problem: the GPU section contains multiple compressed buffers, and the pak metadata is the only way to distinguish between them! This means some modification of the format is necessary; otherwise the file data is still useless. - -Model GPU sections contain a number of vertex buffers and index buffers. When PakTool decompresses these, it will insert a u32 indicating the number of vertex buffers; following that, each vertex buffer will be written to the file, each preceded with a 32-bit size value (in bytes). Then the same process is repeated for index buffers. - -This process isn't completely ideal, but it does enable all the files to be fully decompressed and completely usable on their own, without any external metadata. Just keep in mind that any modifications to the format will not work ingame; the data needs to be recompressed and the extra data needs to be removed before the files can be properly repacked. - -If you'd like to work with the original files directly, simply don't specify the -e parameter, and these files will be extracted with their compression intact and their metadata appended to the end of the file, like with other formats. - -You can find information on how the Tropical Freeze LZSS implementation works on the Retro Modding Wiki. -http://www.metroid2002.com/retromodding/wiki/LZSS_Compression - -================= -5. Future updates -================= - -The following features are being considered for future releases: - -- Parsing files for dependencies. This would allow for repack mode file lists to be built automatically. Unfortunately, this is a fairly complicated process and requires a thorough understanding of every format used in each game. -- Repacking for Tropical Freeze. This is unlikely to happen until there's a public means of modding Wii U games. Handling embedded compression would also be difficult since it would require a custom LZSS compressor. \ No newline at end of file diff --git a/bin/PakTool.exe b/bin/PakTool.exe deleted file mode 100644 index 34594096..00000000 Binary files a/bin/PakTool.exe and /dev/null differ diff --git a/src/.qmake.conf b/src/.qmake.conf index 39d68c4e..d47275dd 100644 --- a/src/.qmake.conf +++ b/src/.qmake.conf @@ -1,4 +1,4 @@ -# CONFIG += PUBLIC_RELEASE +CONFIG += PUBLIC_RELEASE win32: { QMAKE_CXXFLAGS += /WX \ # Treat warnings as errors @@ -10,7 +10,7 @@ EXTERNALS_DIR = $$PWD/../externals PWE_MAIN_INCLUDE = $$PWD DEFINES += 'APP_NAME=\"\\\"Prime World Editor\\\"\"' \ - 'APP_VERSION=\"\\\"1.1.1\\\"\"' + 'APP_VERSION=\"\\\"1.2.0\\\"\"' PUBLIC_RELEASE { DEFINES += 'PUBLIC_RELEASE=1' \ diff --git a/src/Common/AssertMacro.h b/src/Common/AssertMacro.h index fa6d9872..4ed65af9 100644 --- a/src/Common/AssertMacro.h +++ b/src/Common/AssertMacro.h @@ -27,9 +27,9 @@ #define CONDITIONAL_BREAK(Condition) {} #endif -#if !PUBLIC_RELEASE +#if 1 - // Development Build + // Asserts Enabled #define ASSERT_CHECK_BEGIN(Expression) \ { \ if (!(Expression)) \ @@ -55,7 +55,7 @@ #else - // Public Release Build + // Asserts Disabled #define BREAK_ONLY_ASSERT(Expression) {} #define LOG_ONLY_ASSERT(Expression) {} #define ASSERT(Expression) {} diff --git a/src/Core/GameProject/CGameExporter.cpp b/src/Core/GameProject/CGameExporter.cpp index 4c5c81b9..bf7a2a36 100644 --- a/src/Core/GameProject/CGameExporter.cpp +++ b/src/Core/GameProject/CGameExporter.cpp @@ -31,10 +31,6 @@ CGameExporter::CGameExporter(EDiscType DiscType, EGame Game, bool FrontEnd, EReg ASSERT(mRegion != eRegion_Unknown); } -#if PUBLIC_RELEASE -#error Fix export directory being cleared! -#endif - bool CGameExporter::Export(nod::DiscBase *pDisc, const TString& rkOutputDir, CAssetNameMap *pNameMap, CGameInfo *pGameInfo, IProgressNotifier *pProgress) { SCOPED_TIMER(ExportGame); @@ -47,14 +43,16 @@ bool CGameExporter::Export(nod::DiscBase *pDisc, const TString& rkOutputDir, CAs mDiscDir = "Disc/"; mWorldsDirName = "Worlds/"; + // Export directory must be empty! + if (FileUtil::Exists(mExportDir) && !FileUtil::IsEmpty(mExportDir)) + return false; + + FileUtil::MakeDirectory(mExportDir); + // Init progress mpProgress = pProgress; mpProgress->SetNumTasks(eES_NumSteps); - // Create project - FileUtil::MakeDirectory(mExportDir); - FileUtil::ClearDirectory(mExportDir); - // Extract disc if (!ExtractDiscData()) return false; diff --git a/src/Editor/CAboutDialog.ui b/src/Editor/CAboutDialog.ui index 0a3031be..0a1da497 100644 --- a/src/Editor/CAboutDialog.ui +++ b/src/Editor/CAboutDialog.ui @@ -6,18 +6,24 @@ 0 0 - 429 - 306 + 468 + 344 About + + 9 + + + 9 + - <html><head/><body><p><span style=" font-size:12pt; font-weight:600;">%APP_FULL_NAME%</span></p><p>%APP_NAME% is developed by <span style=" font-weight:600;">Aruki</span>.<br/>All the games it edits are developed by <span style=" font-weight:600;">Retro Studios</span> and published by <span style=" font-weight:600;">Nintendo</span>.</p><p>Special thanks to:</p><p><ul><li> The community at <span style=" font-weight:600;">Metroid2002</span> that contributed to reverse engineering the game and documenting its internals and file formats; in particular, <span style=" font-weight:600;">Antidote</span> and <span style=" font-weight:600;">jackoalan</span>, among others!</li><li> <span style=" font-weight:600;">Claris: </span>In addition to helping reverse engineer a few formats (in particular MLVL and MREA), also contributed greatly to putting together the script object templates and documenting object properties.</li><li> <span style=" font-weight:600;">Bearborg:</span> Lots of testing and feedback, plus the UI icons and some script object assets.</li><li> <span style=" font-weight:600;">Omega: </span>Script object assets.</li></ul>Check the <a href="http://www.metroid2002.com/retromodding/wiki/Retro_Modding_Wiki">Retro Modding Wiki</a> for file format documentation.</p><p>%APP_NAME% uses <span style=" font-weight:600;">Assimp</span> (Open Asset Import Library).<br/>Copyright © 2006-2015 assimp team<br/>All rights reserved.</p></body></html> + <html><head/><body><p><span style=" font-size:12pt; font-weight:600;">%APP_FULL_NAME%</span></p><p>%APP_NAME% is developed by <span style=" font-weight:600;">Aruki</span>.<br/>All the games it edits are developed by <span style=" font-weight:600;">Retro Studios</span> and published by <span style=" font-weight:600;">Nintendo</span>.</p><p>Special thanks to:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The community at <span style=" font-weight:600;">Metroid2002</span> that contributed to reverse engineering the game and documenting its internals and file formats; in particular, <span style=" font-weight:600;">Antidote</span> and <span style=" font-weight:600;">jackoalan</span>, among others!</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Claris: </span>In addition to helping reverse engineer a few formats (in particular MLVL and MREA), also contributed greatly to putting together the script object templates and documenting object properties.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Bearborg:</span> Lots of testing and feedback, plus the UI icons and some script object assets.</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Omega: </span>Script object assets.</li></ul><p>Check the <a href="http://www.metroid2002.com/retromodding/wiki/Retro_Modding_Wiki"><span style=" text-decoration: underline; color:#007af4;">Retro Modding Wiki</span></a> for file format documentation.</p><p>If you enjoy Prime World Editor and want to support its continued development, you can support me on <a href="https://www.patreon.com/arukibree"><span style=" text-decoration: underline; color:#007af4;">Patreon</span></a>!</p><p>%APP_NAME% uses <span style=" font-weight:600;">Assimp</span> (Open Asset Import Library).<br/>Copyright © 2006-2015 assimp team<br/>All rights reserved.</p></body></html> true diff --git a/src/Editor/CExportGameDialog.cpp b/src/Editor/CExportGameDialog.cpp index 6492f468..253dd568 100644 --- a/src/Editor/CExportGameDialog.cpp +++ b/src/Editor/CExportGameDialog.cpp @@ -367,14 +367,14 @@ void CExportGameDialog::Export() // Validate export dir if (ExportDir.isEmpty()) { - UICommon::ErrorMsg(this, "Please specify an output directory!"); + UICommon::ErrorMsg(this, "Please specify an empty output directory!"); return; } else if (!FileUtil::IsEmpty( TO_TSTRING(ExportDir) )) { - QMessageBox::Button Button = QMessageBox::warning(this, "Warning", "Warning: The specified directory is not empty. Export anyway?", QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::NoButton); - if (Button != QMessageBox::Ok) return; + UICommon::ErrorMsg(this, "The output directory is not empty!"); + return; } // Verify name map is valid diff --git a/src/Editor/WorldEditor/CWorldEditor.cpp b/src/Editor/WorldEditor/CWorldEditor.cpp index 8cb41f6a..20f8817c 100644 --- a/src/Editor/WorldEditor/CWorldEditor.cpp +++ b/src/Editor/WorldEditor/CWorldEditor.cpp @@ -7,6 +7,7 @@ #include "WModifyTab.h" #include "WInstancesTab.h" +#include "Editor/CAboutDialog.h" #include "Editor/CBasicViewport.h" #include "Editor/CExportGameDialog.h" #include "Editor/CNodeCopyMimeData.h" @@ -193,6 +194,8 @@ CWorldEditor::CWorldEditor(QWidget *parent) connect(ui->ActionIncrementGizmo, SIGNAL(triggered()), this, SLOT(IncrementGizmo())); connect(ui->ActionDecrementGizmo, SIGNAL(triggered()), this, SLOT(DecrementGizmo())); connect(ui->ActionCollisionRenderSettings, SIGNAL(triggered()), this, SLOT(EditCollisionRenderSettings())); + + connect(ui->ActionAbout, SIGNAL(triggered(bool)), this, SLOT(About())); } CWorldEditor::~CWorldEditor() @@ -491,6 +494,12 @@ void CWorldEditor:: CloseProject() SET_WINDOWTITLE_APPVARS( QString("%APP_FULL_NAME%") ); } +void CWorldEditor::About() +{ + CAboutDialog Dialog(this); + Dialog.exec(); +} + void CWorldEditor::ChangeEditMode(int Mode) { // This function is connected to the edit mode QButtonGroup. diff --git a/src/Editor/WorldEditor/CWorldEditor.h b/src/Editor/WorldEditor/CWorldEditor.h index 349f4ff1..c5297972 100644 --- a/src/Editor/WorldEditor/CWorldEditor.h +++ b/src/Editor/WorldEditor/CWorldEditor.h @@ -113,6 +113,8 @@ public slots: void ExportGame(); void CloseProject(); + void About(); + void ChangeEditMode(int Mode); void ChangeEditMode(EWorldEditorMode Mode); void SetRenderingMergedWorld(bool RenderMerged); diff --git a/src/Editor/WorldEditor/CWorldEditor.ui b/src/Editor/WorldEditor/CWorldEditor.ui index 2bf747e4..eb14aacd 100644 --- a/src/Editor/WorldEditor/CWorldEditor.ui +++ b/src/Editor/WorldEditor/CWorldEditor.ui @@ -340,10 +340,17 @@ + + + Help + + + + @@ -767,6 +774,11 @@ Project Settings + + + About + +