diff --git a/DecimaExplorer.rc b/DecimaExplorer.rc index fb6b7cb..80a56c5 100644 --- a/DecimaExplorer.rc +++ b/DecimaExplorer.rc @@ -52,7 +52,7 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON1 ICON "E:\\Art\\dex.ico" +IDI_ICON1 ICON "dex.ico" #endif // English (United Kingdom) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/DecimaExplorer.vcxproj b/DecimaExplorer.vcxproj index b04c72d..34ce467 100644 --- a/DecimaExplorer.vcxproj +++ b/DecimaExplorer.vcxproj @@ -275,7 +275,13 @@ true true - + + true + true + true + true + + true true true @@ -341,7 +347,13 @@ true true - + + true + true + true + true + + true true true diff --git a/DecimaExplorer.vcxproj.filters b/DecimaExplorer.vcxproj.filters index 87f968a..1f5a463 100644 --- a/DecimaExplorer.vcxproj.filters +++ b/DecimaExplorer.vcxproj.filters @@ -78,10 +78,13 @@ Source Files - + Source Files - + + Source Files + + Source Files @@ -161,15 +164,18 @@ Header Files - - Header Files - Header Files Header Files + + Header Files + + + Header Files + diff --git a/DecimaExplorer.vcxproj.user b/DecimaExplorer.vcxproj.user index 566c274..0a1c840 100644 --- a/DecimaExplorer.vcxproj.user +++ b/DecimaExplorer.vcxproj.user @@ -20,4 +20,8 @@ WindowsLocalDebugger + + -extract "G:\Games\PC\steamapps\common\Death Stranding\data" \ds\models\item\ludk_ludenskeyring\core\ludk_main_big\model\parts\mesh_main_lx + WindowsLocalDebugger + \ No newline at end of file diff --git a/cli/CLI.cpp b/cli/CLI.cpp index 31b939e..3a24559 100644 --- a/cli/CLI.cpp +++ b/cli/CLI.cpp @@ -88,7 +88,7 @@ void CLI::directoryExtract(char* arg) { if (found) break; } - found ? printf("Finished extracting file %s\n", output) : printf("Failed to find file %s\n", output); + found ? printf("Finished extracting file %s\n", output.c_str()) : printf("Failed to find file %s\n", output.c_str()); } void CLI::list() { diff --git a/decima/file/prefetch/CorePrefetch.h b/decima/file/prefetch/CorePrefetch.h index 9a0f35c..14214e8 100644 --- a/decima/file/prefetch/CorePrefetch.h +++ b/decima/file/prefetch/CorePrefetch.h @@ -42,4 +42,5 @@ class CorePrefetch: public DecimaCore { void extractFileTable(); void extractFileTableStreamed(DataBuffer data); + DecimaPrefetch* getPrefetch() { return &this->prefetch; } }; \ No newline at end of file diff --git a/dex.ico b/dex.ico new file mode 100644 index 0000000..71ff55c Binary files /dev/null and b/dex.ico differ diff --git a/gui/GUI.cpp b/gui/GUI.cpp index fc678df..46ebc10 100644 --- a/gui/GUI.cpp +++ b/gui/GUI.cpp @@ -2,7 +2,6 @@ GUI::GUI(HINSTANCE hInst) { mainWindow.create(hInst, this, NULL, 0xD3D3D3); - SetWindowText(mainWindow.getHandle(), "test"); browseButton.setCaller(this); browserView.setCaller(this); fileList.setCaller(this); @@ -42,8 +41,6 @@ void GUI::viewDrawing(HWND hwnd) {} void GUI::buttonDrawing(HWND hwnd) {} - - void GUI::resetData() { if (sbuf) { delete sbuf; @@ -59,7 +56,6 @@ void GUI::resetData() { fileList.setHandle(NULL); prefetchData.clear(); - currentPos = 0; } void GUI::directoryChosen(std::string directory) { @@ -83,21 +79,22 @@ void GUI::directoryChosen(std::string directory) { prefetchStream = new std::istream(sbuf); prefetchStream->seekg(0x1C, SEEK_CUR); - prefetchStream->read((char*)&prefetchSize, 4); - addFilesToRows(); } void GUI::saveDirectoryChosen(std::string directory) { int pos = -1; - + ProgressComponent pc; + pc.create(mainWindow.getHandle(), { 1280, 35 }, { 0, 647 }); + pc.setRange(fileList.getNumSelected()); + pc.setIncrement(); do { char file[MAX_PATH]; pos = ListView_GetNextItem(fileList.getHandle(), pos, LVNI_SELECTED); if (pos == -1) break; ListView_GetItemText(fileList.getHandle(), pos, 0, file, MAX_PATH); directoryExtract(file, directory); - + pc.increment(); } while (pos != -1); MessageBox(mainWindow.getHandle(), "Selected files extracted successfully", "Done", MB_OK); @@ -122,44 +119,41 @@ void GUI::directoryExtract(std::string filename, std::string output) { } -bool GUI::reachedEnd() { - return (prefetchSize - currentPos) <= 0; -} - void GUI::addFilesToRows() { - int left = (prefetchSize - currentPos); - int remainder = prefetchSize % 1000; - int size = left == remainder ? remainder : 1000; + SendMessage(fileList.getHandle(), WM_SETREDRAW, FALSE, 0); + + uint32_t prefetchSize; + prefetchStream->read((char*)&prefetchSize, 4); - for (int i = 0; i < size; i++) { + for (int i = 0; i < prefetchSize; i++) { uint32_t size, hash; prefetchStream->read((char*)&size, 4); prefetchStream->read((char*)&hash, 4); std::string str; str.resize(size); prefetchStream->read((char*)str.c_str(), size); - fileList.createItem(currentPos, str.c_str()); - //fileList.createSubItem(currentPos, 1, "TODO"); - currentPos++; + fileList.createItem(i, str.c_str()); } - if (reachedEnd()) { - delete prefetchStream; - prefetchStream = NULL; - delete sbuf; - sbuf = NULL; + uint32_t numSizes; + prefetchStream->read((char*)&numSizes, 4); + + for (int i = 0; i < numSizes; i++) { + uint32_t size; + prefetchStream->read((char*)&size, 4); + std::string fsize = std::to_string(byteToKiloByte(size)) + " KB"; + fileList.createSubItem(i, 1, fsize.c_str()); } + + SendMessage(fileList.getHandle(), WM_SETREDRAW, TRUE, 0); + delete prefetchStream; + prefetchStream = NULL; + delete sbuf; + sbuf = NULL; } -void GUI::listScrolled(HWND hwnd) { - SCROLLINFO si = { sizeof(si), SIF_ALL }; - GetScrollInfo(fileList.getHandle(), SB_VERT, &si); - bool hitBottom = (si.nPos + si.nPage) == (UINT)si.nMax + 1; - if (hitBottom) { - if (!reachedEnd()) addFilesToRows(); - } -} +void GUI::listScrolled(HWND hwnd) { } void GUI::buttonPressed(HWND hwnd) { FileComponent fc; diff --git a/gui/GUI.h b/gui/GUI.h index 9a8edd0..fb93973 100644 --- a/gui/GUI.h +++ b/gui/GUI.h @@ -1,9 +1,9 @@ #pragma once #include "draw/MainWindow.h" - #include "../decima/file/prefetch/CorePrefetch.h" #include "../decima/archive/mpk/ArchiveMoviePack.h" #include "../decima/archive/bin/initial/BinInitial.h" +#include "../utils/NumUtils.h" #pragma comment(linker,"\"/manifestdependency:type='win32' \ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ @@ -20,7 +20,7 @@ class GUI : public ButtonCaller, WindowCaller, ViewCaller, TextfieldCaller, List ButtonComponent extractButton; ViewComponent footerView; - const char* aboutText = "Created by Jayveer\n https://github.com/Jayveer/Decima-Explorer \n\nSpecial Thanks for work on decryption.\n Ekey https://github.com/Ekey \n Wunkolo https://github.com/wunkolo \n\nLibraries:\n Ooz By Powzix https://github.com/powzix/ooz \n Murmur3 by Peter Scott https://github.com/PeterScott/murmur3 \n MD5 by Aladdin Enterprises"; + const char* aboutText = "Decima Explorer is a free and open source program. If you paid for this program demand your money back from the seller.\n\n Created by Jayveer\n https://github.com/Jayveer/Decima-Explorer \n\nSpecial Thanks for work on decryption.\n Ekey https://github.com/Ekey \n Wunkolo https://github.com/wunkolo \n\nLibraries:\n Ooz By Powzix https://github.com/powzix/ooz \n Murmur3 by Peter Scott https://github.com/PeterScott/murmur3 \n MD5 by Aladdin Enterprises"; void initExtractButton(HWND parent); void initBrowseButton(HWND parent); @@ -50,9 +50,6 @@ class GUI : public ButtonCaller, WindowCaller, ViewCaller, TextfieldCaller, List DataBuffer prefetchData; membuf *sbuf; std::istream *prefetchStream; - std::istream* prefetchSizeStream; - int prefetchSize; - int currentPos = 0; public: GUI(HINSTANCE hInst); ~GUI(); diff --git a/gui/draw/MainWindow.cpp b/gui/draw/MainWindow.cpp index 3cc34e6..20d1efc 100644 --- a/gui/draw/MainWindow.cpp +++ b/gui/draw/MainWindow.cpp @@ -92,6 +92,11 @@ LRESULT MainWindow::ProcedureWrapper(HWND inHwnd, UINT message, WPARAM wParam, L if (listview && nm->code == LVN_ENDSCROLL) listview->scrolled(); } }break; + case WM_KEYDOWN: { + if (wParam == 'A' && GetKeyState(VK_CONTROL) < 0) { + int dummy = 0; + } + } break; case WM_CLOSE: { DestroyWindow(inHwnd); } break; diff --git a/gui/draw/MainWindow.h b/gui/draw/MainWindow.h index dd03f55..a86f30a 100644 --- a/gui/draw/MainWindow.h +++ b/gui/draw/MainWindow.h @@ -1,12 +1,12 @@ #pragma once #include "component/textfield/TextFieldComponent.h" +#include "component/progress/ProgressComponent.h" #include "component/window/WindowComponent.h" #include "component/button/ButtonComponent.h" #include "component/image/ImageComponent.h" #include "component/view/ViewComponent.h" #include "component/file/FileComponent.h" #include "component/list/ListComponent.h" -#include "component/MenuComponent/MenuComponent.h" class MainWindow : public ProcedureCaller { private: diff --git a/gui/draw/component/MenuComponent/MenuComponent.cpp b/gui/draw/component/menu/MenuComponent.cpp similarity index 100% rename from gui/draw/component/MenuComponent/MenuComponent.cpp rename to gui/draw/component/menu/MenuComponent.cpp diff --git a/gui/draw/component/MenuComponent/MenuComponent.h b/gui/draw/component/menu/MenuComponent.h similarity index 100% rename from gui/draw/component/MenuComponent/MenuComponent.h rename to gui/draw/component/menu/MenuComponent.h diff --git a/gui/draw/component/progress/ProgressComponent.cpp b/gui/draw/component/progress/ProgressComponent.cpp new file mode 100644 index 0000000..720f446 --- /dev/null +++ b/gui/draw/component/progress/ProgressComponent.cpp @@ -0,0 +1,27 @@ +#include "ProgressComponent.h" + +ProgressComponent::ProgressComponent() { + +} + +ProgressComponent::~ProgressComponent() { + +} + +void ProgressComponent::create(HWND parent, Dimensions dimensions, Origin origin) { + DWORD style = WS_CHILD | WS_VISIBLE; + HWND hwnd = CreateWindow(PROGRESS_CLASS, "Loading file", style, origin.x, origin.y, dimensions.width, dimensions.height, parent, NULL, NULL, this); + setHandle(hwnd); +} + +void ProgressComponent::setRange(int maxRange) { + SendMessage(getHandle(), PBM_SETRANGE, 0, MAKELPARAM(0, maxRange)); +} + +void ProgressComponent::setIncrement() { + SendMessage(getHandle(), PBM_SETSTEP, (WPARAM)1, 0); +} + +void ProgressComponent::increment() { + SendMessage(getHandle(), PBM_STEPIT, 0, 0); +} diff --git a/gui/draw/component/progress/ProgressComponent.h b/gui/draw/component/progress/ProgressComponent.h new file mode 100644 index 0000000..20dc3b5 --- /dev/null +++ b/gui/draw/component/progress/ProgressComponent.h @@ -0,0 +1,14 @@ +#pragma once +#include "../Component.h" + +class ProgressComponent : Component { +public: + ProgressComponent(); + ~ProgressComponent(); + + void create(HWND parent, Dimensions dimensions, Origin origin); + void setRange(int maxRange); + void setIncrement(); + void increment(); + +}; \ No newline at end of file diff --git a/utils/Numutils.h b/utils/Numutils.h index 6f70f09..9e85288 100644 --- a/utils/Numutils.h +++ b/utils/Numutils.h @@ -1 +1,8 @@ #pragma once +#include +#include + +inline +int byteToKiloByte(int bytes) { + return bytes % 1024 ? (bytes / 1024) + 1 : bytes / 1024; +} \ No newline at end of file