Compare commits
No commits in common. "main" and "feature/icon_factory" have entirely different histories.
main
...
feature/ic
37
.gitignore
vendored
37
.gitignore
vendored
@ -1,25 +1,12 @@
|
||||
/build/
|
||||
/data/dlls/
|
||||
/data/fastfiles/
|
||||
/releases/
|
||||
|
||||
.vscode/*
|
||||
.qmake.stash
|
||||
|
||||
# Ignore Qt Creator user files
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.creator.user
|
||||
*.creator.user.*
|
||||
*.creator.*
|
||||
*.ps1
|
||||
version.txt
|
||||
*.autosave
|
||||
*.XMODEL_EXPORT
|
||||
data/obj/*
|
||||
libs/*/release/*
|
||||
libs/*/debug/*
|
||||
.git.stash
|
||||
*Makefile*
|
||||
/build/
|
||||
/data/dlls/
|
||||
/data/fastfiles/
|
||||
|
||||
# Ignore Qt Creator user files
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.creator.user
|
||||
*.creator.user.*
|
||||
*.creator.*
|
||||
20
XPlor.pro
20
XPlor.pro
@ -1,10 +1,10 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += libs \
|
||||
app \
|
||||
#tools \
|
||||
#tests
|
||||
|
||||
#tests.depends = libs
|
||||
app.depends = libs
|
||||
#tools.depends = libs
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += libs \
|
||||
app \
|
||||
tools \
|
||||
tests
|
||||
|
||||
tests.depends = libs
|
||||
app.depends = libs
|
||||
tools.depends = libs
|
||||
|
||||
36
ai-commit.sh
36
ai-commit.sh
@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# 1. Stage everything
|
||||
git add -A
|
||||
|
||||
# 2. Get list of staged files
|
||||
FILES=$(git diff --cached --name-only)
|
||||
|
||||
if [ -z "$FILES" ]; then
|
||||
echo "No changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 3. Loop file by file
|
||||
for FILE in $FILES; do
|
||||
# Get diff for this file
|
||||
DIFF=$(git diff --cached -- "$FILE")
|
||||
|
||||
if [ -z "$DIFF" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Ask Ollama for a commit message describing this file change
|
||||
MSG=$(echo "$DIFF" | ollama run gemma3 \
|
||||
"You are a commit bot. Write a SHORT, clear, concise Git commit message for changes in file: $FILE.
|
||||
Only output the commit message, nothing else.
|
||||
Diff:
|
||||
$DIFF")
|
||||
|
||||
# Commit just this file with its message
|
||||
git commit -m "$MSG" -- "$FILE"
|
||||
|
||||
echo "✅ Committed $FILE with message:"
|
||||
echo "$MSG"
|
||||
done
|
||||
402
app/LICENSE
402
app/LICENSE
@ -1,201 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
#include "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
AboutDialog::~AboutDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
#include "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::AboutDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
AboutDialog::~AboutDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
#ifndef ABOUTDIALOG_H
|
||||
#define ABOUTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AboutDialog;
|
||||
}
|
||||
|
||||
class AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutDialog(QWidget *parent = nullptr);
|
||||
~AboutDialog();
|
||||
|
||||
private:
|
||||
Ui::AboutDialog *ui;
|
||||
};
|
||||
|
||||
#endif // ABOUTDIALOG_H
|
||||
#ifndef ABOUTDIALOG_H
|
||||
#define ABOUTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AboutDialog;
|
||||
}
|
||||
|
||||
class AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutDialog(QWidget *parent = nullptr);
|
||||
~AboutDialog();
|
||||
|
||||
private:
|
||||
Ui::AboutDialog *ui;
|
||||
};
|
||||
|
||||
#endif // ABOUTDIALOG_H
|
||||
|
||||
@ -1,241 +1,241 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutDialog</class>
|
||||
<widget class="QDialog" name="AboutDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About XPlor</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Data.qrc">:/images/data/images/XPlor.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>XPlor v1.5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copyright © 2024 RedLine Solutions LLC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>For more, check out redline.llc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>With Help From:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>- Paging Red</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>- ISOCheated</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>- SureShotIan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Data.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutDialog</class>
|
||||
<widget class="QDialog" name="AboutDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About XPlor</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Data.qrc">:/images/data/images/XPlor.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>XPlor v1.5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copyright © 2024 RedLine Solutions LLC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>For more, check out redline.llc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>With Help From:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>- Paging Red</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>- ISOCheated</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>- SureShotIan</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Data.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
179
app/app.pro
179
app/app.pro
@ -1,61 +1,118 @@
|
||||
QT += core widgets gui multimedia
|
||||
|
||||
RC_ICONS = app.ico
|
||||
|
||||
SUBDIRS += app
|
||||
|
||||
CONFIG += c++17
|
||||
|
||||
SOURCES += $$files($$PWD/*.cpp)
|
||||
HEADERS += $$files($$PWD/*.h)
|
||||
FORMS += $$files($$PWD/*.ui)
|
||||
|
||||
RESOURCES += ../data/data.qrc
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/../third_party/devil_sdk/lib/ -lDevIL -lILU -lILUT \
|
||||
-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
||||
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64 \
|
||||
-L$$OUT_PWD/../libs/ -lcore \
|
||||
-L$$OUT_PWD/../libs/ -lxassets\
|
||||
-L$$OUT_PWD/../libs/ -lcompression \
|
||||
-L$$OUT_PWD/../libs/ -lencryption \
|
||||
-L$$OUT_PWD/../libs/ -lfastfile \
|
||||
-L$$OUT_PWD/../libs/ -lddsfile \
|
||||
-L$$OUT_PWD/../libs/ -lipakfile \
|
||||
-L$$OUT_PWD/../libs/ -liwifile \
|
||||
-L$$OUT_PWD/../libs/ -lzonefile
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib/include \
|
||||
$$PWD/../third_party/xbox_sdk/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/ddsfile \
|
||||
$$PWD/../libs/ipakfile \
|
||||
$$PWD/../libs/iwifile \
|
||||
$$PWD/../libs/xassets \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib/include \
|
||||
$$PWD/../third_party/xbox_sdk/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/ddsfile \
|
||||
$$PWD/../libs/ipakfile \
|
||||
$$PWD/../libs/iwifile \
|
||||
$$PWD/../libs/xassets \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
|
||||
win32 {
|
||||
QMAKE_POST_LINK =
|
||||
QMAKE_POST_LINK += for /D %%G in (\"$$PWD/../third_party/*/lib\") do copy /Y \"%%~G\*.dll\" \"$$OUT_PWD/$$DESTDIR/\" >NUL $$escape_expand(\\n\\t)
|
||||
}
|
||||
QT += core widgets gui multimedia
|
||||
|
||||
RC_ICONS = app.ico
|
||||
|
||||
SUBDIRS += app
|
||||
|
||||
CONFIG += c++17
|
||||
|
||||
SOURCES += \
|
||||
aboutdialog.cpp \
|
||||
ddsviewer.cpp \
|
||||
fastfileviewer.cpp \
|
||||
imagewidget.cpp \
|
||||
iwiviewer.cpp \
|
||||
localstringviewer.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
materialviewer.cpp \
|
||||
preferenceeditor.cpp \
|
||||
soundviewer.cpp \
|
||||
stringtableviewer.cpp \
|
||||
rumblegraphviewer.cpp \
|
||||
rumblefileviewer.cpp \
|
||||
techsetviewer.cpp \
|
||||
xtreewidget.cpp \
|
||||
xtreewidgetitem.cpp \
|
||||
zonefileviewer.cpp
|
||||
|
||||
HEADERS += \
|
||||
aboutdialog.h \
|
||||
d3dbsp_structs.h \
|
||||
ddsviewer.h \
|
||||
fastfileviewer.h \
|
||||
imagewidget.h \
|
||||
iwiviewer.h \
|
||||
localstringviewer.h \
|
||||
mainwindow.h \
|
||||
materialviewer.h \
|
||||
preferenceeditor.h \
|
||||
soundviewer.h \
|
||||
stringtableviewer.h \
|
||||
rumblegraphviewer.h \
|
||||
rumblefileviewer.h \
|
||||
techsetviewer.h \
|
||||
xtreewidget.h \
|
||||
xtreewidgetitem.h \
|
||||
zonefileviewer.h
|
||||
|
||||
FORMS += \
|
||||
aboutdialog.ui \
|
||||
ddsviewer.ui \
|
||||
fastfileviewer.ui \
|
||||
imagewidget.ui \
|
||||
iwiviewer.ui \
|
||||
localstringviewer.ui \
|
||||
mainwindow.ui \
|
||||
materialviewer.ui \
|
||||
modelviewer.ui \
|
||||
preferenceeditor.ui \
|
||||
soundviewer.ui \
|
||||
stringtableviewer.ui \
|
||||
rumblegraphviewer.ui \
|
||||
rumblefileviewer.ui \
|
||||
techsetviewer.ui \
|
||||
zonefileviewer.ui
|
||||
|
||||
RESOURCES += ../data/data.qrc
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/../third_party/devil_sdk/lib/ -lDevIL -lILU -lILUT \
|
||||
-L$$PWD/../third_party/zlib/lib/ -lzlib \
|
||||
-L$$PWD/../third_party/xbox_sdk/lib -lxcompress64 \
|
||||
-L$$OUT_PWD/../libs/ -lcore \
|
||||
-L$$OUT_PWD/../libs/ -lcompression \
|
||||
-L$$OUT_PWD/../libs/ -lencryption \
|
||||
-L$$OUT_PWD/../libs/ -lfastfile \
|
||||
-L$$OUT_PWD/../libs/ -lddsfile \
|
||||
-L$$OUT_PWD/../libs/ -lipakfile \
|
||||
-L$$OUT_PWD/../libs/ -liwifile \
|
||||
-L$$OUT_PWD/../libs/ -lzonefile
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib/include \
|
||||
$$PWD/../third_party/xbox_sdk/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/ddsfile \
|
||||
$$PWD/../libs/ipakfile \
|
||||
$$PWD/../libs/iwifile \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../third_party/devil_sdk/include/ \
|
||||
$$PWD/../third_party/zlib/include \
|
||||
$$PWD/../third_party/xbox_sdk/include \
|
||||
$$PWD/../libs/core \
|
||||
$$PWD/../libs/compression \
|
||||
$$PWD/../libs/encryption \
|
||||
$$PWD/../libs/fastfile \
|
||||
$$PWD/../libs/ddsfile \
|
||||
$$PWD/../libs/ipakfile \
|
||||
$$PWD/../libs/iwifile \
|
||||
$$PWD/../libs/zonefile
|
||||
|
||||
# Copy DLLs to Debug folder
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/zlib/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/xna/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/debug/\" $$escape_expand(\\n\\t)
|
||||
|
||||
# Copy DLLs to Release folder
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/devil_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/zlib/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"G:/Projects/Qt/XPlor/third_party/xna/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
||||
QMAKE_POST_LINK += xcopy /Y /E /I \"$$PWD/../third_party/xbox_sdk/lib\\*.dll\" \"$$OUT_PWD/release/\" $$escape_expand(\\n\\t)
|
||||
|
||||
@ -1,41 +1,41 @@
|
||||
#ifndef D3DBSP_STRUCTS_H
|
||||
#define D3DBSP_STRUCTS_H
|
||||
|
||||
#include <QByteArray>
|
||||
|
||||
// Define Lump Structure
|
||||
struct Lump {
|
||||
QByteArray content;
|
||||
quint32 size = 0;
|
||||
bool isEmpty = true;
|
||||
};
|
||||
|
||||
// Lump Index Entry Structure
|
||||
struct LumpIndexEntry {
|
||||
quint32 type;
|
||||
quint32 length;
|
||||
};
|
||||
|
||||
// Bink structure definitions
|
||||
struct BINKRECT {
|
||||
int Left;
|
||||
int Top;
|
||||
int Width;
|
||||
int Height;
|
||||
};
|
||||
|
||||
struct BINK {
|
||||
int Width;
|
||||
int Height;
|
||||
uint32_t Frames;
|
||||
uint32_t FrameNum;
|
||||
uint32_t FrameRate;
|
||||
uint32_t FrameRateDiv;
|
||||
uint32_t ReadError;
|
||||
uint32_t OpenFlags;
|
||||
BINKRECT FrameRects;
|
||||
uint32_t NumRects;
|
||||
uint32_t FrameChangePercent;
|
||||
};
|
||||
|
||||
#endif // D3DBSP_STRUCTS_H
|
||||
#ifndef D3DBSP_STRUCTS_H
|
||||
#define D3DBSP_STRUCTS_H
|
||||
|
||||
#include <QByteArray>
|
||||
|
||||
// Define Lump Structure
|
||||
struct Lump {
|
||||
QByteArray content;
|
||||
quint32 size = 0;
|
||||
bool isEmpty = true;
|
||||
};
|
||||
|
||||
// Lump Index Entry Structure
|
||||
struct LumpIndexEntry {
|
||||
quint32 type;
|
||||
quint32 length;
|
||||
};
|
||||
|
||||
// Bink structure definitions
|
||||
struct BINKRECT {
|
||||
int Left;
|
||||
int Top;
|
||||
int Width;
|
||||
int Height;
|
||||
};
|
||||
|
||||
struct BINK {
|
||||
int Width;
|
||||
int Height;
|
||||
uint32_t Frames;
|
||||
uint32_t FrameNum;
|
||||
uint32_t FrameRate;
|
||||
uint32_t FrameRateDiv;
|
||||
uint32_t ReadError;
|
||||
uint32_t OpenFlags;
|
||||
BINKRECT FrameRects;
|
||||
uint32_t NumRects;
|
||||
uint32_t FrameChangePercent;
|
||||
};
|
||||
|
||||
#endif // D3DBSP_STRUCTS_H
|
||||
|
||||
@ -1,182 +1,182 @@
|
||||
#include "ddsviewer.h"
|
||||
#include "enums.h"
|
||||
#include "ui_ddsviewer.h"
|
||||
|
||||
DDSViewer::DDSViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::DDSViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
mDDSFile = nullptr;
|
||||
}
|
||||
|
||||
DDSViewer::~DDSViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DDSViewer::SetDDSFile(const DDSFile* aDDSFile) {
|
||||
mDDSFile = aDDSFile;
|
||||
|
||||
ui->label_Title->setText(mDDSFile->fileStem + ".dds");
|
||||
|
||||
char magicData[5];
|
||||
magicData[0] = static_cast<char>(mDDSFile->header.magic & 0xFF);
|
||||
magicData[1] = static_cast<char>((mDDSFile->header.magic >> 8) & 0xFF);
|
||||
magicData[2] = static_cast<char>((mDDSFile->header.magic >> 16) & 0xFF);
|
||||
magicData[3] = static_cast<char>((mDDSFile->header.magic >> 24) & 0xFF);
|
||||
magicData[4] = '\0';
|
||||
|
||||
// If you’re using Qt and want a QString:
|
||||
QString magicStr = QString::fromLatin1(magicData);
|
||||
ui->lineEdit_Magic->setText(magicStr);
|
||||
ui->spinBox_Size->setValue(mDDSFile->header.size);
|
||||
|
||||
ui->checkBox_CapsValid->setChecked((mDDSFile->header.flags & DDSD_CAPS) != 0);
|
||||
ui->checkBox_HeightValid->setChecked((mDDSFile->header.flags & DDSD_HEIGHT) != 0);
|
||||
ui->checkBox_WidthValid->setChecked((mDDSFile->header.flags & DDSD_WIDTH) != 0);
|
||||
ui->checkBox_PitchValid->setChecked((mDDSFile->header.flags & DDSD_PITCH) != 0);
|
||||
ui->checkBox_PFValid->setChecked((mDDSFile->header.flags & DDSD_PIXELFORMAT) != 0);
|
||||
ui->checkBox_MipmapCountValid->setChecked((mDDSFile->header.flags & DDSD_MIPMAPCOUNT) != 0);
|
||||
ui->checkBox_LinearSizeValid->setChecked((mDDSFile->header.flags & DDSD_LINEARSIZE) != 0);
|
||||
ui->checkBox_DepthValid->setChecked((mDDSFile->header.flags & DDSD_DEPTH) != 0);
|
||||
|
||||
ui->spinBox_PLSize->setValue(mDDSFile->header.pitchOrLinearSize);
|
||||
ui->spinBox_Depth->setValue(mDDSFile->header.depth);
|
||||
ui->spinBox_Width->setValue(mDDSFile->header.width);
|
||||
ui->spinBox_Height->setValue(mDDSFile->header.height);
|
||||
ui->spinBox_MipmapCount->setValue(mDDSFile->header.mipMapCount);
|
||||
|
||||
ui->spinBox_Res1->setValue(mDDSFile->header.reserved1[0]);
|
||||
ui->spinBox_Res2->setValue(mDDSFile->header.reserved1[1]);
|
||||
ui->spinBox_Res3->setValue(mDDSFile->header.reserved1[2]);
|
||||
ui->spinBox_Res4->setValue(mDDSFile->header.reserved1[3]);
|
||||
ui->spinBox_Res5->setValue(mDDSFile->header.reserved1[4]);
|
||||
ui->spinBox_Res6->setValue(mDDSFile->header.reserved1[5]);
|
||||
ui->spinBox_Res7->setValue(mDDSFile->header.reserved1[6]);
|
||||
ui->spinBox_Res8->setValue(mDDSFile->header.reserved1[7]);
|
||||
ui->spinBox_Res9->setValue(mDDSFile->header.reserved1[8]);
|
||||
ui->spinBox_Res10->setValue(mDDSFile->header.reserved1[9]);
|
||||
ui->spinBox_Res11->setValue(mDDSFile->header.reserved1[10]);
|
||||
|
||||
ui->spinBox_Res12->setValue(mDDSFile->header.reserved2);
|
||||
|
||||
ui->spinBox_PF_Size->setValue(mDDSFile->header.pixelFormat.size);
|
||||
|
||||
ui->checkBox_PF_AlphaPxValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_ALPHAPIXELS) != 0);
|
||||
ui->checkBox_PF_AlphaOnlyValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_ALPHA) != 0);
|
||||
ui->checkBox_PF_FormatValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_FOURCC) != 0);
|
||||
ui->checkBox_PF_RGBValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_RGB) != 0);
|
||||
ui->checkBox_PF_YUVValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_YUV) != 0);
|
||||
ui->checkBox_PF_LuminanceValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_LUMINANCE) != 0);
|
||||
|
||||
QString formatStr = QString::number(mDDSFile->header.pixelFormat.format);
|
||||
switch (mDDSFile->header.pixelFormat.format) {
|
||||
case IWI_FORMAT_ARGB32:
|
||||
formatStr = "ARGB32";
|
||||
break;
|
||||
case IWI_FORMAT_RGB24:
|
||||
formatStr = "RGB24";
|
||||
break;
|
||||
case IWI_FORMAT_GA16:
|
||||
formatStr = "GA16";
|
||||
break;
|
||||
case IWI_FORMAT_A8:
|
||||
formatStr = "A8";
|
||||
break;
|
||||
case IWI_FORMAT_DXT1:
|
||||
formatStr = "DXT1";
|
||||
break;
|
||||
case IWI_FORMAT_DXT3:
|
||||
formatStr = "DXT3";
|
||||
break;
|
||||
case IWI_FORMAT_DXT5:
|
||||
formatStr = "DXT5";
|
||||
break;
|
||||
}
|
||||
ui->lineEdit_PF_Format->setText(formatStr);
|
||||
ui->spinBox_PF_RGBBitCount->setValue(mDDSFile->header.pixelFormat.rgbBitCount);
|
||||
ui->spinBox_RedBitCount->setValue(mDDSFile->header.pixelFormat.rBitMask);
|
||||
ui->spinBox_GreenBitCount->setValue(mDDSFile->header.pixelFormat.gBitMask);
|
||||
ui->spinBox_BlueBitCount->setValue(mDDSFile->header.pixelFormat.bBitMask);
|
||||
ui->spinBox_AlphaBitMask->setValue(mDDSFile->header.pixelFormat.aBitMask);
|
||||
|
||||
ui->checkBox_Caps1_TextureValid->setChecked((mDDSFile->header.caps.caps1 & DDSCAPS_TEXTURE) != 0);
|
||||
ui->checkBox_Caps1_ComplexValid->setChecked((mDDSFile->header.caps.caps1 & DDSCAPS_COMPLEX) != 0);
|
||||
ui->checkBox_Caps1_MipmapValid->setChecked((mDDSFile->header.caps.caps1 & DDSCAPS_MIPMAP) != 0);
|
||||
|
||||
ui->checkBox_Caps2_CubemapValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP) != 0);
|
||||
ui->checkBox_Caps2_CMPXValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEX) != 0);
|
||||
ui->checkBox_Caps2_CMNXValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX) != 0);
|
||||
ui->checkBox_Caps2_CMPYValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEY) != 0);
|
||||
ui->checkBox_Caps2_CMNYValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY) != 0);
|
||||
ui->checkBox_Caps2_CMPZValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ) != 0);
|
||||
ui->checkBox_Caps2_CMNZValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ) != 0);
|
||||
ui->checkBox_Caps2_VolumeValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_VOLUME) != 0);
|
||||
|
||||
ui->spinBox_Caps_DDSX->setValue(mDDSFile->header.caps.dDSX);
|
||||
ui->spinBox_Caps_Res->setValue(mDDSFile->header.caps.reserved);
|
||||
|
||||
ui->comboBox_Mipmap->clear();
|
||||
for (auto mipmap : mDDSFile->mipmaps) {
|
||||
ui->comboBox_Mipmap->addItem(QString("%1x%2").arg(mipmap.width).arg(mipmap.height));
|
||||
}
|
||||
|
||||
connect(ui->comboBox_Mipmap, &QComboBox::currentIndexChanged, this, &DDSViewer::MipmapIndexChanged);
|
||||
|
||||
if (!mDDSFile->mipmaps.empty()) {
|
||||
MipmapIndexChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
void DDSViewer::MipmapIndexChanged(int aMipmapIndex) {
|
||||
if (aMipmapIndex == -1) { return; }
|
||||
|
||||
auto mipmaps = mDDSFile->mipmaps;
|
||||
auto mipmap = mipmaps[aMipmapIndex];
|
||||
|
||||
ui->spinBox_MipmapSize->setValue(mipmap.size);
|
||||
ui->spinBox_MipmapWidth->setValue(mipmap.width);
|
||||
ui->spinBox_MipmapHeight->setValue(mipmap.height);
|
||||
|
||||
// Validate Data
|
||||
if (mipmap.size <= 0) {
|
||||
qDebug() << "Error: Mipmap data is empty!";
|
||||
return;
|
||||
}
|
||||
if (mipmap.width <= 0 || mipmap.height <= 0) {
|
||||
qDebug() << "Error: Invalid mipmap dimensions!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure data size matches expected size
|
||||
int bytesPerPixel = 4; // RGBA8888
|
||||
quint32 expectedSize = mipmap.width * mipmap.height * bytesPerPixel;
|
||||
if (mipmap.size < expectedSize) {
|
||||
qDebug() << "Error: Mipmap data size mismatch! Expected:" << expectedSize << ", Got:" << mipmap.size;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create QImage
|
||||
const unsigned char* imageData = reinterpret_cast<const unsigned char*>(mipmap.data.constData());
|
||||
QImage image(reinterpret_cast<const uchar*>(imageData),
|
||||
mipmap.width, mipmap.height,
|
||||
mipmap.width * bytesPerPixel, // Stride
|
||||
QImage::Format_RGBA8888);
|
||||
|
||||
if (image.isNull()) {
|
||||
qDebug() << "Error: QImage creation failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert to QPixmap
|
||||
QPixmap pixmap = QPixmap::fromImage(image);
|
||||
if (pixmap.isNull()) {
|
||||
qDebug() << "Error: QPixmap conversion failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Scale and display
|
||||
pixmap = pixmap.scaled(ui->label_Image->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->label_Image->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
#include "ddsviewer.h"
|
||||
#include "enums.h"
|
||||
#include "ui_ddsviewer.h"
|
||||
|
||||
DDSViewer::DDSViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::DDSViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
mDDSFile = nullptr;
|
||||
}
|
||||
|
||||
DDSViewer::~DDSViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DDSViewer::SetDDSFile(std::shared_ptr<DDSFile> aDDSFile) {
|
||||
mDDSFile.swap(aDDSFile);
|
||||
|
||||
ui->label_Title->setText(mDDSFile->fileStem + ".dds");
|
||||
|
||||
char magicData[5];
|
||||
magicData[0] = static_cast<char>(mDDSFile->header.magic & 0xFF);
|
||||
magicData[1] = static_cast<char>((mDDSFile->header.magic >> 8) & 0xFF);
|
||||
magicData[2] = static_cast<char>((mDDSFile->header.magic >> 16) & 0xFF);
|
||||
magicData[3] = static_cast<char>((mDDSFile->header.magic >> 24) & 0xFF);
|
||||
magicData[4] = '\0';
|
||||
|
||||
// If you’re using Qt and want a QString:
|
||||
QString magicStr = QString::fromLatin1(magicData);
|
||||
ui->lineEdit_Magic->setText(magicStr);
|
||||
ui->spinBox_Size->setValue(mDDSFile->header.size);
|
||||
|
||||
ui->checkBox_CapsValid->setChecked((mDDSFile->header.flags & DDSD_CAPS) != 0);
|
||||
ui->checkBox_HeightValid->setChecked((mDDSFile->header.flags & DDSD_HEIGHT) != 0);
|
||||
ui->checkBox_WidthValid->setChecked((mDDSFile->header.flags & DDSD_WIDTH) != 0);
|
||||
ui->checkBox_PitchValid->setChecked((mDDSFile->header.flags & DDSD_PITCH) != 0);
|
||||
ui->checkBox_PFValid->setChecked((mDDSFile->header.flags & DDSD_PIXELFORMAT) != 0);
|
||||
ui->checkBox_MipmapCountValid->setChecked((mDDSFile->header.flags & DDSD_MIPMAPCOUNT) != 0);
|
||||
ui->checkBox_LinearSizeValid->setChecked((mDDSFile->header.flags & DDSD_LINEARSIZE) != 0);
|
||||
ui->checkBox_DepthValid->setChecked((mDDSFile->header.flags & DDSD_DEPTH) != 0);
|
||||
|
||||
ui->spinBox_PLSize->setValue(mDDSFile->header.pitchOrLinearSize);
|
||||
ui->spinBox_Depth->setValue(mDDSFile->header.depth);
|
||||
ui->spinBox_Width->setValue(mDDSFile->header.width);
|
||||
ui->spinBox_Height->setValue(mDDSFile->header.height);
|
||||
ui->spinBox_MipmapCount->setValue(mDDSFile->header.mipMapCount);
|
||||
|
||||
ui->spinBox_Res1->setValue(mDDSFile->header.reserved1[0]);
|
||||
ui->spinBox_Res2->setValue(mDDSFile->header.reserved1[1]);
|
||||
ui->spinBox_Res3->setValue(mDDSFile->header.reserved1[2]);
|
||||
ui->spinBox_Res4->setValue(mDDSFile->header.reserved1[3]);
|
||||
ui->spinBox_Res5->setValue(mDDSFile->header.reserved1[4]);
|
||||
ui->spinBox_Res6->setValue(mDDSFile->header.reserved1[5]);
|
||||
ui->spinBox_Res7->setValue(mDDSFile->header.reserved1[6]);
|
||||
ui->spinBox_Res8->setValue(mDDSFile->header.reserved1[7]);
|
||||
ui->spinBox_Res9->setValue(mDDSFile->header.reserved1[8]);
|
||||
ui->spinBox_Res10->setValue(mDDSFile->header.reserved1[9]);
|
||||
ui->spinBox_Res11->setValue(mDDSFile->header.reserved1[10]);
|
||||
|
||||
ui->spinBox_Res12->setValue(mDDSFile->header.reserved2);
|
||||
|
||||
ui->spinBox_PF_Size->setValue(mDDSFile->header.pixelFormat.size);
|
||||
|
||||
ui->checkBox_PF_AlphaPxValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_ALPHAPIXELS) != 0);
|
||||
ui->checkBox_PF_AlphaOnlyValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_ALPHA) != 0);
|
||||
ui->checkBox_PF_FormatValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_FOURCC) != 0);
|
||||
ui->checkBox_PF_RGBValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_RGB) != 0);
|
||||
ui->checkBox_PF_YUVValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_YUV) != 0);
|
||||
ui->checkBox_PF_LuminanceValid->setChecked((mDDSFile->header.pixelFormat.flags & DDPF_LUMINANCE) != 0);
|
||||
|
||||
QString formatStr = QString::number(mDDSFile->header.pixelFormat.format);
|
||||
switch (mDDSFile->header.pixelFormat.format) {
|
||||
case IWI_FORMAT_ARGB32:
|
||||
formatStr = "ARGB32";
|
||||
break;
|
||||
case IWI_FORMAT_RGB24:
|
||||
formatStr = "RGB24";
|
||||
break;
|
||||
case IWI_FORMAT_GA16:
|
||||
formatStr = "GA16";
|
||||
break;
|
||||
case IWI_FORMAT_A8:
|
||||
formatStr = "A8";
|
||||
break;
|
||||
case IWI_FORMAT_DXT1:
|
||||
formatStr = "DXT1";
|
||||
break;
|
||||
case IWI_FORMAT_DXT3:
|
||||
formatStr = "DXT3";
|
||||
break;
|
||||
case IWI_FORMAT_DXT5:
|
||||
formatStr = "DXT5";
|
||||
break;
|
||||
}
|
||||
ui->lineEdit_PF_Format->setText(formatStr);
|
||||
ui->spinBox_PF_RGBBitCount->setValue(mDDSFile->header.pixelFormat.rgbBitCount);
|
||||
ui->spinBox_RedBitCount->setValue(mDDSFile->header.pixelFormat.rBitMask);
|
||||
ui->spinBox_GreenBitCount->setValue(mDDSFile->header.pixelFormat.gBitMask);
|
||||
ui->spinBox_BlueBitCount->setValue(mDDSFile->header.pixelFormat.bBitMask);
|
||||
ui->spinBox_AlphaBitMask->setValue(mDDSFile->header.pixelFormat.aBitMask);
|
||||
|
||||
ui->checkBox_Caps1_TextureValid->setChecked((mDDSFile->header.caps.caps1 & DDSCAPS_TEXTURE) != 0);
|
||||
ui->checkBox_Caps1_ComplexValid->setChecked((mDDSFile->header.caps.caps1 & DDSCAPS_COMPLEX) != 0);
|
||||
ui->checkBox_Caps1_MipmapValid->setChecked((mDDSFile->header.caps.caps1 & DDSCAPS_MIPMAP) != 0);
|
||||
|
||||
ui->checkBox_Caps2_CubemapValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP) != 0);
|
||||
ui->checkBox_Caps2_CMPXValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEX) != 0);
|
||||
ui->checkBox_Caps2_CMNXValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX) != 0);
|
||||
ui->checkBox_Caps2_CMPYValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEY) != 0);
|
||||
ui->checkBox_Caps2_CMNYValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY) != 0);
|
||||
ui->checkBox_Caps2_CMPZValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ) != 0);
|
||||
ui->checkBox_Caps2_CMNZValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ) != 0);
|
||||
ui->checkBox_Caps2_VolumeValid->setChecked((mDDSFile->header.caps.caps2 & DDSCAPS2_VOLUME) != 0);
|
||||
|
||||
ui->spinBox_Caps_DDSX->setValue(mDDSFile->header.caps.dDSX);
|
||||
ui->spinBox_Caps_Res->setValue(mDDSFile->header.caps.reserved);
|
||||
|
||||
ui->comboBox_Mipmap->clear();
|
||||
for (auto mipmap : mDDSFile->mipmaps) {
|
||||
ui->comboBox_Mipmap->addItem(QString("%1x%2").arg(mipmap.width).arg(mipmap.height));
|
||||
}
|
||||
|
||||
connect(ui->comboBox_Mipmap, &QComboBox::currentIndexChanged, this, &DDSViewer::MipmapIndexChanged);
|
||||
|
||||
if (!mDDSFile->mipmaps.empty()) {
|
||||
MipmapIndexChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
void DDSViewer::MipmapIndexChanged(int aMipmapIndex) {
|
||||
if (aMipmapIndex == -1) { return; }
|
||||
|
||||
auto mipmaps = mDDSFile->mipmaps;
|
||||
auto mipmap = mipmaps[aMipmapIndex];
|
||||
|
||||
ui->spinBox_MipmapSize->setValue(mipmap.size);
|
||||
ui->spinBox_MipmapWidth->setValue(mipmap.width);
|
||||
ui->spinBox_MipmapHeight->setValue(mipmap.height);
|
||||
|
||||
// Validate Data
|
||||
if (mipmap.size <= 0) {
|
||||
qDebug() << "Error: Mipmap data is empty!";
|
||||
return;
|
||||
}
|
||||
if (mipmap.width <= 0 || mipmap.height <= 0) {
|
||||
qDebug() << "Error: Invalid mipmap dimensions!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure data size matches expected size
|
||||
int bytesPerPixel = 4; // RGBA8888
|
||||
quint32 expectedSize = mipmap.width * mipmap.height * bytesPerPixel;
|
||||
if (mipmap.size < expectedSize) {
|
||||
qDebug() << "Error: Mipmap data size mismatch! Expected:" << expectedSize << ", Got:" << mipmap.size;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create QImage
|
||||
const unsigned char* imageData = reinterpret_cast<const unsigned char*>(mipmap.data.constData());
|
||||
QImage image(reinterpret_cast<const uchar*>(imageData),
|
||||
mipmap.width, mipmap.height,
|
||||
mipmap.width * bytesPerPixel, // Stride
|
||||
QImage::Format_RGBA8888);
|
||||
|
||||
if (image.isNull()) {
|
||||
qDebug() << "Error: QImage creation failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert to QPixmap
|
||||
QPixmap pixmap = QPixmap::fromImage(image);
|
||||
if (pixmap.isNull()) {
|
||||
qDebug() << "Error: QPixmap conversion failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Scale and display
|
||||
pixmap = pixmap.scaled(ui->label_Image->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->label_Image->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
|
||||
@ -1,29 +1,29 @@
|
||||
#ifndef DDSVIEWER_H
|
||||
#define DDSVIEWER_H
|
||||
|
||||
#include "ddsfile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class DDSViewer;
|
||||
}
|
||||
|
||||
class DDSViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DDSViewer(QWidget *parent = nullptr);
|
||||
~DDSViewer();
|
||||
|
||||
void SetDDSFile(const DDSFile *aDDSFile);
|
||||
|
||||
private slots:
|
||||
void MipmapIndexChanged(int aMipmapIndex);
|
||||
|
||||
private:
|
||||
Ui::DDSViewer *ui;
|
||||
const DDSFile* mDDSFile;
|
||||
};
|
||||
|
||||
#endif // DDSVIEWER_H
|
||||
#ifndef DDSVIEWER_H
|
||||
#define DDSVIEWER_H
|
||||
|
||||
#include "ddsfile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class DDSViewer;
|
||||
}
|
||||
|
||||
class DDSViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DDSViewer(QWidget *parent = nullptr);
|
||||
~DDSViewer();
|
||||
|
||||
void SetDDSFile(std::shared_ptr<DDSFile> aDDSFile);
|
||||
|
||||
private slots:
|
||||
void MipmapIndexChanged(int aMipmapIndex);
|
||||
|
||||
private:
|
||||
Ui::DDSViewer *ui;
|
||||
std::shared_ptr<DDSFile> mDDSFile;
|
||||
};
|
||||
|
||||
#endif // DDSVIEWER_H
|
||||
|
||||
3424
app/ddsviewer.ui
3424
app/ddsviewer.ui
File diff suppressed because it is too large
Load Diff
@ -1,26 +1,27 @@
|
||||
#include "fastfileviewer.h"
|
||||
#include "ui_fastfileviewer.h"
|
||||
|
||||
FastFileViewer::FastFileViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::FFViewer)
|
||||
, mFastFile(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
FastFileViewer::~FastFileViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FastFileViewer::SetFastFile(const FastFile* aFastFile) {
|
||||
mFastFile = aFastFile;
|
||||
|
||||
ui->label_Title->setText(mFastFile->GetStem());
|
||||
ui->comboBox_Company->setCurrentIndex(mFastFile->GetCompany());
|
||||
ui->comboBox_FileType->setCurrentIndex(mFastFile->GetType());
|
||||
ui->checkBox_Signed->setChecked(mFastFile->GetSignage() == SIGNAGE_SIGNED);
|
||||
ui->lineEdit_Magic->setText(mFastFile->GetMagic());
|
||||
ui->spinBox_Version->setValue(mFastFile->GetVersion());
|
||||
}
|
||||
#include "fastfileviewer.h"
|
||||
#include "asset_structs.h"
|
||||
#include "ui_fastfileviewer.h"
|
||||
|
||||
FastFileViewer::FastFileViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::FFViewer)
|
||||
, mFastFile(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
FastFileViewer::~FastFileViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FastFileViewer::SetFastFile(std::shared_ptr<FastFile> aFastFile) {
|
||||
mFastFile.swap(aFastFile);
|
||||
|
||||
ui->label_Title->setText(mFastFile->GetStem());
|
||||
ui->comboBox_Company->setCurrentIndex(mFastFile->GetCompany());
|
||||
ui->comboBox_FileType->setCurrentIndex(mFastFile->GetType());
|
||||
ui->checkBox_Signed->setChecked(mFastFile->GetSignage() == SIGNAGE_SIGNED);
|
||||
ui->lineEdit_Magic->setText(mFastFile->GetMagic());
|
||||
ui->spinBox_Version->setValue(mFastFile->GetVersion());
|
||||
}
|
||||
|
||||
@ -1,25 +1,26 @@
|
||||
#ifndef FASTFILEVIEWER_H
|
||||
#define FASTFILEVIEWER_H
|
||||
|
||||
#include "fastfile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class FFViewer;
|
||||
}
|
||||
|
||||
class FastFileViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FastFileViewer(QWidget *parent = nullptr);
|
||||
~FastFileViewer();
|
||||
|
||||
void SetFastFile(const FastFile *aFastFile);
|
||||
private:
|
||||
Ui::FFViewer *ui;
|
||||
const FastFile* mFastFile;
|
||||
};
|
||||
|
||||
#endif // FASTFILEVIEWER_H
|
||||
#ifndef FASTFILEVIEWER_H
|
||||
#define FASTFILEVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
#include "fastfile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class FFViewer;
|
||||
}
|
||||
|
||||
class FastFileViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FastFileViewer(QWidget *parent = nullptr);
|
||||
~FastFileViewer();
|
||||
|
||||
void SetFastFile(std::shared_ptr<FastFile> aFastFile);
|
||||
private:
|
||||
Ui::FFViewer *ui;
|
||||
std::shared_ptr<FastFile> mFastFile;
|
||||
};
|
||||
|
||||
#endif // FASTFILEVIEWER_H
|
||||
|
||||
@ -1,197 +1,197 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FFViewer</class>
|
||||
<widget class="QWidget" name="FFViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>459</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FastFile 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Company:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Company">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Infinity Ward</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Treyarch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sledgehammer</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Neversoft</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>File Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_FileType">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FastFile</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Signed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_Signed">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Is signed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Magic:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Magic"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_Version">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FFViewer</class>
|
||||
<widget class="QWidget" name="FFViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>459</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FastFile 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Company:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Company">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Infinity Ward</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Treyarch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sledgehammer</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Neversoft</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>File Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_FileType">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>FastFile</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Signed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_Signed">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Is signed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Magic:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Magic"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_Version">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
#include "imagewidget.h"
|
||||
#include "ui_imagewidget.h"
|
||||
|
||||
ImageWidget::ImageWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::ImageWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ImageWidget::~ImageWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ImageWidget::SetImage(std::shared_ptr<QImage> aImage)
|
||||
{
|
||||
mImage = aImage;
|
||||
|
||||
//ui->lineEdit_Name->setText(aImage->name);
|
||||
//ui->lineEdit_Role->setText(aImage->materialName);
|
||||
//ui->comboBox_Compression->setCurrentIndex(aImage->compression);
|
||||
}
|
||||
|
||||
std::shared_ptr<QImage> ImageWidget::GetImage()
|
||||
{
|
||||
return mImage;
|
||||
}
|
||||
#include "imagewidget.h"
|
||||
#include "ui_imagewidget.h"
|
||||
|
||||
ImageWidget::ImageWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::ImageWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ImageWidget::~ImageWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ImageWidget::SetImage(std::shared_ptr<Image> aImage)
|
||||
{
|
||||
mImage = aImage;
|
||||
|
||||
ui->lineEdit_Name->setText(aImage->name);
|
||||
ui->lineEdit_Role->setText(aImage->materialName);
|
||||
ui->comboBox_Compression->setCurrentIndex(aImage->compression);
|
||||
}
|
||||
|
||||
std::shared_ptr<Image> ImageWidget::GetImage()
|
||||
{
|
||||
return mImage;
|
||||
}
|
||||
|
||||
@ -1,31 +1,32 @@
|
||||
#ifndef IMAGEWIDGET_H
|
||||
#define IMAGEWIDGET_H
|
||||
|
||||
#include "enums.h"
|
||||
#include "dds_structs.h"
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "ipak_structs.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ImageWidget;
|
||||
}
|
||||
|
||||
class ImageWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImageWidget(QWidget *parent = nullptr);
|
||||
~ImageWidget();
|
||||
|
||||
void SetImage(std::shared_ptr<QImage> aImage);
|
||||
std::shared_ptr<QImage> GetImage();
|
||||
|
||||
private:
|
||||
std::shared_ptr<QImage> mImage;
|
||||
Ui::ImageWidget *ui;
|
||||
};
|
||||
|
||||
#endif // IMAGEWIDGET_H
|
||||
#ifndef IMAGEWIDGET_H
|
||||
#define IMAGEWIDGET_H
|
||||
|
||||
#include "enums.h"
|
||||
#include "dds_structs.h"
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "asset_structs.h"
|
||||
#include "ipak_structs.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ImageWidget;
|
||||
}
|
||||
|
||||
class ImageWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImageWidget(QWidget *parent = nullptr);
|
||||
~ImageWidget();
|
||||
|
||||
void SetImage(std::shared_ptr<Image> aImage);
|
||||
std::shared_ptr<Image> GetImage();
|
||||
|
||||
private:
|
||||
std::shared_ptr<Image> mImage;
|
||||
Ui::ImageWidget *ui;
|
||||
};
|
||||
|
||||
#endif // IMAGEWIDGET_H
|
||||
|
||||
@ -1,144 +1,144 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ImageWidget</class>
|
||||
<widget class="QWidget" name="ImageWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<height>422</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Image Role:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Role"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Name"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Compression:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_Compression">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DXT1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DXT3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DXT5</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Preview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ImageWidget</class>
|
||||
<widget class="QWidget" name="ImageWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<height>422</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Image Role:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Role"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Name"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Compression:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_Compression">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DXT1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DXT3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DXT5</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Preview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>250</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,98 +1,98 @@
|
||||
#include "iwiviewer.h"
|
||||
#include "enums.h"
|
||||
#include "ui_iwiviewer.h"
|
||||
|
||||
IWIViewer::IWIViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::IWIViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
IWIViewer::~IWIViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void IWIViewer::SetIWIFile(const IWIFile* aIWIFile) {
|
||||
mIWIFile = aIWIFile;
|
||||
|
||||
ui->label_Title->setText(mIWIFile->fileStem + ".iwi");
|
||||
|
||||
// If you’re using Qt and want a QString:
|
||||
QString magicStr = QString::fromLatin1(mIWIFile->header.Magic, 3);
|
||||
ui->lineEdit_Magic->setText(magicStr);
|
||||
|
||||
ui->spinBox_Version->setValue(mIWIFile->header.Version);
|
||||
ui->spinBox_Depth->setValue(mIWIFile->info.Depth);
|
||||
QString formatStr = "";
|
||||
switch (mIWIFile->info.Format) {
|
||||
case IWI_FORMAT_ARGB32:
|
||||
formatStr = "ARGB32";
|
||||
break;
|
||||
case IWI_FORMAT_RGB24:
|
||||
formatStr = "RGB24";
|
||||
break;
|
||||
case IWI_FORMAT_GA16:
|
||||
formatStr = "GA16";
|
||||
break;
|
||||
case IWI_FORMAT_A8:
|
||||
formatStr = "A8";
|
||||
break;
|
||||
case IWI_FORMAT_DXT1:
|
||||
formatStr = "DXT1";
|
||||
break;
|
||||
case IWI_FORMAT_DXT3:
|
||||
formatStr = "DXT3";
|
||||
break;
|
||||
case IWI_FORMAT_DXT5:
|
||||
formatStr = "DXT5";
|
||||
break;
|
||||
}
|
||||
ui->lineEdit_Format->setText(formatStr);
|
||||
ui->spinBox_Height->setValue(mIWIFile->info.Height);
|
||||
ui->spinBox_Width->setValue(mIWIFile->info.Width);
|
||||
ui->spinBox_Usage->setValue(mIWIFile->info.Usage);
|
||||
|
||||
ui->comboBox_Mipmap->clear();
|
||||
for (auto mipmap : mIWIFile->mipmaps) {
|
||||
ui->comboBox_Mipmap->addItem(QString::number(mipmap.offset));
|
||||
}
|
||||
|
||||
connect(ui->comboBox_Mipmap, &QComboBox::currentIndexChanged, this, &IWIViewer::MipmapIndexChanged);
|
||||
|
||||
if (!mIWIFile->mipmaps.empty()) {
|
||||
MipmapIndexChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
void IWIViewer::MipmapIndexChanged(int aMipmapIndex) {
|
||||
auto mipmaps = mIWIFile->mipmaps;
|
||||
|
||||
if (aMipmapIndex == -1) { return; }
|
||||
|
||||
auto mipmap = mipmaps[aMipmapIndex];
|
||||
ui->spinBox_MipmapSize->setValue(mipmap.size);
|
||||
ui->spinBox_MipmapOffset->setValue(mipmap.offset);
|
||||
|
||||
const unsigned char* imageData = reinterpret_cast<const unsigned char*>(mipmap.data.constData());
|
||||
QImage image(reinterpret_cast<const uchar*>(imageData),
|
||||
mIWIFile->info.Width, mIWIFile->info.Height,
|
||||
QImage::Format_RGBA8888);
|
||||
|
||||
if (image.isNull()) {
|
||||
qDebug() << "Error: QImage creation failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert to QPixmap
|
||||
QPixmap pixmap = QPixmap::fromImage(image);
|
||||
if (pixmap.isNull()) {
|
||||
qDebug() << "Error: QPixmap conversion failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Scale and display
|
||||
pixmap = pixmap.scaled(ui->label_Image->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->label_Image->setPixmap(pixmap);
|
||||
}
|
||||
#include "iwiviewer.h"
|
||||
#include "enums.h"
|
||||
#include "ui_iwiviewer.h"
|
||||
|
||||
IWIViewer::IWIViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::IWIViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
IWIViewer::~IWIViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void IWIViewer::SetIWIFile(std::shared_ptr<IWIFile> aIWIFile) {
|
||||
mIWIFile.swap(aIWIFile);
|
||||
|
||||
ui->label_Title->setText(mIWIFile->fileStem + ".iwi");
|
||||
|
||||
// If you’re using Qt and want a QString:
|
||||
QString magicStr = QString::fromLatin1(mIWIFile->header.Magic, 3);
|
||||
ui->lineEdit_Magic->setText(magicStr);
|
||||
|
||||
ui->spinBox_Version->setValue(mIWIFile->header.Version);
|
||||
ui->spinBox_Depth->setValue(mIWIFile->info.Depth);
|
||||
QString formatStr = "";
|
||||
switch (mIWIFile->info.Format) {
|
||||
case IWI_FORMAT_ARGB32:
|
||||
formatStr = "ARGB32";
|
||||
break;
|
||||
case IWI_FORMAT_RGB24:
|
||||
formatStr = "RGB24";
|
||||
break;
|
||||
case IWI_FORMAT_GA16:
|
||||
formatStr = "GA16";
|
||||
break;
|
||||
case IWI_FORMAT_A8:
|
||||
formatStr = "A8";
|
||||
break;
|
||||
case IWI_FORMAT_DXT1:
|
||||
formatStr = "DXT1";
|
||||
break;
|
||||
case IWI_FORMAT_DXT3:
|
||||
formatStr = "DXT3";
|
||||
break;
|
||||
case IWI_FORMAT_DXT5:
|
||||
formatStr = "DXT5";
|
||||
break;
|
||||
}
|
||||
ui->lineEdit_Format->setText(formatStr);
|
||||
ui->spinBox_Height->setValue(mIWIFile->info.Height);
|
||||
ui->spinBox_Width->setValue(mIWIFile->info.Width);
|
||||
ui->spinBox_Usage->setValue(mIWIFile->info.Usage);
|
||||
|
||||
ui->comboBox_Mipmap->clear();
|
||||
for (auto mipmap : mIWIFile->mipmaps) {
|
||||
ui->comboBox_Mipmap->addItem(QString::number(mipmap.offset));
|
||||
}
|
||||
|
||||
connect(ui->comboBox_Mipmap, &QComboBox::currentIndexChanged, this, &IWIViewer::MipmapIndexChanged);
|
||||
|
||||
if (!mIWIFile->mipmaps.empty()) {
|
||||
MipmapIndexChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
void IWIViewer::MipmapIndexChanged(int aMipmapIndex) {
|
||||
auto mipmaps = mIWIFile->mipmaps;
|
||||
|
||||
if (aMipmapIndex == -1) { return; }
|
||||
|
||||
auto mipmap = mipmaps[aMipmapIndex];
|
||||
ui->spinBox_MipmapSize->setValue(mipmap.size);
|
||||
ui->spinBox_MipmapOffset->setValue(mipmap.offset);
|
||||
|
||||
const unsigned char* imageData = reinterpret_cast<const unsigned char*>(mipmap.data.constData());
|
||||
QImage image(reinterpret_cast<const uchar*>(imageData),
|
||||
mIWIFile->info.Width, mIWIFile->info.Height,
|
||||
QImage::Format_RGBA8888);
|
||||
|
||||
if (image.isNull()) {
|
||||
qDebug() << "Error: QImage creation failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert to QPixmap
|
||||
QPixmap pixmap = QPixmap::fromImage(image);
|
||||
if (pixmap.isNull()) {
|
||||
qDebug() << "Error: QPixmap conversion failed!";
|
||||
return;
|
||||
}
|
||||
|
||||
// Scale and display
|
||||
pixmap = pixmap.scaled(ui->label_Image->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui->label_Image->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
#ifndef IWIVIEWER_H
|
||||
#define IWIVIEWER_H
|
||||
|
||||
#include "iwifile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class IWIViewer;
|
||||
}
|
||||
|
||||
class IWIViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IWIViewer(QWidget *parent = nullptr);
|
||||
~IWIViewer();
|
||||
|
||||
void MipmapIndexChanged(int aMipmapIndex);
|
||||
|
||||
void SetIWIFile(const IWIFile *aIWIFile);
|
||||
private:
|
||||
Ui::IWIViewer *ui;
|
||||
const IWIFile* mIWIFile;
|
||||
};
|
||||
|
||||
#endif // IWIVIEWER_H
|
||||
#ifndef IWIVIEWER_H
|
||||
#define IWIVIEWER_H
|
||||
|
||||
#include "iwifile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class IWIViewer;
|
||||
}
|
||||
|
||||
class IWIViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IWIViewer(QWidget *parent = nullptr);
|
||||
~IWIViewer();
|
||||
|
||||
void MipmapIndexChanged(int aMipmapIndex);
|
||||
|
||||
void SetIWIFile(std::shared_ptr<IWIFile> aIWIFile);
|
||||
private:
|
||||
Ui::IWIViewer *ui;
|
||||
std::shared_ptr<IWIFile> mIWIFile;
|
||||
};
|
||||
|
||||
#endif // IWIVIEWER_H
|
||||
|
||||
1096
app/iwiviewer.ui
1096
app/iwiviewer.ui
File diff suppressed because it is too large
Load Diff
@ -1,58 +1,62 @@
|
||||
#include "localstringviewer.h"
|
||||
#include "ui_localstringviewer.h"
|
||||
|
||||
LocalStringViewer::LocalStringViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::LocalStringViewer),
|
||||
mVersion(),
|
||||
mConfigPath(),
|
||||
mFileNotes() {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableWidget_Strings->setColumnCount(2);
|
||||
ui->tableWidget_Strings->setRowCount(0);
|
||||
ui->tableWidget_Strings->setColumnWidth(0, 200);
|
||||
ui->tableWidget_Strings->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
|
||||
LocalStringViewer::~LocalStringViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetVersion(quint32 aVersion) {
|
||||
mVersion = aVersion;
|
||||
|
||||
ui->spinBox_Version->setValue(mVersion);
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetConfigPath(const QString aConfigPath) {
|
||||
mConfigPath = aConfigPath;
|
||||
|
||||
ui->lineEdit_Config->setText(mConfigPath);
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetFileNotes(const QString aFileNotes) {
|
||||
mFileNotes = aFileNotes;
|
||||
|
||||
ui->plainTextEdit_FileNotes->setPlainText(mFileNotes);
|
||||
}
|
||||
|
||||
void LocalStringViewer::AddLocalString(XLocalizeEntry aLocalString) {
|
||||
mLocalStrings.append(aLocalString);
|
||||
ui->tableWidget_Strings->setRowCount(mLocalStrings.size());
|
||||
ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(mLocalStrings.size()));
|
||||
QTableWidgetItem *aliasItem = new QTableWidgetItem(aLocalString.GetValue()->GetString());
|
||||
QTableWidgetItem *stringItem = new QTableWidgetItem(aLocalString.GetName()->GetString());
|
||||
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 0, aliasItem);
|
||||
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 1, stringItem);
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetZoneFile(const ZoneFile* aZoneFile) {
|
||||
mLocalStrings.clear();
|
||||
ui->tableWidget_Strings->clear();
|
||||
|
||||
ui->label_Title->setText(aZoneFile->GetStem().section('.', 0, 0) + ".str");
|
||||
// for (const LocalString &localStr : aZoneFile->GetAssetMap().localStrings) {
|
||||
// AddLocalString(localStr);
|
||||
// }
|
||||
}
|
||||
#include "localstringviewer.h"
|
||||
#include "ui_localstringviewer.h"
|
||||
|
||||
LocalStringViewer::LocalStringViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::LocalStringViewer),
|
||||
mVersion(),
|
||||
mConfigPath(),
|
||||
mFileNotes() {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableWidget_Strings->setColumnCount(2);
|
||||
ui->tableWidget_Strings->setRowCount(0);
|
||||
ui->tableWidget_Strings->setColumnWidth(0, 200);
|
||||
ui->tableWidget_Strings->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
|
||||
LocalStringViewer::~LocalStringViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetVersion(quint32 aVersion) {
|
||||
mVersion = aVersion;
|
||||
|
||||
ui->spinBox_Version->setValue(mVersion);
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetConfigPath(const QString aConfigPath) {
|
||||
mConfigPath = aConfigPath;
|
||||
|
||||
ui->lineEdit_Config->setText(mConfigPath);
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetFileNotes(const QString aFileNotes) {
|
||||
mFileNotes = aFileNotes;
|
||||
|
||||
ui->plainTextEdit_FileNotes->setPlainText(mFileNotes);
|
||||
}
|
||||
|
||||
void LocalStringViewer::AddLocalString(LocalString aLocalString) {
|
||||
mLocalStrings.append(aLocalString);
|
||||
|
||||
ui->tableWidget_Strings->setRowCount(mLocalStrings.size());
|
||||
|
||||
ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(mLocalStrings.size()));
|
||||
|
||||
QTableWidgetItem *aliasItem = new QTableWidgetItem(aLocalString.alias);
|
||||
QTableWidgetItem *stringItem = new QTableWidgetItem(aLocalString.string);
|
||||
|
||||
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 0, aliasItem);
|
||||
ui->tableWidget_Strings->setItem(mLocalStrings.size() - 1, 1, stringItem);
|
||||
}
|
||||
|
||||
void LocalStringViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
||||
mLocalStrings.clear();
|
||||
ui->tableWidget_Strings->clear();
|
||||
|
||||
ui->label_Title->setText(aZoneFile->GetStem().section('.', 0, 0) + ".str");
|
||||
for (const LocalString &localStr : aZoneFile->GetAssetMap().localStrings) {
|
||||
AddLocalString(localStr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
#ifndef LOCALSTRINGVIEWER_H
|
||||
#define LOCALSTRINGVIEWER_H
|
||||
|
||||
#include "xlocalizeentry.h"
|
||||
#include "zonefile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class LocalStringViewer;
|
||||
}
|
||||
|
||||
class LocalStringViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LocalStringViewer(QWidget *parent = nullptr);
|
||||
~LocalStringViewer();
|
||||
|
||||
void SetVersion(quint32 aVersion);
|
||||
void SetConfigPath(const QString aConfigPath);
|
||||
void SetFileNotes(const QString aFileNotes);
|
||||
void AddLocalString(XLocalizeEntry aLocalString);
|
||||
void SetZoneFile(const ZoneFile *aZoneFile);
|
||||
|
||||
private:
|
||||
Ui::LocalStringViewer *ui;
|
||||
quint32 mVersion;
|
||||
QString mConfigPath;
|
||||
QString mFileNotes;
|
||||
QVector<XLocalizeEntry> mLocalStrings;
|
||||
};
|
||||
|
||||
#endif // LOCALSTRINGVIEWER_H
|
||||
#ifndef LOCALSTRINGVIEWER_H
|
||||
#define LOCALSTRINGVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
#include "zonefile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class LocalStringViewer;
|
||||
}
|
||||
|
||||
class LocalStringViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LocalStringViewer(QWidget *parent = nullptr);
|
||||
~LocalStringViewer();
|
||||
|
||||
void SetVersion(quint32 aVersion);
|
||||
void SetConfigPath(const QString aConfigPath);
|
||||
void SetFileNotes(const QString aFileNotes);
|
||||
void AddLocalString(LocalString aLocalString);
|
||||
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
|
||||
|
||||
private:
|
||||
Ui::LocalStringViewer *ui;
|
||||
quint32 mVersion;
|
||||
QString mConfigPath;
|
||||
QString mFileNotes;
|
||||
QVector<LocalString> mLocalStrings;
|
||||
};
|
||||
|
||||
#endif // LOCALSTRINGVIEWER_H
|
||||
|
||||
@ -1,194 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LocalStringViewer</class>
|
||||
<widget class="QWidget" name="LocalStringViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>LocalString File 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>File Notes:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Config">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>C:\cod5\cod\cod5\bin\StringEd.cfg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Config:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="spinBox_Version">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_FileNotes">
|
||||
<property name="placeholderText">
|
||||
<string>Files notes...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_LocalStrViewer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Entries</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Strings">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LocalStringViewer</class>
|
||||
<widget class="QWidget" name="LocalStringViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>LocalString File 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>File Notes:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Config">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>C:\cod5\cod\cod5\bin\StringEd.cfg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Config:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="spinBox_Version">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit_FileNotes">
|
||||
<property name="placeholderText">
|
||||
<string>Files notes...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_LocalStrViewer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Entries</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Strings">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
22
app/main.cpp
22
app/main.cpp
@ -1,11 +1,11 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
1918
app/mainwindow.cpp
1918
app/mainwindow.cpp
File diff suppressed because it is too large
Load Diff
157
app/mainwindow.h
157
app/mainwindow.h
@ -1,78 +1,79 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "xtreewidget.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDockWidget>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QMimeData>
|
||||
#include <QProgressBar>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
void Reset();
|
||||
|
||||
private slots:
|
||||
bool OpenFastFile(const QString aFastFilePath);
|
||||
bool OpenFastFile(const QByteArray& aFastFileData, const QString aFastFilePath);
|
||||
bool OpenFastFile();
|
||||
|
||||
bool OpenZoneFile(const QString aZoneFilePath, bool fromFF = false);
|
||||
bool OpenZoneFile();
|
||||
|
||||
int LoadFile_D3DBSP(const QString aFilePath);
|
||||
int LoadFile_IPAK(const QString aFilePath);
|
||||
int LoadFile_XSUB(const QString aFilePath);
|
||||
int LoadFile_IWI(const QString aFilePath);
|
||||
int LoadFile_DDS(const QString aFilePath);
|
||||
int LoadFile_DDSFiles(const QStringList aFilePaths);
|
||||
|
||||
void HandleLogEntry(const QString &entry);
|
||||
void HandleStatusUpdate(const QString &message, int timeout);
|
||||
void HandleProgressUpdate(const QString &message, int progress, int max);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QMap<QString, int> mTypeMap;
|
||||
QStringList mTypeOrder;
|
||||
quint32 mTagCount;
|
||||
quint32 mRecordCount;
|
||||
QMap<QString, QString> mRawFileMap;
|
||||
//QMap<QString, Image> mImageMap;
|
||||
QMap<QString, QTreeWidgetItem*> mTreeMap;
|
||||
QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap;
|
||||
XTreeWidget *mTreeWidget;
|
||||
QPlainTextEdit *mLogWidget;
|
||||
QProgressBar *mProgressBar;
|
||||
|
||||
quint32 mBSPVersion;
|
||||
quint32 mDiskLumpCount;
|
||||
QVector<quint32> mDiskLumpOrder;
|
||||
QMap<quint32, Lump> mLumps;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "asset_structs.h"
|
||||
#include "xtreewidget.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDockWidget>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QMimeData>
|
||||
#include <QProgressBar>
|
||||
#include <windows.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
void Reset();
|
||||
|
||||
private slots:
|
||||
bool OpenFastFile(const QString aFastFilePath);
|
||||
bool OpenFastFile();
|
||||
|
||||
bool OpenZoneFile(const QString aZoneFilePath, bool fromFF = false);
|
||||
bool OpenZoneFile();
|
||||
|
||||
int LoadFile_D3DBSP(const QString aFilePath);
|
||||
int LoadFile_IPAK(const QString aFilePath);
|
||||
int LoadFile_XSUB(const QString aFilePath);
|
||||
int LoadFile_IWI(const QString aFilePath);
|
||||
int LoadFile_DDS(const QString aFilePath);
|
||||
int LoadFile_DDSFiles(const QStringList aFilePaths);
|
||||
|
||||
void HandleLogEntry(const QString &entry);
|
||||
void HandleStatusUpdate(const QString &message, int timeout);
|
||||
void HandleProgressUpdate(const QString &message, int progress, int max);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QMap<QString, int> mTypeMap;
|
||||
QStringList mTypeOrder;
|
||||
quint32 mTagCount;
|
||||
quint32 mRecordCount;
|
||||
QMap<QString, QString> mRawFileMap;
|
||||
QMap<QString, Image> mImageMap;
|
||||
QMap<QString, QTreeWidgetItem*> mTreeMap;
|
||||
QMap<QString, QVector<QPair<QString, QString>>> mStrTableMap;
|
||||
XTreeWidget *mTreeWidget;
|
||||
QPlainTextEdit *mLogWidget;
|
||||
QProgressBar *mProgressBar;
|
||||
|
||||
quint32 mBSPVersion;
|
||||
quint32 mDiskLumpCount;
|
||||
QVector<quint32> mDiskLumpOrder;
|
||||
QMap<quint32, Lump> mLumps;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
@ -1,379 +1,361 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1579</width>
|
||||
<height>857</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>XPlor</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QMainWindow {
|
||||
|
||||
}</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1579</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="MenuDef">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuRecent">
|
||||
<property name="title">
|
||||
<string>Recent...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuImport">
|
||||
<property name="title">
|
||||
<string>Import...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="actionNew_File_2"/>
|
||||
<addaction name="actionNew_Fast_File"/>
|
||||
<addaction name="actionNew_Zone_File"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOpen_Fast_File"/>
|
||||
<addaction name="actionOpen_Zone_File"/>
|
||||
<addaction name="actionOpen_Folder"/>
|
||||
<addaction name="menuImport"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSave_As"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuRecent"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEdit">
|
||||
<property name="title">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuUndo_History">
|
||||
<property name="title">
|
||||
<string>Undo History...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRedo_History">
|
||||
<property name="title">
|
||||
<string>Redo History...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCut"/>
|
||||
<addaction name="actionCopy"/>
|
||||
<addaction name="actionPaste"/>
|
||||
<addaction name="actionRename"/>
|
||||
<addaction name="actionDelete"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFind_2"/>
|
||||
<addaction name="actionEdit_Value"/>
|
||||
<addaction name="actionEdit_as_Hex"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuUndo_History"/>
|
||||
<addaction name="menuRedo_History"/>
|
||||
<addaction name="actionClear_Undo_History"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionCheck_for_Updates"/>
|
||||
<addaction name="actionReport_Issue"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTools">
|
||||
<property name="title">
|
||||
<string>Tools</string>
|
||||
</property>
|
||||
<addaction name="actionRun_Tests"/>
|
||||
</widget>
|
||||
<addaction name="MenuDef"/>
|
||||
<addaction name="menuEdit"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionNew_File_2">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_NewFile.png</normaloff>:/icons/icons/Icon_NewFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Fast_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_NewFile.png</normaloff>:/icons/icons/Icon_NewFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Fast File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Zone_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_NewFile.png</normaloff>:/icons/icons/Icon_NewFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Zone File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Fast_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_OpenFile.png</normaloff>:/icons/icons/Icon_OpenFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Fast File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Zone_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_OpenFile.png</normaloff>:/icons/icons/Icon_OpenFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Zone File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Folder">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_OpenFile.png</normaloff>:/icons/icons/Icon_OpenFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Save.png</normaloff>:/icons/icons/Icon_Save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_As">
|
||||
<property name="text">
|
||||
<string>Save As</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actione">
|
||||
<property name="text">
|
||||
<string>e</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFile">
|
||||
<property name="text">
|
||||
<string>File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFolder">
|
||||
<property name="text">
|
||||
<string>Folder</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_File">
|
||||
<property name="text">
|
||||
<string>New File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Fast_File_2">
|
||||
<property name="text">
|
||||
<string>New Fast File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Zone_File_2">
|
||||
<property name="text">
|
||||
<string>New Zone File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFrom_Clipboard">
|
||||
<property name="text">
|
||||
<string>From Clipboard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMaterial">
|
||||
<property name="text">
|
||||
<string>Material</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSound">
|
||||
<property name="text">
|
||||
<string>Sound</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndo">
|
||||
<property name="text">
|
||||
<string>Undo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRedo">
|
||||
<property name="text">
|
||||
<string>Redo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCut">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Cut.png</normaloff>:/icons/icons/Icon_Cut.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cut</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCopy">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Copy.png</normaloff>:/icons/icons/Icon_Copy.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPaste">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Paste.png</normaloff>:/icons/icons/Icon_Paste.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Paste</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRename">
|
||||
<property name="text">
|
||||
<string>Rename</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Value">
|
||||
<property name="text">
|
||||
<string>Edit Value</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_as_Hex">
|
||||
<property name="text">
|
||||
<string>Edit as Hex</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actiond">
|
||||
<property name="text">
|
||||
<string>d</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actiond_2">
|
||||
<property name="text">
|
||||
<string>d</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClear_Undo_History">
|
||||
<property name="text">
|
||||
<string>Clear Undo History</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFind">
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionChange_Icons">
|
||||
<property name="text">
|
||||
<string>Change Icons</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCheck_for_Updates">
|
||||
<property name="text">
|
||||
<string>Check for Updates</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFind_2">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Find.png</normaloff>:/icons/icons/Icon_Find.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPreferences">
|
||||
<property name="text">
|
||||
<string>Preferences...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReport_Issue">
|
||||
<property name="text">
|
||||
<string>Report Issue</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRun_Tests">
|
||||
<property name="text">
|
||||
<string>Run Tests</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../data/data.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1579</width>
|
||||
<height>857</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>XPlor</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QMainWindow {
|
||||
|
||||
}</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1579</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuRecent">
|
||||
<property name="title">
|
||||
<string>Recent...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuImport">
|
||||
<property name="title">
|
||||
<string>Import...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="actionNew_File_2"/>
|
||||
<addaction name="actionNew_Fast_File"/>
|
||||
<addaction name="actionNew_Zone_File"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOpen_Fast_File"/>
|
||||
<addaction name="actionOpen_Zone_File"/>
|
||||
<addaction name="actionOpen_Folder"/>
|
||||
<addaction name="menuImport"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSave_As"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuRecent"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEdit">
|
||||
<property name="title">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuUndo_History">
|
||||
<property name="title">
|
||||
<string>Undo History...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRedo_History">
|
||||
<property name="title">
|
||||
<string>Redo History...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCut"/>
|
||||
<addaction name="actionCopy"/>
|
||||
<addaction name="actionPaste"/>
|
||||
<addaction name="actionRename"/>
|
||||
<addaction name="actionDelete"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFind_2"/>
|
||||
<addaction name="actionEdit_Value"/>
|
||||
<addaction name="actionEdit_as_Hex"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuUndo_History"/>
|
||||
<addaction name="menuRedo_History"/>
|
||||
<addaction name="actionClear_Undo_History"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionCheck_for_Updates"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuEdit"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionNew_File_2">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_NewFile.png</normaloff>:/icons/icons/Icon_NewFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Fast_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_NewFile.png</normaloff>:/icons/icons/Icon_NewFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Fast File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Zone_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_NewFile.png</normaloff>:/icons/icons/Icon_NewFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Zone File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Fast_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_OpenFile.png</normaloff>:/icons/icons/Icon_OpenFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Fast File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Zone_File">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_OpenFile.png</normaloff>:/icons/icons/Icon_OpenFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Zone File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Folder">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_OpenFile.png</normaloff>:/icons/icons/Icon_OpenFile.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Folder</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Save.png</normaloff>:/icons/icons/Icon_Save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_As">
|
||||
<property name="text">
|
||||
<string>Save As</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actione">
|
||||
<property name="text">
|
||||
<string>e</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFile">
|
||||
<property name="text">
|
||||
<string>File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFolder">
|
||||
<property name="text">
|
||||
<string>Folder</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_File">
|
||||
<property name="text">
|
||||
<string>New File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Fast_File_2">
|
||||
<property name="text">
|
||||
<string>New Fast File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew_Zone_File_2">
|
||||
<property name="text">
|
||||
<string>New Zone File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFrom_Clipboard">
|
||||
<property name="text">
|
||||
<string>From Clipboard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMaterial">
|
||||
<property name="text">
|
||||
<string>Material</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSound">
|
||||
<property name="text">
|
||||
<string>Sound</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndo">
|
||||
<property name="text">
|
||||
<string>Undo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRedo">
|
||||
<property name="text">
|
||||
<string>Redo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCut">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Cut.png</normaloff>:/icons/icons/Icon_Cut.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cut</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCopy">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Copy.png</normaloff>:/icons/icons/Icon_Copy.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPaste">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Paste.png</normaloff>:/icons/icons/Icon_Paste.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Paste</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRename">
|
||||
<property name="text">
|
||||
<string>Rename</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Value">
|
||||
<property name="text">
|
||||
<string>Edit Value</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_as_Hex">
|
||||
<property name="text">
|
||||
<string>Edit as Hex</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actiond">
|
||||
<property name="text">
|
||||
<string>d</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actiond_2">
|
||||
<property name="text">
|
||||
<string>d</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClear_Undo_History">
|
||||
<property name="text">
|
||||
<string>Clear Undo History</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFind">
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionChange_Icons">
|
||||
<property name="text">
|
||||
<string>Change Icons</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCheck_for_Updates">
|
||||
<property name="text">
|
||||
<string>Check for Updates</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFind_2">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/icons/icons/Icon_Find.png</normaloff>:/icons/icons/Icon_Find.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPreferences">
|
||||
<property name="text">
|
||||
<string>Preferences...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../data/data.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,43 +1,35 @@
|
||||
#include "materialviewer.h"
|
||||
#include "ui_materialviewer.h"
|
||||
|
||||
MaterialViewer::MaterialViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::MaterialViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MaterialViewer::~MaterialViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString ToHexStr(quint32 in)
|
||||
{
|
||||
return QString("%1").arg(in, 8, 16, QChar('0')).toUpper();
|
||||
}
|
||||
|
||||
void MaterialViewer::SetMaterial(const XMaterial* aMaterial)
|
||||
{
|
||||
Q_UNUSED(aMaterial);
|
||||
|
||||
// TODO: Fill in MaterialViewer::SetMaterial
|
||||
|
||||
// ui->lineEdit_NamePtr->setText(ToHexStr(aMaterial->namePtr));
|
||||
// ui->lineEdit_Name->setText(aMaterial->name);
|
||||
// ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr));
|
||||
// ui->lineEdit_RefName->setText(aMaterial->refName);
|
||||
// QString unknownStr = "";
|
||||
// foreach (quint32 unknownPtr, aMaterial->pointers) {
|
||||
// unknownStr += ToHexStr(unknownPtr) + "\n";
|
||||
// }
|
||||
// ui->lineEdit_Unknowns->setText(unknownStr);
|
||||
// ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0]));
|
||||
// ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1]));
|
||||
// ui->spinBox_TextureCount->setValue(aMaterial->textureCount);
|
||||
// ui->spinBox_ConstCount->setValue(aMaterial->constCount);
|
||||
// ui->lineEdit_TechSetPtr->setText(ToHexStr(aMaterial->techSetPtr));
|
||||
// ui->lineEdit_TexturePtr->setText(ToHexStr(aMaterial->texturePtr));
|
||||
// ui->lineEdit_ConstantPtr->setText(ToHexStr(aMaterial->constPtr));
|
||||
}
|
||||
#include "materialviewer.h"
|
||||
#include "ui_materialviewer.h"
|
||||
|
||||
MaterialViewer::MaterialViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::MaterialViewer) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MaterialViewer::~MaterialViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString ToHexStr(quint32 in) {
|
||||
return QString("%1").arg(in, 8, 16, QChar('0')).toUpper();
|
||||
}
|
||||
|
||||
void MaterialViewer::SetMaterial(std::shared_ptr<Material> aMaterial) {
|
||||
ui->lineEdit_NamePtr->setText(ToHexStr(aMaterial->namePtr));
|
||||
ui->lineEdit_Name->setText(aMaterial->name);
|
||||
ui->lineEdit_RefPtr->setText(ToHexStr(aMaterial->refNamePtr));
|
||||
ui->lineEdit_RefName->setText(aMaterial->refName);
|
||||
QString unknownStr = "";
|
||||
foreach (quint32 unknownPtr, aMaterial->pointers) {
|
||||
unknownStr += ToHexStr(unknownPtr) + "\n";
|
||||
}
|
||||
ui->lineEdit_Unknowns->setText(unknownStr);
|
||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[0]));
|
||||
ui->lineEdit_StateA->setText(ToHexStr(aMaterial->stateBits[1]));
|
||||
ui->spinBox_TextureCount->setValue(aMaterial->textureCount);
|
||||
ui->spinBox_ConstCount->setValue(aMaterial->constCount);
|
||||
ui->lineEdit_TechSetPtr->setText(ToHexStr(aMaterial->techSetPtr));
|
||||
ui->lineEdit_TexturePtr->setText(ToHexStr(aMaterial->texturePtr));
|
||||
ui->lineEdit_ConstantPtr->setText(ToHexStr(aMaterial->constPtr));
|
||||
}
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
#ifndef MATERIALVIEWER_H
|
||||
#define MATERIALVIEWER_H
|
||||
|
||||
#include "xmaterial.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScrollArea>
|
||||
|
||||
namespace Ui {
|
||||
class MaterialViewer;
|
||||
}
|
||||
|
||||
class MaterialViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MaterialViewer(QWidget *parent = nullptr);
|
||||
~MaterialViewer();
|
||||
|
||||
void SetMaterial(const XMaterial *aMaterial);
|
||||
|
||||
private:
|
||||
Ui::MaterialViewer *ui;
|
||||
};
|
||||
|
||||
#endif // MATERIALVIEWER_H
|
||||
#ifndef MATERIALVIEWER_H
|
||||
#define MATERIALVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScrollArea>
|
||||
|
||||
namespace Ui {
|
||||
class MaterialViewer;
|
||||
}
|
||||
|
||||
class MaterialViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MaterialViewer(QWidget *parent = nullptr);
|
||||
~MaterialViewer();
|
||||
|
||||
void SetMaterial(std::shared_ptr<Material> aMaterial);
|
||||
|
||||
private:
|
||||
Ui::MaterialViewer *ui;
|
||||
};
|
||||
|
||||
#endif // MATERIALVIEWER_H
|
||||
|
||||
@ -1,236 +1,236 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MaterialViewer</class>
|
||||
<widget class="QWidget" name="MaterialViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1001</width>
|
||||
<height>650</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Material 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_NamePtr"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Ref Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Ref Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Unknowns:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>State A:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>State B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Texture Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Name"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_RefPtr"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_RefName"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Unknowns"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_StateA"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_StateB"/>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_TextureCount"/>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_ConstCount"/>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_TechSetPtr"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Constant Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Tech Set Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Texture Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Constant Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_TexturePtr"/>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_ConstantPtr"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>143</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MaterialViewer</class>
|
||||
<widget class="QWidget" name="MaterialViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1001</width>
|
||||
<height>650</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Material 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_NamePtr"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Ref Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Ref Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Unknowns:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>State A:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>State B:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Texture Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Name"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_RefPtr"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_RefName"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Unknowns"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_StateA"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_StateB"/>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_TextureCount"/>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_ConstCount"/>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_TechSetPtr"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Constant Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Tech Set Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Texture Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Constant Ptr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_TexturePtr"/>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_ConstantPtr"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Data</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6"/>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>143</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
#include "modelviewer.h"
|
||||
#include "ui_modelviewer.h"
|
||||
|
||||
ModelViewer::ModelViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::ModelViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ModelViewer::~ModelViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
#include "modelviewer.h"
|
||||
#include "ui_modelviewer.h"
|
||||
|
||||
ModelViewer::ModelViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::ModelViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ModelViewer::~ModelViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
#ifndef MODELVIEWER_H
|
||||
#define MODELVIEWER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ModelViewer;
|
||||
}
|
||||
|
||||
class ModelViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ModelViewer(QWidget *parent = nullptr);
|
||||
~ModelViewer();
|
||||
|
||||
private:
|
||||
Ui::ModelViewer *ui;
|
||||
};
|
||||
|
||||
#endif // MODELVIEWER_H
|
||||
#ifndef MODELVIEWER_H
|
||||
#define MODELVIEWER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ModelViewer;
|
||||
}
|
||||
|
||||
class ModelViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ModelViewer(QWidget *parent = nullptr);
|
||||
~ModelViewer();
|
||||
|
||||
private:
|
||||
Ui::ModelViewer *ui;
|
||||
};
|
||||
|
||||
#endif // MODELVIEWER_H
|
||||
|
||||
1248
app/modelviewer.ui
1248
app/modelviewer.ui
File diff suppressed because it is too large
Load Diff
@ -1,35 +1,35 @@
|
||||
#include "preferenceeditor.h"
|
||||
#include "ui_preferenceeditor.h"
|
||||
|
||||
PreferenceEditor::PreferenceEditor(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::PreferenceEditor)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->frame_View->show();
|
||||
ui->frame_TreeWidget->hide();
|
||||
ui->frame_FileEditors->hide();
|
||||
|
||||
connect(ui->listWidget_Categories, &QListWidget::itemSelectionChanged, this, [this]() {
|
||||
const QString itemText = ui->listWidget_Categories->selectedItems().first()->text();
|
||||
if (itemText == "View") {
|
||||
ui->frame_View->show();
|
||||
ui->frame_TreeWidget->hide();
|
||||
ui->frame_FileEditors->hide();
|
||||
} else if (itemText == "Tree Widget") {
|
||||
ui->frame_View->hide();
|
||||
ui->frame_TreeWidget->show();
|
||||
ui->frame_FileEditors->hide();
|
||||
} else if (itemText == "File Editors") {
|
||||
ui->frame_View->hide();
|
||||
ui->frame_TreeWidget->hide();
|
||||
ui->frame_FileEditors->show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PreferenceEditor::~PreferenceEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
#include "preferenceeditor.h"
|
||||
#include "ui_preferenceeditor.h"
|
||||
|
||||
PreferenceEditor::PreferenceEditor(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::PreferenceEditor)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->frame_View->show();
|
||||
ui->frame_TreeWidget->hide();
|
||||
ui->frame_FileEditors->hide();
|
||||
|
||||
connect(ui->listWidget_Categories, &QListWidget::itemSelectionChanged, this, [this]() {
|
||||
const QString itemText = ui->listWidget_Categories->selectedItems().first()->text();
|
||||
if (itemText == "View") {
|
||||
ui->frame_View->show();
|
||||
ui->frame_TreeWidget->hide();
|
||||
ui->frame_FileEditors->hide();
|
||||
} else if (itemText == "Tree Widget") {
|
||||
ui->frame_View->hide();
|
||||
ui->frame_TreeWidget->show();
|
||||
ui->frame_FileEditors->hide();
|
||||
} else if (itemText == "File Editors") {
|
||||
ui->frame_View->hide();
|
||||
ui->frame_TreeWidget->hide();
|
||||
ui->frame_FileEditors->show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
PreferenceEditor::~PreferenceEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
#ifndef PREFERENCEEDITOR_H
|
||||
#define PREFERENCEEDITOR_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class PreferenceEditor;
|
||||
}
|
||||
|
||||
class PreferenceEditor : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PreferenceEditor(QWidget *parent = nullptr);
|
||||
~PreferenceEditor();
|
||||
|
||||
private:
|
||||
Ui::PreferenceEditor *ui;
|
||||
};
|
||||
|
||||
#endif // PREFERENCEEDITOR_H
|
||||
#ifndef PREFERENCEEDITOR_H
|
||||
#define PREFERENCEEDITOR_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class PreferenceEditor;
|
||||
}
|
||||
|
||||
class PreferenceEditor : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PreferenceEditor(QWidget *parent = nullptr);
|
||||
~PreferenceEditor();
|
||||
|
||||
private:
|
||||
Ui::PreferenceEditor *ui;
|
||||
};
|
||||
|
||||
#endif // PREFERENCEEDITOR_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,103 +0,0 @@
|
||||
#include "reportissuedialog.h"
|
||||
#include "qjsonarray.h"
|
||||
#include "ui_reportissuedialog.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
ReportIssueDialog::ReportIssueDialog(const QString &giteaBaseUrl,
|
||||
const QString &repoOwner,
|
||||
const QString &repoName,
|
||||
const QString &accessToken,
|
||||
QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ReportIssueDialog),
|
||||
networkManager(new QNetworkAccessManager(this)),
|
||||
giteaBaseUrl(giteaBaseUrl),
|
||||
repoOwner(repoOwner),
|
||||
repoName(repoName),
|
||||
accessToken(accessToken)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(networkManager, &QNetworkAccessManager::finished, this, &ReportIssueDialog::onNetworkReplyFinished);
|
||||
}
|
||||
|
||||
ReportIssueDialog::~ReportIssueDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ReportIssueDialog::on_buttonSend_clicked()
|
||||
{
|
||||
QString title = ui->lineEditSummary->text().trimmed();
|
||||
QString details = ui->textEditDetails->toPlainText().trimmed();
|
||||
QString contact = ui->lineEditContact->text().trimmed();
|
||||
|
||||
if (title.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Input Error"), tr("Please enter a summary/title for the issue."));
|
||||
return;
|
||||
}
|
||||
|
||||
QString body = details;
|
||||
if (!contact.isEmpty()) {
|
||||
body += QString("\n\nContact info:\n%1").arg(contact);
|
||||
}
|
||||
|
||||
ui->buttonSend->setEnabled(false);
|
||||
sendIssueReport(title, body, contact);
|
||||
}
|
||||
|
||||
void ReportIssueDialog::on_buttonCancel_clicked()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
|
||||
void ReportIssueDialog::sendIssueReport(const QString &title, const QString &body, const QString &/*contact*/)
|
||||
{
|
||||
// Compose URL: e.g. https://gitea.example.com/api/v1/repos/{owner}/{repo}/issues
|
||||
QUrl url(QString("%1/api/v1/repos/%2/%3/issues").arg(giteaBaseUrl).arg(repoOwner).arg(repoName));
|
||||
|
||||
QNetworkRequest request(url);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
if (!accessToken.isEmpty()) {
|
||||
request.setRawHeader("Authorization", "token " + accessToken.toUtf8());
|
||||
}
|
||||
|
||||
// Compose JSON body
|
||||
QJsonObject json;
|
||||
json["title"] = title;
|
||||
json["body"] = body;
|
||||
json["labels"] = QJsonArray{12};
|
||||
|
||||
QJsonDocument doc(json);
|
||||
QByteArray data = doc.toJson();
|
||||
|
||||
networkManager->post(request, data);
|
||||
}
|
||||
|
||||
void ReportIssueDialog::onNetworkReplyFinished(QNetworkReply *reply)
|
||||
{
|
||||
ui->buttonSend->setEnabled(true);
|
||||
|
||||
QByteArray responseData = reply->readAll();
|
||||
QString responseStr = QString::fromUtf8(responseData);
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
QString errorStr = reply->errorString();
|
||||
if (errorStr.isEmpty()) errorStr = "Unknown network error";
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to send issue report:\n%1\nResponse:\n%2").arg(errorStr).arg(responseStr));
|
||||
} else {
|
||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
if (status == 201) {
|
||||
QMessageBox::information(this, tr("Success"), tr("Issue reported successfully!"));
|
||||
accept();
|
||||
} else {
|
||||
QMessageBox::warning(this, tr("Failed"), tr("Unexpected response from server (%1):\n%2").arg(status).arg(responseStr));
|
||||
}
|
||||
}
|
||||
reply->deleteLater();
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
#ifndef REPORTISSUEDIALOG_H
|
||||
#define REPORTISSUEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
|
||||
namespace Ui {
|
||||
class ReportIssueDialog;
|
||||
}
|
||||
|
||||
class ReportIssueDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReportIssueDialog(const QString &giteaBaseUrl,
|
||||
const QString &repoOwner,
|
||||
const QString &repoName,
|
||||
const QString &accessToken,
|
||||
QWidget *parent = nullptr);
|
||||
~ReportIssueDialog();
|
||||
|
||||
private slots:
|
||||
void on_buttonSend_clicked();
|
||||
void on_buttonCancel_clicked();
|
||||
|
||||
void onNetworkReplyFinished(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
Ui::ReportIssueDialog *ui;
|
||||
|
||||
QNetworkAccessManager *networkManager;
|
||||
|
||||
QString giteaBaseUrl;
|
||||
QString repoOwner;
|
||||
QString repoName;
|
||||
QString accessToken;
|
||||
|
||||
void sendIssueReport(const QString &title, const QString &body, const QString &contact);
|
||||
};
|
||||
|
||||
#endif // REPORTISSUEDIALOG_H
|
||||
@ -1,84 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReportIssueDialog</class>
|
||||
<widget class="QDialog" name="ReportIssueDialog">
|
||||
<property name="windowTitle">
|
||||
<string>Report a Problem</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelInstructions">
|
||||
<property name="text">
|
||||
<string>Please describe the problem you encountered. We’ll use this info to help fix it.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSummary">
|
||||
<property name="text">
|
||||
<string>Summary (short title):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditSummary" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelDetails">
|
||||
<property name="text">
|
||||
<string>Details (what happened?):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEditDetails" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelContact">
|
||||
<property name="text">
|
||||
<string>Your contact (email or name, optional):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditContact" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonSend">
|
||||
<property name="text">
|
||||
<string>Send Report</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -1,58 +1,58 @@
|
||||
#include "rumblefileviewer.h"
|
||||
#include "ui_rumblefileviewer.h"
|
||||
|
||||
RumbleFileViewer::RumbleFileViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::RumbleFileViewer)
|
||||
, mPropertyCount()
|
||||
, mRumbleFile(nullptr) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableWidget_Properties->setColumnCount(2);
|
||||
ui->tableWidget_Properties->setRowCount(0);
|
||||
ui->tableWidget_Properties->setColumnWidth(0, 200);
|
||||
ui->tableWidget_Properties->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
|
||||
RumbleFileViewer::~RumbleFileViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RumbleFileViewer::SetRumbleFile(XRawFile *aRumbleFile) {
|
||||
mRumbleFile = aRumbleFile;
|
||||
|
||||
ui->tableWidget_Properties->clear();
|
||||
|
||||
// const QString magic = aRumbleFile->contents.left(6);
|
||||
// if (magic != "RUMBLE") {
|
||||
// qDebug() << "Rumble file has invalid magic: " << magic;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// int firstIndex = 0;
|
||||
// int secondIndex = 0;
|
||||
// int thirdIndex = 0;
|
||||
|
||||
// int startIndex = 0;
|
||||
// for (int i = 0; i < aRumbleFile->contents.count("\\") / 2; i++) {
|
||||
// ui->tableWidget_Properties->setRowCount(i + 1);
|
||||
// ui->spinBox_Entries->setValue(i + 1);
|
||||
|
||||
// firstIndex = aRumbleFile->contents.indexOf("\\", startIndex);
|
||||
// secondIndex = aRumbleFile->contents.indexOf("\\", firstIndex + 1);
|
||||
// thirdIndex = aRumbleFile->contents.indexOf("\\", secondIndex + 1);
|
||||
// if (thirdIndex == -1) {
|
||||
// thirdIndex = aRumbleFile->contents.size();
|
||||
// }
|
||||
|
||||
// const QString keyStr = aRumbleFile->contents.mid(firstIndex + 1, secondIndex - firstIndex - 1);
|
||||
// QTableWidgetItem *keyItem = new QTableWidgetItem(keyStr);
|
||||
// ui->tableWidget_Properties->setItem(i, 0, keyItem);
|
||||
|
||||
// const QString valStr = aRumbleFile->contents.mid(secondIndex + 1, thirdIndex - secondIndex - 1);
|
||||
// QTableWidgetItem *valueItem = new QTableWidgetItem(valStr);
|
||||
// ui->tableWidget_Properties->setItem(i, 1, valueItem);
|
||||
|
||||
// startIndex = thirdIndex;
|
||||
// }
|
||||
}
|
||||
#include "rumblefileviewer.h"
|
||||
#include "ui_rumblefileviewer.h"
|
||||
|
||||
RumbleFileViewer::RumbleFileViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::RumbleFileViewer)
|
||||
, mPropertyCount()
|
||||
, mRumbleFile(nullptr) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableWidget_Properties->setColumnCount(2);
|
||||
ui->tableWidget_Properties->setRowCount(0);
|
||||
ui->tableWidget_Properties->setColumnWidth(0, 200);
|
||||
ui->tableWidget_Properties->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
|
||||
RumbleFileViewer::~RumbleFileViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RumbleFileViewer::SetRumbleFile(std::shared_ptr<RawFile> aRumbleFile) {
|
||||
mRumbleFile = aRumbleFile;
|
||||
|
||||
ui->tableWidget_Properties->clear();
|
||||
|
||||
const QString magic = aRumbleFile->contents.left(6);
|
||||
if (magic != "RUMBLE") {
|
||||
qDebug() << "Rumble file has invalid magic: " << magic;
|
||||
return;
|
||||
}
|
||||
|
||||
int firstIndex = 0;
|
||||
int secondIndex = 0;
|
||||
int thirdIndex = 0;
|
||||
|
||||
int startIndex = 0;
|
||||
for (int i = 0; i < aRumbleFile->contents.count("\\") / 2; i++) {
|
||||
ui->tableWidget_Properties->setRowCount(i + 1);
|
||||
ui->spinBox_Entries->setValue(i + 1);
|
||||
|
||||
firstIndex = aRumbleFile->contents.indexOf("\\", startIndex);
|
||||
secondIndex = aRumbleFile->contents.indexOf("\\", firstIndex + 1);
|
||||
thirdIndex = aRumbleFile->contents.indexOf("\\", secondIndex + 1);
|
||||
if (thirdIndex == -1) {
|
||||
thirdIndex = aRumbleFile->contents.size();
|
||||
}
|
||||
|
||||
const QString keyStr = aRumbleFile->contents.mid(firstIndex + 1, secondIndex - firstIndex - 1);
|
||||
QTableWidgetItem *keyItem = new QTableWidgetItem(keyStr);
|
||||
ui->tableWidget_Properties->setItem(i, 0, keyItem);
|
||||
|
||||
const QString valStr = aRumbleFile->contents.mid(secondIndex + 1, thirdIndex - secondIndex - 1);
|
||||
QTableWidgetItem *valueItem = new QTableWidgetItem(valStr);
|
||||
ui->tableWidget_Properties->setItem(i, 1, valueItem);
|
||||
|
||||
startIndex = thirdIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
#ifndef RUMBLEFILEVIEWER_H
|
||||
#define RUMBLEFILEVIEWER_H
|
||||
|
||||
#include "xrawfile.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class RumbleFileViewer;
|
||||
}
|
||||
|
||||
class RumbleFileViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RumbleFileViewer(QWidget *parent = nullptr);
|
||||
~RumbleFileViewer();
|
||||
|
||||
void SetRumbleFile(XRawFile* aRumbleFile);
|
||||
|
||||
private:
|
||||
Ui::RumbleFileViewer *ui;
|
||||
quint32 mPropertyCount;
|
||||
XRawFile* mRumbleFile;
|
||||
};
|
||||
|
||||
#endif // RUMBLEFILEVIEWER_H
|
||||
#ifndef RUMBLEFILEVIEWER_H
|
||||
#define RUMBLEFILEVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
#include "zonefile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class RumbleFileViewer;
|
||||
}
|
||||
|
||||
class RumbleFileViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RumbleFileViewer(QWidget *parent = nullptr);
|
||||
~RumbleFileViewer();
|
||||
|
||||
void SetRumbleFile(std::shared_ptr<RawFile> aRumbleFile);
|
||||
|
||||
private:
|
||||
Ui::RumbleFileViewer *ui;
|
||||
quint32 mPropertyCount;
|
||||
std::shared_ptr<RawFile> mRumbleFile;
|
||||
};
|
||||
|
||||
#endif // RUMBLEFILEVIEWER_H
|
||||
|
||||
@ -1,153 +1,153 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RumbleFileViewer</class>
|
||||
<widget class="QWidget" name="RumbleFileViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rumble File Viewer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="spinBox_Entries">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Entries:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_LocalStrViewer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Properties">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RumbleFileViewer</class>
|
||||
<widget class="QWidget" name="RumbleFileViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rumble File Viewer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="2" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="spinBox_Entries">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Entries:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_LocalStrViewer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Properties">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,54 +1,54 @@
|
||||
#include "rumblegraphviewer.h"
|
||||
#include "ui_rumblegraphviewer.h"
|
||||
|
||||
RumbleGraphViewer::RumbleGraphViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::RumbleGraphViewer),
|
||||
mEntryCount(),
|
||||
mRumbleGraphFile(nullptr) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableWidget_Entries->setColumnCount(2);
|
||||
ui->tableWidget_Entries->setHorizontalHeaderLabels({ "X", "Y" });
|
||||
ui->tableWidget_Entries->setRowCount(0);
|
||||
ui->tableWidget_Entries->setColumnWidth(0, 200);
|
||||
ui->tableWidget_Entries->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
|
||||
RumbleGraphViewer::~RumbleGraphViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RumbleGraphViewer::SetRumbleGraphFile(const XRawFile* aRawFile) {
|
||||
mRumbleGraphFile = aRawFile;
|
||||
|
||||
XDataStream rawFileStream;//(mRumbleGraphFile->contents.toLatin1());
|
||||
|
||||
QByteArray magic(15, Qt::Uninitialized);
|
||||
rawFileStream.readRawData(magic.data(), 15);
|
||||
|
||||
rawFileStream.skipRawData(4);
|
||||
|
||||
char sectionChar;
|
||||
rawFileStream >> sectionChar;
|
||||
int sectionCount = sectionChar - '0';
|
||||
ui->tableWidget_Entries->setRowCount(sectionCount);
|
||||
ui->spinBox_Entries->setValue(sectionCount);
|
||||
ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(sectionCount));
|
||||
|
||||
rawFileStream.skipRawData(2);
|
||||
|
||||
for (int i = 0; i < sectionCount; i++) {
|
||||
QByteArray xVal(6, Qt::Uninitialized), yVal(6, Qt::Uninitialized);
|
||||
rawFileStream.readRawData(xVal.data(), 6);
|
||||
rawFileStream.skipRawData(1);
|
||||
rawFileStream.readRawData(yVal.data(), 6);
|
||||
rawFileStream.skipRawData(2);
|
||||
|
||||
QTableWidgetItem *xItem = new QTableWidgetItem(xVal);
|
||||
QTableWidgetItem *yItem = new QTableWidgetItem(yVal);
|
||||
|
||||
ui->tableWidget_Entries->setItem(i, 0, xItem);
|
||||
ui->tableWidget_Entries->setItem(i, 1, yItem);
|
||||
}
|
||||
}
|
||||
#include "rumblegraphviewer.h"
|
||||
#include "ui_rumblegraphviewer.h"
|
||||
|
||||
RumbleGraphViewer::RumbleGraphViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::RumbleGraphViewer),
|
||||
mEntryCount(),
|
||||
mRumbleGraphFile(nullptr) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->tableWidget_Entries->setColumnCount(2);
|
||||
ui->tableWidget_Entries->setHorizontalHeaderLabels({ "X", "Y" });
|
||||
ui->tableWidget_Entries->setRowCount(0);
|
||||
ui->tableWidget_Entries->setColumnWidth(0, 200);
|
||||
ui->tableWidget_Entries->horizontalHeader()->setStretchLastSection(true);
|
||||
}
|
||||
|
||||
RumbleGraphViewer::~RumbleGraphViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RumbleGraphViewer::SetRumbleGraphFile(const std::shared_ptr<RawFile> aRawFile) {
|
||||
mRumbleGraphFile = aRawFile;
|
||||
|
||||
QDataStream rawFileStream(mRumbleGraphFile->contents.toLatin1());
|
||||
|
||||
QByteArray magic(15, Qt::Uninitialized);
|
||||
rawFileStream.readRawData(magic.data(), 15);
|
||||
|
||||
rawFileStream.skipRawData(4);
|
||||
|
||||
char sectionChar;
|
||||
rawFileStream >> sectionChar;
|
||||
int sectionCount = sectionChar - '0';
|
||||
ui->tableWidget_Entries->setRowCount(sectionCount);
|
||||
ui->spinBox_Entries->setValue(sectionCount);
|
||||
ui->groupBox_LocalStrViewer->setTitle(QString("Entries (%1)").arg(sectionCount));
|
||||
|
||||
rawFileStream.skipRawData(2);
|
||||
|
||||
for (int i = 0; i < sectionCount; i++) {
|
||||
QByteArray xVal(6, Qt::Uninitialized), yVal(6, Qt::Uninitialized);
|
||||
rawFileStream.readRawData(xVal.data(), 6);
|
||||
rawFileStream.skipRawData(1);
|
||||
rawFileStream.readRawData(yVal.data(), 6);
|
||||
rawFileStream.skipRawData(2);
|
||||
|
||||
QTableWidgetItem *xItem = new QTableWidgetItem(xVal);
|
||||
QTableWidgetItem *yItem = new QTableWidgetItem(yVal);
|
||||
|
||||
ui->tableWidget_Entries->setItem(i, 0, xItem);
|
||||
ui->tableWidget_Entries->setItem(i, 1, yItem);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
#ifndef RUMBLEGRAPHVIEWER_H
|
||||
#define RUMBLEGRAPHVIEWER_H
|
||||
|
||||
#include "xrawfile.h"
|
||||
#include "zonefile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class RumbleGraphViewer;
|
||||
}
|
||||
|
||||
class RumbleGraphViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RumbleGraphViewer(QWidget *parent = nullptr);
|
||||
~RumbleGraphViewer();
|
||||
|
||||
void SetEntryCount(quint32 aCount);
|
||||
void SetRumbleGraphFile(const XRawFile *aRawFile);
|
||||
void SetZoneFile(ZoneFile* aZoneFile);
|
||||
|
||||
private:
|
||||
Ui::RumbleGraphViewer *ui;
|
||||
quint32 mEntryCount;
|
||||
const XRawFile* mRumbleGraphFile;
|
||||
};
|
||||
|
||||
#endif // RUMBLEGRAPHVIEWER_H
|
||||
#ifndef RUMBLEGRAPHVIEWER_H
|
||||
#define RUMBLEGRAPHVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
#include "zonefile.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class RumbleGraphViewer;
|
||||
}
|
||||
|
||||
class RumbleGraphViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RumbleGraphViewer(QWidget *parent = nullptr);
|
||||
~RumbleGraphViewer();
|
||||
|
||||
void SetEntryCount(quint32 aCount);
|
||||
void SetRumbleGraphFile(const std::shared_ptr<RawFile> aRawFile);
|
||||
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
|
||||
|
||||
private:
|
||||
Ui::RumbleGraphViewer *ui;
|
||||
quint32 mEntryCount;
|
||||
std::shared_ptr<RawFile> mRumbleGraphFile;
|
||||
};
|
||||
|
||||
#endif // RUMBLEGRAPHVIEWER_H
|
||||
|
||||
@ -1,153 +1,153 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RumbleGraphViewer</class>
|
||||
<widget class="QWidget" name="RumbleGraphViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rumble Graph File </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Entry Count: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="spinBox_Entries">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_LocalStrViewer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Entries</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Entries">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RumbleGraphViewer</class>
|
||||
<widget class="QWidget" name="RumbleGraphViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>841</width>
|
||||
<height>457</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rumble Graph File </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>398</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>325</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Entry Count: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QSpinBox" name="spinBox_Entries">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_LocalStrViewer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Entries</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Entries">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,80 +1,80 @@
|
||||
#include "soundviewer.h"
|
||||
#include "ui_soundviewer.h"
|
||||
|
||||
SoundViewer::SoundViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::SoundViewer)
|
||||
, player(new QMediaPlayer())
|
||||
, buffer(new QBuffer())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->pushButton_Play, &QPushButton::clicked, player, &QMediaPlayer::play);
|
||||
connect(ui->pushButton_Pause, &QPushButton::clicked, player, &QMediaPlayer::pause);
|
||||
connect(ui->pushButton_Stop, &QPushButton::clicked, this, [this]() {
|
||||
if (player->isPlaying()) {
|
||||
player->stop();
|
||||
}
|
||||
});
|
||||
connect(ui->pushButton_SkipForward, &QPushButton::clicked, this, [this]() {
|
||||
player->setPosition(player->position() + 30);
|
||||
});
|
||||
connect(ui->pushButton_SkipBack, &QPushButton::clicked, this, [this]() {
|
||||
player->setPosition(player->position() - 30);
|
||||
});
|
||||
connect(player, &QMediaPlayer::positionChanged, player, [this](qint64 position) {
|
||||
ui->horizontalSlider->setSliderPosition(position);
|
||||
ui->label_Time->setText(QString("%1:%2:%3")
|
||||
.arg(position / 60000)
|
||||
.arg((position % 60000) / 1000)
|
||||
.arg(position % 1000));
|
||||
});
|
||||
connect(player, &QMediaPlayer::durationChanged, player, [this](qint64 duration) {
|
||||
ui->horizontalSlider->setMaximum(duration);
|
||||
ui->label_TimeMax->setText(QString("%1:%2:%3")
|
||||
.arg(duration / 60000)
|
||||
.arg((duration % 60000) / 1000)
|
||||
.arg(duration % 1000));
|
||||
});
|
||||
connect(ui->horizontalSlider, &QSlider::sliderMoved, this, [this](int position) {
|
||||
player->setPosition(position);
|
||||
});
|
||||
|
||||
for (auto outputDevice : QMediaDevices::audioOutputs()) {
|
||||
ui->comboBox_Output->addItem(outputDevice.description());
|
||||
}
|
||||
connect(ui->comboBox_Output, &QComboBox::currentIndexChanged, this, [this](int index) {
|
||||
auto outputDevice = QMediaDevices::audioOutputs()[index];
|
||||
QAudioOutput *audioOutput = new QAudioOutput(outputDevice);
|
||||
player->setAudioOutput(audioOutput);
|
||||
});
|
||||
|
||||
auto outputDevice = QMediaDevices::defaultAudioOutput();
|
||||
QAudioOutput *audioOutput = new QAudioOutput(outputDevice);
|
||||
player->setAudioOutput(audioOutput);
|
||||
}
|
||||
|
||||
SoundViewer::~SoundViewer()
|
||||
{
|
||||
delete buffer;
|
||||
delete player;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
// void SoundViewer::SetSound(std::shared_ptr<Sound> aSound)
|
||||
// {
|
||||
// buffer->setData(aSound->data);
|
||||
// if (!buffer->open(QIODevice::ReadOnly)) {
|
||||
// qWarning() << "Failed to open QBuffer.";
|
||||
// return;
|
||||
// }
|
||||
|
||||
// ui->groupBox->setTitle(aSound->path);
|
||||
// player->setSourceDevice(buffer);
|
||||
// }
|
||||
|
||||
void SoundViewer::SetOutput(QAudioOutput *aOutput) {
|
||||
if (!aOutput) { return; }
|
||||
|
||||
player->setAudioOutput(aOutput);
|
||||
}
|
||||
#include "soundviewer.h"
|
||||
#include "ui_soundviewer.h"
|
||||
|
||||
SoundViewer::SoundViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::SoundViewer)
|
||||
, player(new QMediaPlayer())
|
||||
, buffer(new QBuffer())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->pushButton_Play, &QPushButton::clicked, player, &QMediaPlayer::play);
|
||||
connect(ui->pushButton_Pause, &QPushButton::clicked, player, &QMediaPlayer::pause);
|
||||
connect(ui->pushButton_Stop, &QPushButton::clicked, this, [this]() {
|
||||
if (player->isPlaying()) {
|
||||
player->stop();
|
||||
}
|
||||
});
|
||||
connect(ui->pushButton_SkipForward, &QPushButton::clicked, this, [this]() {
|
||||
player->setPosition(player->position() + 30);
|
||||
});
|
||||
connect(ui->pushButton_SkipBack, &QPushButton::clicked, this, [this]() {
|
||||
player->setPosition(player->position() - 30);
|
||||
});
|
||||
connect(player, &QMediaPlayer::positionChanged, player, [this](qint64 position) {
|
||||
ui->horizontalSlider->setSliderPosition(position);
|
||||
ui->label_Time->setText(QString("%1:%2:%3")
|
||||
.arg(position / 60000)
|
||||
.arg((position % 60000) / 1000)
|
||||
.arg(position % 1000));
|
||||
});
|
||||
connect(player, &QMediaPlayer::durationChanged, player, [this](qint64 duration) {
|
||||
ui->horizontalSlider->setMaximum(duration);
|
||||
ui->label_TimeMax->setText(QString("%1:%2:%3")
|
||||
.arg(duration / 60000)
|
||||
.arg((duration % 60000) / 1000)
|
||||
.arg(duration % 1000));
|
||||
});
|
||||
connect(ui->horizontalSlider, &QSlider::sliderMoved, this, [this](int position) {
|
||||
player->setPosition(position);
|
||||
});
|
||||
|
||||
for (auto outputDevice : QMediaDevices::audioOutputs()) {
|
||||
ui->comboBox_Output->addItem(outputDevice.description());
|
||||
}
|
||||
connect(ui->comboBox_Output, &QComboBox::currentIndexChanged, this, [this](int index) {
|
||||
auto outputDevice = QMediaDevices::audioOutputs()[index];
|
||||
QAudioOutput *audioOutput = new QAudioOutput(outputDevice);
|
||||
player->setAudioOutput(audioOutput);
|
||||
});
|
||||
|
||||
auto outputDevice = QMediaDevices::defaultAudioOutput();
|
||||
QAudioOutput *audioOutput = new QAudioOutput(outputDevice);
|
||||
player->setAudioOutput(audioOutput);
|
||||
}
|
||||
|
||||
SoundViewer::~SoundViewer()
|
||||
{
|
||||
delete buffer;
|
||||
delete player;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SoundViewer::SetSound(std::shared_ptr<Sound> aSound)
|
||||
{
|
||||
buffer->setData(aSound->data);
|
||||
if (!buffer->open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Failed to open QBuffer.";
|
||||
return;
|
||||
}
|
||||
|
||||
ui->groupBox->setTitle(aSound->path);
|
||||
player->setSourceDevice(buffer);
|
||||
}
|
||||
|
||||
void SoundViewer::SetOutput(QAudioOutput *aOutput) {
|
||||
if (!aOutput) { return; }
|
||||
|
||||
player->setAudioOutput(aOutput);
|
||||
}
|
||||
|
||||
@ -1,32 +1,34 @@
|
||||
#ifndef SOUNDVIEWER_H
|
||||
#define SOUNDVIEWER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMediaPlayer>
|
||||
#include <QBuffer>
|
||||
#include <QAudioDevice>
|
||||
#include <QMediaDevices>
|
||||
#include <QAudioOutput>
|
||||
|
||||
namespace Ui {
|
||||
class SoundViewer;
|
||||
}
|
||||
|
||||
class SoundViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SoundViewer(QWidget *parent = nullptr);
|
||||
~SoundViewer();
|
||||
|
||||
//void SetSound(std::shared_ptr<Sound> aSound);
|
||||
|
||||
void SetOutput(QAudioOutput *aOutput);
|
||||
private:
|
||||
Ui::SoundViewer *ui;
|
||||
QMediaPlayer *player;
|
||||
QBuffer *buffer;
|
||||
};
|
||||
|
||||
#endif // SOUNDVIEWER_H
|
||||
#ifndef SOUNDVIEWER_H
|
||||
#define SOUNDVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMediaPlayer>
|
||||
#include <QBuffer>
|
||||
#include <QAudioDevice>
|
||||
#include <QMediaDevices>
|
||||
#include <QAudioOutput>
|
||||
|
||||
namespace Ui {
|
||||
class SoundViewer;
|
||||
}
|
||||
|
||||
class SoundViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SoundViewer(QWidget *parent = nullptr);
|
||||
~SoundViewer();
|
||||
|
||||
void SetSound(std::shared_ptr<Sound> aSound);
|
||||
|
||||
void SetOutput(QAudioOutput *aOutput);
|
||||
private:
|
||||
Ui::SoundViewer *ui;
|
||||
QMediaPlayer *player;
|
||||
QBuffer *buffer;
|
||||
};
|
||||
|
||||
#endif // SOUNDVIEWER_H
|
||||
|
||||
5146
app/soundviewer.ui
5146
app/soundviewer.ui
File diff suppressed because it is too large
Load Diff
@ -1,35 +1,36 @@
|
||||
#include "stringtableviewer.h"
|
||||
#include "ui_stringtableviewer.h"
|
||||
|
||||
StringTableViewer::StringTableViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::StringTableViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
StringTableViewer::~StringTableViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void StringTableViewer::SetStringTable(const XStringTable *aStringTable) {
|
||||
ui->tableWidget_Strings->clear();
|
||||
|
||||
ui->tableWidget_Strings->setRowCount(aStringTable->GetRowCount());
|
||||
ui->tableWidget_Strings->setColumnCount(aStringTable->GetColumnCount());
|
||||
|
||||
int currentIndex = 0;
|
||||
for (auto value : *aStringTable->GetValues()) {
|
||||
|
||||
QTableWidgetItem *tableKeyItem = new QTableWidgetItem();
|
||||
tableKeyItem->setText(value->GetName());
|
||||
ui->tableWidget_Strings->setItem(currentIndex, 0, tableKeyItem);
|
||||
|
||||
QTableWidgetItem *tableValItem = new QTableWidgetItem();
|
||||
tableValItem->setText(value->GetString());
|
||||
ui->tableWidget_Strings->setItem(currentIndex, 1, tableValItem);
|
||||
|
||||
currentIndex++;
|
||||
}
|
||||
}
|
||||
#include "stringtableviewer.h"
|
||||
#include "ui_stringtableviewer.h"
|
||||
|
||||
StringTableViewer::StringTableViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::StringTableViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
StringTableViewer::~StringTableViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void StringTableViewer::SetStringTable(std::shared_ptr<StringTable> aStringTable) {
|
||||
ui->tableWidget_Strings->clear();
|
||||
|
||||
ui->tableWidget_Strings->setRowCount(aStringTable->rowCount);
|
||||
ui->tableWidget_Strings->setColumnCount(aStringTable->columnCount);
|
||||
|
||||
int currentIndex = 0;
|
||||
for (const QString &key : aStringTable->content.keys()) {
|
||||
const QString value = aStringTable->content[key];
|
||||
|
||||
QTableWidgetItem *tableKeyItem = new QTableWidgetItem();
|
||||
tableKeyItem->setText(key);
|
||||
ui->tableWidget_Strings->setItem(currentIndex, 0, tableKeyItem);
|
||||
|
||||
QTableWidgetItem *tableValItem = new QTableWidgetItem();
|
||||
tableValItem->setText(value);
|
||||
ui->tableWidget_Strings->setItem(currentIndex, 1, tableValItem);
|
||||
|
||||
currentIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,26 +1,25 @@
|
||||
#ifndef STRINGTABLEVIEWER_H
|
||||
#define STRINGTABLEVIEWER_H
|
||||
|
||||
#include "xstringtable.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class StringTableViewer;
|
||||
}
|
||||
|
||||
class StringTableViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StringTableViewer(QWidget *parent = nullptr);
|
||||
~StringTableViewer();
|
||||
|
||||
void SetStringTable(const XStringTable *aStringTable);
|
||||
|
||||
private:
|
||||
Ui::StringTableViewer *ui;
|
||||
};
|
||||
|
||||
#endif // STRINGTABLEVIEWER_H
|
||||
#ifndef STRINGTABLEVIEWER_H
|
||||
#define STRINGTABLEVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class StringTableViewer;
|
||||
}
|
||||
|
||||
class StringTableViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StringTableViewer(QWidget *parent = nullptr);
|
||||
~StringTableViewer();
|
||||
|
||||
void SetStringTable(std::shared_ptr<StringTable> aStringTable);
|
||||
|
||||
private:
|
||||
Ui::StringTableViewer *ui;
|
||||
};
|
||||
|
||||
#endif // STRINGTABLEVIEWER_H
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StringTableViewer</class>
|
||||
<widget class="QWidget" name="StringTableViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>525</width>
|
||||
<height>752</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Strings"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StringTableViewer</class>
|
||||
<widget class="QWidget" name="StringTableViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>525</width>
|
||||
<height>752</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget_Strings"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
#include "techsetviewer.h"
|
||||
#include "ui_techsetviewer.h"
|
||||
|
||||
TechSetViewer::TechSetViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::TechSetViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
TechSetViewer::~TechSetViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TechSetViewer::SetTechSet(const XMaterialTechniqueSet* aTechSet) {
|
||||
//ui->listWidget_Ptrs->clear();
|
||||
ui->label_Title->setText(aTechSet->GetName());
|
||||
|
||||
// int ptrIndex = 1;
|
||||
//for (auto ptr : aTechSet->pointers) {
|
||||
// ui->listWidget_Ptrs->addItem(QString("Pointer %1: %2").arg(ptrIndex).arg(ptr));
|
||||
// ptrIndex++;
|
||||
//}
|
||||
}
|
||||
#include "techsetviewer.h"
|
||||
#include "ui_techsetviewer.h"
|
||||
|
||||
TechSetViewer::TechSetViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::TechSetViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
TechSetViewer::~TechSetViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TechSetViewer::SetTechSet(std::shared_ptr<TechSet> aTechSet) {
|
||||
ui->listWidget_Ptrs->clear();
|
||||
ui->label_Title->setText(aTechSet->name);
|
||||
|
||||
int ptrIndex = 1;
|
||||
for (auto ptr : aTechSet->pointers) {
|
||||
ui->listWidget_Ptrs->addItem(QString("Pointer %1: %2").arg(ptrIndex).arg(ptr));
|
||||
ptrIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,26 +1,25 @@
|
||||
#ifndef TECHSETVIEWER_H
|
||||
#define TECHSETVIEWER_H
|
||||
|
||||
#include "xmaterialtechniqueset.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class TechSetViewer;
|
||||
}
|
||||
|
||||
class TechSetViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TechSetViewer(QWidget *parent = nullptr);
|
||||
~TechSetViewer();
|
||||
|
||||
void SetTechSet(const XMaterialTechniqueSet *aTechSet);
|
||||
|
||||
private:
|
||||
Ui::TechSetViewer *ui;
|
||||
};
|
||||
|
||||
#endif // TECHSETVIEWER_H
|
||||
#ifndef TECHSETVIEWER_H
|
||||
#define TECHSETVIEWER_H
|
||||
|
||||
#include "asset_structs.h"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class TechSetViewer;
|
||||
}
|
||||
|
||||
class TechSetViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TechSetViewer(QWidget *parent = nullptr);
|
||||
~TechSetViewer();
|
||||
|
||||
void SetTechSet(std::shared_ptr<TechSet> aTechSet);
|
||||
|
||||
private:
|
||||
Ui::TechSetViewer *ui;
|
||||
};
|
||||
|
||||
#endif // TECHSETVIEWER_H
|
||||
|
||||
@ -1,151 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TechSetViewer</class>
|
||||
<widget class="QWidget" name="TechSetViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>880</width>
|
||||
<height>559</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Technique Set 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Set Parameters</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Name">
|
||||
<property name="placeholderText">
|
||||
<string>Technique set name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>World Vertex Format:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_WorldVertFormat"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_Techniques"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Current Technique</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_TechniqueName">
|
||||
<property name="placeholderText">
|
||||
<string>Technique set name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Flags:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_Flags"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Pass Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_PassCount"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Material Pass</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TechSetViewer</class>
|
||||
<widget class="QWidget" name="TechSetViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>961</width>
|
||||
<height>756</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Technique Set 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Unknown Pointers:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_Ptrs"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>363</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
1647
app/xtreewidget.cpp
1647
app/xtreewidget.cpp
File diff suppressed because it is too large
Load Diff
@ -1,67 +1,64 @@
|
||||
#ifndef XTREEWIDGET_H
|
||||
#define XTREEWIDGET_H
|
||||
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "ddsfile.h"
|
||||
#include "iwifile.h"
|
||||
#include "fastfile.h"
|
||||
#include "xloadedsound.h"
|
||||
#include "xtreewidgetitem.h"
|
||||
#include "zonefile.h"
|
||||
#include "xrawfile.h"
|
||||
#include "xgfximage.h"
|
||||
#include "xstringtable.h"
|
||||
#include "xmenudef.h"
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QFileDialog>
|
||||
|
||||
class XTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit XTreeWidget(QWidget *parent = nullptr);
|
||||
~XTreeWidget();
|
||||
|
||||
void AddFastFile(FastFile* aFastFile);
|
||||
void AddZoneFile(const ZoneFile *aZoneFile, XTreeWidgetItem *aParentItem = nullptr);
|
||||
void AddIWIFile(IWIFile* aIWIFile);
|
||||
void AddDDSFile(DDSFile* aDDSFile);
|
||||
|
||||
const ZoneFile *FindZoneFile(const QString aStem);
|
||||
const FastFile* FindFastFile(const QString aStem);
|
||||
|
||||
bool HasZoneFile(const QString aStem);
|
||||
bool HasFastFile(const QString aStem);
|
||||
|
||||
void CloseFastFile(const QString aFFName);
|
||||
signals:
|
||||
void DDSFileSelected(const DDSFile* aDDSFile, const QString aParentName);
|
||||
void IWIFileSelected(const IWIFile* aIWIFile, const QString aParentName);
|
||||
void FastFileSelected(const FastFile* aFastFile, const QString aParentName);
|
||||
void ZoneFileSelected(const ZoneFile* aZoneFile, const QString aParentName);
|
||||
void LocalStringSelected(const ZoneFile* aZoneFile, const QString aParentName);
|
||||
void RawFileSelected(const XRawFile* aRawFile, const QString aParentName);
|
||||
void ImageSelected(const XGfxImage* aImage, const QString aParentName);
|
||||
void TechSetSelected(const XMaterialTechniqueSet* aZoneFile, const QString aParentName);
|
||||
void StrTableSelected(const XStringTable* aStrTable, const QString aParentName);
|
||||
void MenuSelected(const XMenuDef* aMenu, const QString aParentName);
|
||||
void SoundSelected(const XLoadedSound* aSound, const QString aParentName);
|
||||
void MaterialSelected(const XMaterial* aMaterial, const QString aParentName);
|
||||
void ItemSelected(const QString itemText);
|
||||
|
||||
void ItemClosed(const QString itemText);
|
||||
void Cleared();
|
||||
|
||||
protected:
|
||||
void ItemSelectionChanged();
|
||||
void PrepareContextMenu(const QPoint &pos);
|
||||
|
||||
private:
|
||||
QMap<QString, const FastFile*> mFastFiles;
|
||||
QMap<QString, const ZoneFile*> mZoneFiles;
|
||||
QMap<QString, const DDSFile*> mDDSFiles;
|
||||
QMap<QString, const IWIFile*> mIWIFiles;
|
||||
};
|
||||
|
||||
#endif // XTREEWIDGET_H
|
||||
#ifndef XTREEWIDGET_H
|
||||
#define XTREEWIDGET_H
|
||||
|
||||
#include "d3dbsp_structs.h"
|
||||
#include "asset_structs.h"
|
||||
#include "ddsfile.h"
|
||||
#include "iwifile.h"
|
||||
#include "fastfile.h"
|
||||
#include "xtreewidgetitem.h"
|
||||
#include "zonefile.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QFileDialog>
|
||||
|
||||
class XTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit XTreeWidget(QWidget *parent = nullptr);
|
||||
~XTreeWidget();
|
||||
|
||||
void AddFastFile(std::shared_ptr<FastFile> aFastFile);
|
||||
void AddZoneFile(std::shared_ptr<ZoneFile> aZoneFile, XTreeWidgetItem *aParentItem = nullptr);
|
||||
void AddIWIFile(std::shared_ptr<IWIFile> aIWIFile);
|
||||
void AddDDSFile(std::shared_ptr<DDSFile> aDDSFile);
|
||||
|
||||
std::shared_ptr<ZoneFile> FindZoneFile(const QString aStem);
|
||||
std::shared_ptr<FastFile> FindFastFile(const QString aStem);
|
||||
|
||||
bool HasZoneFile(const QString aStem);
|
||||
bool HasFastFile(const QString aStem);
|
||||
|
||||
void CloseFastFile(const QString aFFName);
|
||||
signals:
|
||||
void DDSFileSelected(std::shared_ptr<DDSFile> aDDSFile, const QString aParentName);
|
||||
void IWIFileSelected(std::shared_ptr<IWIFile> aIWIFile, const QString aParentName);
|
||||
void FastFileSelected(std::shared_ptr<FastFile> aFastFile, const QString aParentName);
|
||||
void ZoneFileSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
|
||||
void LocalStringSelected(std::shared_ptr<ZoneFile> aZoneFile, const QString aParentName);
|
||||
void RawFileSelected(std::shared_ptr<RawFile> aRawFile, const QString aParentName);
|
||||
void ImageSelected(std::shared_ptr<Image> aImage, const QString aParentName);
|
||||
void TechSetSelected(std::shared_ptr<TechSet> aZoneFile, const QString aParentName);
|
||||
void StrTableSelected(std::shared_ptr<StringTable> aStrTable, const QString aParentName);
|
||||
void MenuSelected(std::shared_ptr<Menu> aMenu, const QString aParentName);
|
||||
void SoundSelected(std::shared_ptr<Sound> aSound, const QString aParentName);
|
||||
void MaterialSelected(std::shared_ptr<Material> aMaterial, const QString aParentName);
|
||||
void ItemSelected(const QString itemText);
|
||||
|
||||
void ItemClosed(const QString itemText);
|
||||
void Cleared();
|
||||
|
||||
protected:
|
||||
void ItemSelectionChanged();
|
||||
void PrepareContextMenu(const QPoint &pos);
|
||||
|
||||
private:
|
||||
QMap<QString, std::shared_ptr<FastFile>> mFastFiles;
|
||||
QMap<QString, std::shared_ptr<ZoneFile>> mZoneFiles;
|
||||
QMap<QString, std::shared_ptr<DDSFile>> mDDSFiles;
|
||||
QMap<QString, std::shared_ptr<IWIFile>> mIWIFiles;
|
||||
};
|
||||
|
||||
#endif // XTREEWIDGET_H
|
||||
|
||||
@ -1,56 +1,56 @@
|
||||
#include "xtreewidgetitem.h"
|
||||
|
||||
XTreeWidgetItem::XTreeWidgetItem(QTreeWidget *parent, bool group)
|
||||
: QTreeWidgetItem(parent)
|
||||
, isGroup(group)
|
||||
, mCategory(CATEGORY_NONE) {
|
||||
|
||||
}
|
||||
|
||||
XTreeWidgetItem::XTreeWidgetItem(QTreeWidgetItem *parent, bool group)
|
||||
: QTreeWidgetItem(parent)
|
||||
, isGroup(group)
|
||||
, mCategory(CATEGORY_NONE) {
|
||||
|
||||
}
|
||||
|
||||
void XTreeWidgetItem::SetCategory(TREE_CATEGORY category)
|
||||
{
|
||||
mCategory = category;
|
||||
}
|
||||
|
||||
TREE_CATEGORY XTreeWidgetItem::GetCategory()
|
||||
{
|
||||
return mCategory;
|
||||
}
|
||||
|
||||
bool XTreeWidgetItem::operator<(const QTreeWidgetItem &other) const {
|
||||
// Attempt to cast the other item to our custom type.
|
||||
const XTreeWidgetItem* otherItem = dynamic_cast<const XTreeWidgetItem*>(&other);
|
||||
if (otherItem) {
|
||||
bool thisIsGroup = this->childCount() > 0;
|
||||
bool otherIsGroup = otherItem->childCount() > 0;
|
||||
|
||||
if (thisIsGroup != otherIsGroup) {
|
||||
return otherIsGroup; // Groups should come before non-groups
|
||||
}
|
||||
}
|
||||
// Fallback to the default string comparison on the current sort column.
|
||||
return QTreeWidgetItem::operator<(other);
|
||||
}
|
||||
|
||||
|
||||
XTreeWidgetItem& XTreeWidgetItem::operator=(const XTreeWidgetItem &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
// Copy text and icon for each column.
|
||||
const int colCount = other.columnCount();
|
||||
for (int i = 0; i < colCount; ++i) {
|
||||
setText(i, other.text(i));
|
||||
setIcon(i, other.icon(i));
|
||||
}
|
||||
// Copy custom members.
|
||||
this->isGroup = other.isGroup;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#include "xtreewidgetitem.h"
|
||||
|
||||
XTreeWidgetItem::XTreeWidgetItem(QTreeWidget *parent, bool group)
|
||||
: QTreeWidgetItem(parent)
|
||||
, isGroup(group)
|
||||
, mCategory(CATEGORY_NONE) {
|
||||
|
||||
}
|
||||
|
||||
XTreeWidgetItem::XTreeWidgetItem(QTreeWidgetItem *parent, bool group)
|
||||
: QTreeWidgetItem(parent)
|
||||
, isGroup(group)
|
||||
, mCategory(CATEGORY_NONE) {
|
||||
|
||||
}
|
||||
|
||||
void XTreeWidgetItem::SetCategory(TREE_CATEGORY category)
|
||||
{
|
||||
mCategory = category;
|
||||
}
|
||||
|
||||
TREE_CATEGORY XTreeWidgetItem::GetCategory()
|
||||
{
|
||||
return mCategory;
|
||||
}
|
||||
|
||||
bool XTreeWidgetItem::operator<(const QTreeWidgetItem &other) const {
|
||||
// Attempt to cast the other item to our custom type.
|
||||
const XTreeWidgetItem* otherItem = dynamic_cast<const XTreeWidgetItem*>(&other);
|
||||
if (otherItem) {
|
||||
bool thisIsGroup = this->childCount() > 0;
|
||||
bool otherIsGroup = otherItem->childCount() > 0;
|
||||
|
||||
if (thisIsGroup != otherIsGroup) {
|
||||
return otherIsGroup; // Groups should come before non-groups
|
||||
}
|
||||
}
|
||||
// Fallback to the default string comparison on the current sort column.
|
||||
return QTreeWidgetItem::operator<(other);
|
||||
}
|
||||
|
||||
|
||||
XTreeWidgetItem& XTreeWidgetItem::operator=(const XTreeWidgetItem &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
// Copy text and icon for each column.
|
||||
const int colCount = other.columnCount();
|
||||
for (int i = 0; i < colCount; ++i) {
|
||||
setText(i, other.text(i));
|
||||
setIcon(i, other.icon(i));
|
||||
}
|
||||
// Copy custom members.
|
||||
this->isGroup = other.isGroup;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1,36 +1,36 @@
|
||||
#ifndef XTREEWIDGETITEM_H
|
||||
#define XTREEWIDGETITEM_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
enum TREE_CATEGORY {
|
||||
CATEGORY_NONE = 0x00,
|
||||
CATEGORY_FILE = 0x01,
|
||||
CATEGORY_TYPE = 0x02
|
||||
};
|
||||
|
||||
// Custom item class
|
||||
class XTreeWidgetItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
// Flag to indicate if the item is a collapsible group/header.
|
||||
bool isGroup;
|
||||
|
||||
// Constructors: default to non-group unless specified.
|
||||
XTreeWidgetItem(QTreeWidget *parent, bool group = false);
|
||||
XTreeWidgetItem(QTreeWidgetItem *parent, bool group = false);
|
||||
|
||||
void SetCategory(TREE_CATEGORY category);
|
||||
TREE_CATEGORY GetCategory();
|
||||
|
||||
// Override the less-than operator to customize sorting.
|
||||
bool operator<(const QTreeWidgetItem &other) const override;
|
||||
XTreeWidgetItem &operator =(const XTreeWidgetItem &other);
|
||||
|
||||
private:
|
||||
TREE_CATEGORY mCategory;
|
||||
};
|
||||
|
||||
|
||||
#endif // XTREEWIDGETITEM_H
|
||||
#ifndef XTREEWIDGETITEM_H
|
||||
#define XTREEWIDGETITEM_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
enum TREE_CATEGORY {
|
||||
CATEGORY_NONE = 0x00,
|
||||
CATEGORY_FILE = 0x01,
|
||||
CATEGORY_TYPE = 0x02
|
||||
};
|
||||
|
||||
// Custom item class
|
||||
class XTreeWidgetItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
// Flag to indicate if the item is a collapsible group/header.
|
||||
bool isGroup;
|
||||
|
||||
// Constructors: default to non-group unless specified.
|
||||
XTreeWidgetItem(QTreeWidget *parent, bool group = false);
|
||||
XTreeWidgetItem(QTreeWidgetItem *parent, bool group = false);
|
||||
|
||||
void SetCategory(TREE_CATEGORY category);
|
||||
TREE_CATEGORY GetCategory();
|
||||
|
||||
// Override the less-than operator to customize sorting.
|
||||
bool operator<(const QTreeWidgetItem &other) const override;
|
||||
XTreeWidgetItem &operator =(const XTreeWidgetItem &other);
|
||||
|
||||
private:
|
||||
TREE_CATEGORY mCategory;
|
||||
};
|
||||
|
||||
|
||||
#endif // XTREEWIDGETITEM_H
|
||||
|
||||
@ -1,156 +1,158 @@
|
||||
#include "zonefileviewer.h"
|
||||
#include "ui_zonefileviewer.h"
|
||||
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
ZoneFileViewer::ZoneFileViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::ZoneFileViewer) {
|
||||
ui->setupUi(this);
|
||||
|
||||
mZoneFile = nullptr;
|
||||
|
||||
ui->tableWidget_RecordCounts->setColumnCount(3);
|
||||
ui->tableWidget_RecordCounts->setHorizontalHeaderLabels({ "Identifier", "Asset", "Count" });
|
||||
ui->tableWidget_RecordCounts->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
ui->tableWidget_RecordOrder->setColumnCount(3);
|
||||
ui->tableWidget_RecordOrder->setHorizontalHeaderLabels({ "Identifier", "Asset", "Count" });
|
||||
ui->tableWidget_RecordOrder->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
connect(ui->lineEdit_TagSearch, &QLineEdit::textChanged, this, &ZoneFileViewer::SortTags);
|
||||
connect(ui->tableWidget_RecordCounts, &QTableWidget::itemSelectionChanged, this, &ZoneFileViewer::HighlightRecordInOrder);
|
||||
connect(ui->listWidget_Tags, &QListWidget::currentTextChanged, this, [this](const QString &aCurrentText) {
|
||||
StatusBarManager::instance().updateStatus(QString("Selected tag '%1' with index %2").arg(aCurrentText).arg(mZoneFile->GetTags().indexOf(aCurrentText)));
|
||||
});
|
||||
}
|
||||
|
||||
ZoneFileViewer::~ZoneFileViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ZoneFileViewer::HighlightRecordInOrder() {
|
||||
ui->tableWidget_RecordOrder->clearSelection();
|
||||
|
||||
foreach (auto selectedItem, ui->tableWidget_RecordCounts->selectedItems()) {
|
||||
int selectedRow = selectedItem->row();
|
||||
const QString assetId = ui->tableWidget_RecordCounts->item(selectedRow, 0)->text();
|
||||
|
||||
for (int i = 0; i < ui->tableWidget_RecordOrder->rowCount(); i++) {
|
||||
const QString testAssetId = ui->tableWidget_RecordOrder->item(i, 0)->text();
|
||||
if (testAssetId != assetId) { continue; }
|
||||
|
||||
ui->tableWidget_RecordOrder->selectRow(i);
|
||||
ui->tableWidget_RecordOrder->item(i, 0)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 1)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 2)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 3)->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneFileViewer::SortTags(const QString &aSearchText) {
|
||||
ui->listWidget_Tags->clear();
|
||||
|
||||
const QStringList tags = mZoneFile->GetTags();
|
||||
if (aSearchText.isEmpty()) {
|
||||
ui->listWidget_Tags->addItems(tags);
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList sortedTags;
|
||||
foreach (const QString tag, tags) {
|
||||
if (tag.contains(aSearchText)) {
|
||||
sortedTags << tag;
|
||||
}
|
||||
}
|
||||
|
||||
StatusBarManager::instance().updateStatus(QString("Found %1 tags.").arg(sortedTags.size()));
|
||||
ui->listWidget_Tags->addItems(sortedTags);
|
||||
}
|
||||
|
||||
void ZoneFileViewer::SetZoneFile(const ZoneFile* aZoneFile) {
|
||||
mZoneFile = aZoneFile;
|
||||
|
||||
ui->tableWidget_RecordCounts->clearContents();
|
||||
ui->tableWidget_RecordOrder->clearContents();
|
||||
ui->listWidget_Tags->clear();
|
||||
|
||||
const QStringList tags = mZoneFile->GetTags();
|
||||
ui->listWidget_Tags->addItems(tags);
|
||||
ui->label_Title->setText(mZoneFile->GetBaseStem() + ".zone");
|
||||
|
||||
ui->groupBox_Tags->setTitle(QString("Tags (%1)").arg(tags.size()));
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
ui->groupBox_Tags->hide();
|
||||
} else {
|
||||
ui->groupBox_Tags->show();
|
||||
}
|
||||
|
||||
QMap<XAssetType, int> recordCounts = QMap<XAssetType, int>();
|
||||
QVector<QPair<XAssetType, int>> assetOccurances = QVector<QPair<XAssetType, int>>();
|
||||
for (XAssetType type : mZoneFile->GetTypes()) {
|
||||
if (!recordCounts.contains(type)) {
|
||||
recordCounts[type] = 0;
|
||||
}
|
||||
recordCounts[type]++;
|
||||
|
||||
if (!assetOccurances.isEmpty() && assetOccurances.last().first == type) {
|
||||
assetOccurances.last().second++;
|
||||
continue;
|
||||
}
|
||||
|
||||
QPair<XAssetType, int> assetOccurance(type, 1);
|
||||
assetOccurances << assetOccurance;
|
||||
}
|
||||
ui->tableWidget_RecordOrder->setRowCount(assetOccurances.size());
|
||||
|
||||
int assetIndex = 0;
|
||||
foreach (auto assetOccurance, assetOccurances) {
|
||||
XAssetType assetType = assetOccurance.first;
|
||||
int assetCount = assetOccurance.second;
|
||||
|
||||
QIcon assetIcon = Utils::CreateAssetIcon(assetType);
|
||||
if (assetIcon.isNull()) {
|
||||
qDebug() << "Icon is null for record: " << assetType;
|
||||
}
|
||||
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(QString::number(assetType, 16));
|
||||
QTableWidgetItem *recordStrItem = new QTableWidgetItem(XAsset::XAssetTypeToString(assetType));
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(assetCount));
|
||||
recordItem->setIcon(assetIcon);
|
||||
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 0, recordItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 1, recordStrItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 2, recordCountItem);
|
||||
|
||||
assetIndex++;
|
||||
}
|
||||
|
||||
int recordIndex = 0;
|
||||
for (XAssetType assetType : recordCounts.keys()) {
|
||||
int recordCount = recordCounts[assetType];
|
||||
|
||||
QIcon assetIcon = Utils::CreateAssetIcon(assetType);
|
||||
if (assetIcon.isNull()) {
|
||||
qDebug() << "Icon is null for record: " << assetType;
|
||||
}
|
||||
|
||||
ui->tableWidget_RecordCounts->setRowCount(recordIndex + 1);
|
||||
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(QString::number(assetType, 16));
|
||||
QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(XAsset::XAssetTypeToString(assetType));
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(recordCount));
|
||||
recordItem->setIcon(assetIcon);
|
||||
|
||||
ui->tableWidget_RecordCounts->setItem(recordIndex, 0, recordItem);
|
||||
ui->tableWidget_RecordCounts->setItem(recordIndex, 1, recordCountStrItem);
|
||||
ui->tableWidget_RecordCounts->setItem(recordIndex, 2, recordCountItem);
|
||||
|
||||
recordIndex++;
|
||||
}
|
||||
|
||||
ui->tableWidget_RecordOrder->resizeColumnsToContents();
|
||||
ui->tableWidget_RecordCounts->resizeColumnsToContents();
|
||||
}
|
||||
#include "zonefileviewer.h"
|
||||
#include "ui_zonefileviewer.h"
|
||||
|
||||
#include "statusbarmanager.h"
|
||||
|
||||
ZoneFileViewer::ZoneFileViewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::ZoneFileViewer) {
|
||||
ui->setupUi(this);
|
||||
|
||||
mZoneFile = nullptr;
|
||||
|
||||
ui->tableWidget_RecordCounts->setColumnCount(3);
|
||||
ui->tableWidget_RecordCounts->setHorizontalHeaderLabels({ "Identifier", "Asset", "Count" });
|
||||
ui->tableWidget_RecordCounts->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
ui->tableWidget_RecordOrder->setColumnCount(3);
|
||||
ui->tableWidget_RecordOrder->setHorizontalHeaderLabels({ "Identifier", "Asset", "Count" });
|
||||
ui->tableWidget_RecordOrder->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
connect(ui->lineEdit_TagSearch, &QLineEdit::textChanged, this, &ZoneFileViewer::SortTags);
|
||||
connect(ui->tableWidget_RecordCounts, &QTableWidget::itemSelectionChanged, this, &ZoneFileViewer::HighlightRecordInOrder);
|
||||
connect(ui->listWidget_Tags, &QListWidget::currentTextChanged, this, [this](const QString &aCurrentText) {
|
||||
StatusBarManager::instance().updateStatus(QString("Selected tag '%1' with index %2").arg(aCurrentText).arg(mZoneFile->GetTags().indexOf(aCurrentText)));
|
||||
});
|
||||
}
|
||||
|
||||
ZoneFileViewer::~ZoneFileViewer() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ZoneFileViewer::HighlightRecordInOrder() {
|
||||
ui->tableWidget_RecordOrder->clearSelection();
|
||||
|
||||
foreach (auto selectedItem, ui->tableWidget_RecordCounts->selectedItems()) {
|
||||
int selectedRow = selectedItem->row();
|
||||
const QString assetId = ui->tableWidget_RecordCounts->item(selectedRow, 0)->text();
|
||||
|
||||
for (int i = 0; i < ui->tableWidget_RecordOrder->rowCount(); i++) {
|
||||
const QString testAssetId = ui->tableWidget_RecordOrder->item(i, 0)->text();
|
||||
if (testAssetId != assetId) { continue; }
|
||||
|
||||
ui->tableWidget_RecordOrder->selectRow(i);
|
||||
ui->tableWidget_RecordOrder->item(i, 0)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 1)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 2)->setSelected(true);
|
||||
ui->tableWidget_RecordOrder->item(i, 3)->setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ZoneFileViewer::SortTags(const QString &aSearchText) {
|
||||
ui->listWidget_Tags->clear();
|
||||
|
||||
const QStringList tags = mZoneFile->GetTags();
|
||||
if (aSearchText.isEmpty()) {
|
||||
ui->listWidget_Tags->addItems(tags);
|
||||
return;
|
||||
}
|
||||
|
||||
QStringList sortedTags;
|
||||
foreach (const QString tag, tags) {
|
||||
if (tag.contains(aSearchText)) {
|
||||
sortedTags << tag;
|
||||
}
|
||||
}
|
||||
|
||||
StatusBarManager::instance().updateStatus(QString("Found %1 tags.").arg(sortedTags.size()));
|
||||
ui->listWidget_Tags->addItems(sortedTags);
|
||||
}
|
||||
|
||||
void ZoneFileViewer::SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile) {
|
||||
mZoneFile = aZoneFile;
|
||||
|
||||
ui->tableWidget_RecordCounts->clearContents();
|
||||
ui->tableWidget_RecordOrder->clearContents();
|
||||
ui->listWidget_Tags->clear();
|
||||
|
||||
const QStringList tags = mZoneFile->GetTags();
|
||||
ui->listWidget_Tags->addItems(tags);
|
||||
ui->label_Title->setText(mZoneFile->GetBaseStem() + ".zone");
|
||||
|
||||
ui->groupBox_Tags->setTitle(QString("Tags (%1)").arg(tags.size()));
|
||||
|
||||
if (tags.isEmpty()) {
|
||||
ui->groupBox_Tags->hide();
|
||||
} else {
|
||||
ui->groupBox_Tags->show();
|
||||
}
|
||||
|
||||
QMap<QString, int> recordCounts = QMap<QString, int>();
|
||||
QVector<QPair<QString, int>> assetOccurances = QVector<QPair<QString, int>>();
|
||||
for (const QString &record : mZoneFile->GetRecords()) {
|
||||
if (!recordCounts.contains(record)) {
|
||||
recordCounts[record] = 0;
|
||||
}
|
||||
recordCounts[record]++;
|
||||
|
||||
if (!assetOccurances.isEmpty() && assetOccurances.last().first == record) {
|
||||
assetOccurances.last().second++;
|
||||
continue;
|
||||
}
|
||||
|
||||
QPair<QString, int> assetOccurance(record, 1);
|
||||
assetOccurances << assetOccurance;
|
||||
}
|
||||
ui->tableWidget_RecordOrder->setRowCount(assetOccurances.size());
|
||||
|
||||
int assetIndex = 0;
|
||||
foreach (auto assetOccurance, assetOccurances) {
|
||||
const QString record = assetOccurance.first;
|
||||
AssetType assetType = mZoneFile->AssetStrToEnum(record);
|
||||
int assetCount = assetOccurance.second;
|
||||
|
||||
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType);
|
||||
if (assetIcon.isNull()) {
|
||||
qDebug() << "Icon is null for record: " << record;
|
||||
}
|
||||
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
|
||||
QTableWidgetItem *recordStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType));
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(assetCount));
|
||||
recordItem->setIcon(assetIcon);
|
||||
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 0, recordItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 1, recordStrItem);
|
||||
ui->tableWidget_RecordOrder->setItem(assetIndex, 2, recordCountItem);
|
||||
|
||||
assetIndex++;
|
||||
}
|
||||
|
||||
int recordIndex = 0;
|
||||
for (const QString &record : recordCounts.keys()) {
|
||||
int recordCount = recordCounts[record];
|
||||
|
||||
AssetType assetType = mZoneFile->AssetStrToEnum(record);
|
||||
QIcon assetIcon = mZoneFile->AssetTypeToIcon(assetType);
|
||||
if (assetIcon.isNull()) {
|
||||
qDebug() << "Icon is null for record: " << record;
|
||||
}
|
||||
|
||||
ui->tableWidget_RecordCounts->setRowCount(recordIndex + 1);
|
||||
|
||||
QTableWidgetItem *recordItem = new QTableWidgetItem(record.toUpper());
|
||||
QTableWidgetItem *recordCountStrItem = new QTableWidgetItem(mZoneFile->AssetEnumToStr(assetType));
|
||||
QTableWidgetItem *recordCountItem = new QTableWidgetItem(QString::number(recordCount));
|
||||
recordItem->setIcon(assetIcon);
|
||||
|
||||
ui->tableWidget_RecordCounts->setItem(recordIndex, 0, recordItem);
|
||||
ui->tableWidget_RecordCounts->setItem(recordIndex, 1, recordCountStrItem);
|
||||
ui->tableWidget_RecordCounts->setItem(recordIndex, 2, recordCountItem);
|
||||
|
||||
recordIndex++;
|
||||
}
|
||||
|
||||
ui->tableWidget_RecordOrder->resizeColumnsToContents();
|
||||
ui->tableWidget_RecordCounts->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
@ -1,33 +1,33 @@
|
||||
#ifndef ZONEFILEVIEWER_H
|
||||
#define ZONEFILEVIEWER_H
|
||||
|
||||
#include "zonefile.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ZoneFileViewer;
|
||||
}
|
||||
|
||||
class ZoneFileViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ZoneFileViewer(QWidget *parent = nullptr);
|
||||
~ZoneFileViewer();
|
||||
|
||||
void SetZoneFile(const ZoneFile *aZoneFile);
|
||||
|
||||
public slots:
|
||||
void SortTags(const QString &aSearchText);
|
||||
|
||||
void HighlightRecordInOrder();
|
||||
|
||||
private:
|
||||
Ui::ZoneFileViewer *ui;
|
||||
const ZoneFile* mZoneFile;
|
||||
};
|
||||
|
||||
#endif // ZONEFILEVIEWER_H
|
||||
#ifndef ZONEFILEVIEWER_H
|
||||
#define ZONEFILEVIEWER_H
|
||||
|
||||
#include "zonefile.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class ZoneFileViewer;
|
||||
}
|
||||
|
||||
class ZoneFileViewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ZoneFileViewer(QWidget *parent = nullptr);
|
||||
~ZoneFileViewer();
|
||||
|
||||
void SetZoneFile(std::shared_ptr<ZoneFile> aZoneFile);
|
||||
|
||||
public slots:
|
||||
void SortTags(const QString &aSearchText);
|
||||
|
||||
void HighlightRecordInOrder();
|
||||
|
||||
private:
|
||||
Ui::ZoneFileViewer *ui;
|
||||
std::shared_ptr<ZoneFile> mZoneFile;
|
||||
};
|
||||
|
||||
#endif // ZONEFILEVIEWER_H
|
||||
|
||||
@ -1,129 +1,129 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ZoneFileViewer</class>
|
||||
<widget class="QWidget" name="ZoneFileViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>556</width>
|
||||
<height>428</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ZoneFile 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_Tags">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Tags</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Search:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_TagSearch">
|
||||
<property name="placeholderText">
|
||||
<string>Search tags...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_Tags">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_RecordCounts">
|
||||
<property name="title">
|
||||
<string>Record Counts</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordCounts">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SelectionMode::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_RecordOrder">
|
||||
<property name="title">
|
||||
<string>Record Order</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordOrder">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SelectionMode::NoSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ZoneFileViewer</class>
|
||||
<widget class="QWidget" name="ZoneFileViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>556</width>
|
||||
<height>428</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_Title">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>16</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ZoneFile 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_Tags">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Roboto</family>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Tags</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Search:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_TagSearch">
|
||||
<property name="placeholderText">
|
||||
<string>Search tags...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_Tags">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_RecordCounts">
|
||||
<property name="title">
|
||||
<string>Record Counts</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordCounts">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SelectionMode::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_RecordOrder">
|
||||
<property name="title">
|
||||
<string>Record Order</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_RecordOrder">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SelectionMode::NoSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@ -1,30 +1,31 @@
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>images/XPlor.png</file>
|
||||
<file>images/copy.svg</file>
|
||||
<file>images/cut.svg</file>
|
||||
<file>images/multiple.png</file>
|
||||
<file>images/new_file.svg</file>
|
||||
<file>images/open_file.svg</file>
|
||||
<file>images/open_folder.svg</file>
|
||||
<file>images/paste.svg</file>
|
||||
<file>images/refresh.svg</file>
|
||||
<file>images/save.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons">
|
||||
<file>icons/Icon_Pause.png</file>
|
||||
<file>icons/Icon_Play.png</file>
|
||||
<file>icons/Icon_SkipBack.png</file>
|
||||
<file>icons/Icon_SkipForward.png</file>
|
||||
<file>icons/Icon_Stop.png</file>
|
||||
<file>icons/Icon_Editor.png</file>
|
||||
<file>icons/Icon_Views.png</file>
|
||||
<file>icons/Icon_Tree.png</file>
|
||||
<file>icons/Icon_Cut.png</file>
|
||||
<file>icons/Icon_Find.png</file>
|
||||
<file>icons/Icon_NewFile.png</file>
|
||||
<file>icons/Icon_Paste.png</file>
|
||||
<file>icons/Icon_Save.png</file>
|
||||
<file>icons/Icon_OpenFile.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>images/XPlor.png</file>
|
||||
<file>images/copy.svg</file>
|
||||
<file>images/cut.svg</file>
|
||||
<file>images/multiple.png</file>
|
||||
<file>images/new_file.svg</file>
|
||||
<file>images/open_file.svg</file>
|
||||
<file>images/open_folder.svg</file>
|
||||
<file>images/paste.svg</file>
|
||||
<file>images/refresh.svg</file>
|
||||
<file>images/save.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons">
|
||||
<file>icons/Icon_Pause.png</file>
|
||||
<file>icons/Icon_Play.png</file>
|
||||
<file>icons/Icon_SkipBack.png</file>
|
||||
<file>icons/Icon_SkipForward.png</file>
|
||||
<file>icons/Icon_Stop.png</file>
|
||||
<file>icons/Icon_Editor.png</file>
|
||||
<file>icons/Icon_Views.png</file>
|
||||
<file>icons/Icon_Tree.png</file>
|
||||
<file>icons/Icon_Copy.png</file>
|
||||
<file>icons/Icon_Cut.png</file>
|
||||
<file>icons/Icon_Find.png</file>
|
||||
<file>icons/Icon_NewFile.png</file>
|
||||
<file>icons/Icon_Paste.png</file>
|
||||
<file>icons/Icon_Save.png</file>
|
||||
<file>icons/Icon_OpenFile.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
data/icons/Icon_Copy.png
Normal file
BIN
data/icons/Icon_Copy.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 316 B |
@ -1,10 +1,13 @@
|
||||
#include "compression.h"
|
||||
#include "minilzo.h"
|
||||
|
||||
#define XBOXAPI __declspec(dllimport)
|
||||
#include "xcompress.h"
|
||||
|
||||
#include <QLibrary>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
|
||||
QByteArray Compression::CompressXMem(const QByteArray &data)
|
||||
{
|
||||
@ -31,8 +34,7 @@ QByteArray Compression::CompressXMem(const QByteArray &data)
|
||||
return output;
|
||||
}
|
||||
|
||||
QByteArray Compression::DecompressXMem(const QByteArray &data,
|
||||
int flags, int windowSize, int partSize)
|
||||
QByteArray Compression::DecompressXMem(const QByteArray &data, int flags, int windowSize, int partSize)
|
||||
{
|
||||
if (data.isEmpty())
|
||||
return {};
|
||||
@ -42,49 +44,27 @@ QByteArray Compression::DecompressXMem(const QByteArray &data,
|
||||
lzxParams.WindowSize = windowSize;
|
||||
lzxParams.CompressionPartitionSize = partSize;
|
||||
|
||||
QByteArray internalState(0x94933, Qt::Uninitialized);
|
||||
XMEMDECOMPRESSION_CONTEXT ctx = nullptr;
|
||||
if (FAILED(XMemCreateDecompressionContext(XMEMCODEC_LZX, &lzxParams, 0, &ctx)) || !ctx)
|
||||
return {};
|
||||
|
||||
XMEMDECOMPRESSION_CONTEXT ctx = XMemInitializeDecompressionContext(
|
||||
XMEMCODEC_LZX, &lzxParams, 1,
|
||||
internalState.data(), internalState.size());
|
||||
// Allocate large enough buffer for decompression (16 MB is a safe upper bound)
|
||||
const SIZE_T kMaxOutSize = 16 * 1024 * 1024;
|
||||
QByteArray output(static_cast<int>(kMaxOutSize), Qt::Uninitialized);
|
||||
SIZE_T actualSize = kMaxOutSize;
|
||||
|
||||
if (!ctx || XMemResetDecompressionContext(ctx)) {
|
||||
qWarning() << "Failed to init LZX context";
|
||||
HRESULT hr = XMemDecompress(ctx,
|
||||
output.data(), &actualSize,
|
||||
data.constData(), data.size() + 16);
|
||||
|
||||
XMemDestroyDecompressionContext(ctx);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
qWarning() << "XMemDecompress failed with HRESULT:" << hr;
|
||||
return {};
|
||||
}
|
||||
|
||||
QByteArray output;
|
||||
output.reserve(16 * 1024 * 1024); // rough guess
|
||||
|
||||
const quint8 *nextIn = reinterpret_cast<const quint8*>(data.constData());
|
||||
SIZE_T availIn = data.size();
|
||||
|
||||
QByteArray scratch(0x10000, Qt::Uninitialized); // 64 KB chunks
|
||||
|
||||
while (availIn > 0) {
|
||||
SIZE_T inSize = availIn; // let XMem tell us how much it will consume
|
||||
SIZE_T outSize = scratch.size(); // max 64 KB per call
|
||||
|
||||
HRESULT hr = XMemDecompressStream(ctx,
|
||||
scratch.data(), &outSize,
|
||||
nextIn, &inSize);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
qWarning() << "XMemDecompressStream failed, hr=" << hr;
|
||||
XMemDestroyDecompressionContext(ctx);
|
||||
return {};
|
||||
}
|
||||
|
||||
if (inSize == 0 && outSize == 0)
|
||||
break; // no progress
|
||||
|
||||
output.append(scratch.constData(), static_cast<int>(outSize));
|
||||
|
||||
nextIn += inSize;
|
||||
availIn -= inSize;
|
||||
}
|
||||
|
||||
XMemDestroyDecompressionContext(ctx);
|
||||
output.resize(static_cast<int>(actualSize));
|
||||
return output;
|
||||
}
|
||||
|
||||
@ -100,18 +80,19 @@ quint32 Compression::CalculateAdler32Checksum(const QByteArray &data) {
|
||||
|
||||
qint64 Compression::FindZlibOffset(const QByteArray &bytes)
|
||||
{
|
||||
QDataStream stream(bytes);
|
||||
static const QByteArray iwffs("IWffs");
|
||||
auto idx = bytes.indexOf(iwffs);
|
||||
if (idx != -1)
|
||||
return idx + 0x4000;
|
||||
|
||||
while (!stream.atEnd())
|
||||
const char header = 0x78; // z-lib: 0x78 [FLG]
|
||||
int pos = -1;
|
||||
while ((pos = bytes.indexOf(header, pos + 1)) != -1)
|
||||
{
|
||||
QByteArray testSegment = stream.device()->peek(2).toHex().toUpper();
|
||||
if (testSegment == "7801" ||
|
||||
testSegment == "785E" ||
|
||||
testSegment == "789C" ||
|
||||
testSegment == "78DA") {
|
||||
return stream.device()->pos();
|
||||
}
|
||||
stream.skipRawData(1);
|
||||
QByteArray window = bytes.mid(pos, 0x20);
|
||||
if (!window.contains(QByteArray::fromHex("000000")) &&
|
||||
!window.contains(QByteArray::fromHex("FFFFFF")))
|
||||
return pos;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -314,12 +295,11 @@ QByteArray Compression::CompressDeflateWithSettings(const QByteArray &aData, int
|
||||
}
|
||||
|
||||
QByteArray Compression::DecompressLZO(const QByteArray &aCompressedData, quint32 aDestSize) {
|
||||
QByteArray dst;
|
||||
static bool ok = (lzo_init() == LZO_E_OK);
|
||||
if (!ok)
|
||||
throw std::runtime_error("lzo_init failed");
|
||||
|
||||
dst = QByteArray(aDestSize, Qt::Uninitialized);
|
||||
QByteArray dst(aDestSize, Qt::Uninitialized);
|
||||
lzo_uint out = aDestSize;
|
||||
|
||||
int rc = lzo1x_decompress_safe(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "QtZlib/zlib.h"
|
||||
|
||||
//#include <windows.h>
|
||||
#include <windows.h>
|
||||
#include <QtGlobal>
|
||||
#include <stddef.h>
|
||||
#include <QByteArray>
|
||||
|
||||
@ -3,14 +3,20 @@ TEMPLATE = lib
|
||||
CONFIG += staticlib c++17
|
||||
DEFINES += MINILZO_USE_STATIC
|
||||
|
||||
SOURCES += $$files($$PWD/*.cpp, true) \
|
||||
$$files($$PWD/*.c, true)
|
||||
HEADERS += $$files($$PWD/*.h, true)
|
||||
SOURCES += \
|
||||
compression.cpp \
|
||||
minilzo.c \
|
||||
lzoconf.h \
|
||||
lzodefs.h
|
||||
|
||||
HEADERS += \
|
||||
compression.h \
|
||||
minilzo.h
|
||||
|
||||
LIBS += \
|
||||
-L$$PWD/../../third_party/xbox_sdk/lib -lxcompress64 \
|
||||
-L$$OUT_PWD/../libs/core -lcore \
|
||||
-L$$OUT_PWD/../libs/encryption -lencryption
|
||||
-L$$PWD/../../third_party/xbox_sdk/lib -lxcompress64 \
|
||||
-L$$OUT_PWD/../libs/core -lcore \
|
||||
-L$$OUT_PWD/../libs/encryption -lencryption
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../../third_party/xbox_sdk/include \
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
|
||||
/* get OS and architecture defines */
|
||||
#ifndef __LZODEFS_H_INCLUDED
|
||||
#include <lzodefs.h>
|
||||
#include <lzo/lzodefs.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ extern "C" {
|
||||
# define LZO_INT_MAX 9223372036854775807LL
|
||||
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||
# elif (LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||
typedef quint32 lzo_uint;
|
||||
typedef unsigned int lzo_uint;
|
||||
typedef int lzo_int;
|
||||
# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT
|
||||
|
||||
@ -2847,7 +2847,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG
|
||||
#elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT)
|
||||
# define lzo_int16e_t int
|
||||
# define lzo_uint16e_t quint32
|
||||
# define lzo_uint16e_t unsigned int
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_SHORT == 2)
|
||||
# define lzo_int16e_t short int
|
||||
@ -2856,14 +2856,14 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM)
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
typedef quint32 lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__)));
|
||||
# endif
|
||||
# define lzo_int16e_t lzo_int16e_hi_t__
|
||||
# define lzo_uint16e_t lzo_uint16e_hi_t__
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI
|
||||
#elif (LZO_SIZEOF___INT16 == 2)
|
||||
# define lzo_int16e_t __int16
|
||||
# define lzo_uint16e_t quint32
|
||||
# define lzo_uint16e_t unsigned __int16
|
||||
# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16
|
||||
#else
|
||||
#endif
|
||||
@ -2883,7 +2883,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG
|
||||
#elif (LZO_SIZEOF_INT == 4)
|
||||
# define lzo_int32e_t int
|
||||
# define lzo_uint32e_t quint32
|
||||
# define lzo_uint32e_t unsigned int
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_SHORT == 4)
|
||||
# define lzo_int32e_t short int
|
||||
@ -2896,7 +2896,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef quint32 lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
# endif
|
||||
# define lzo_int32e_t lzo_int32e_si_t__
|
||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||
@ -2904,7 +2904,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L)
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef quint32 lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__)));
|
||||
# endif
|
||||
# define lzo_int32e_t lzo_int32e_si_t__
|
||||
# define lzo_uint32e_t lzo_uint32e_si_t__
|
||||
@ -2913,7 +2913,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI
|
||||
#elif (LZO_SIZEOF___INT32 == 4)
|
||||
# define lzo_int32e_t __int32
|
||||
# define lzo_uint32e_t quint32
|
||||
# define lzo_uint32e_t unsigned __int32
|
||||
# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32
|
||||
#else
|
||||
#endif
|
||||
@ -2937,7 +2937,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#endif
|
||||
#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||
# define lzo_int64e_t int
|
||||
# define lzo_uint64e_t quint32
|
||||
# define lzo_uint64e_t unsigned int
|
||||
# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64)
|
||||
# define lzo_int64e_t long int
|
||||
@ -2984,7 +2984,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T
|
||||
#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||
# define lzo_int32l_t int
|
||||
# define lzo_uint32l_t quint32
|
||||
# define lzo_uint32l_t unsigned int
|
||||
# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT
|
||||
#elif (LZO_SIZEOF_LONG >= 4)
|
||||
@ -3057,7 +3057,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4))
|
||||
# if !(LZO_LANG_ASSEMBLER)
|
||||
typedef __w64 int lzo_intptr_t;
|
||||
typedef __w64 quint32 lzo_uintptr_t;
|
||||
typedef __w64 unsigned int lzo_uintptr_t;
|
||||
# endif
|
||||
# define lzo_intptr_t lzo_intptr_t
|
||||
# define lzo_uintptr_t lzo_uintptr_t
|
||||
@ -3070,7 +3070,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT
|
||||
#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG)
|
||||
# define lzo_intptr_t int
|
||||
# define lzo_uintptr_t quint32
|
||||
# define lzo_uintptr_t unsigned int
|
||||
# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT
|
||||
#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P)
|
||||
@ -3104,7 +3104,7 @@ LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t))
|
||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG
|
||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG
|
||||
#elif (LZO_WORDSIZE == LZO_SIZEOF_INT)
|
||||
# define lzo_word_t quint32
|
||||
# define lzo_word_t unsigned int
|
||||
# define lzo_sword_t int
|
||||
# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT
|
||||
# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT
|
||||
|
||||
@ -25,6 +25,12 @@
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* the full LZO package can be found at
|
||||
* http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
#define __LZO_IN_MINILZO 1
|
||||
|
||||
#if defined(LZO_CFG_FREESTANDING)
|
||||
|
||||
@ -25,6 +25,13 @@
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* the full LZO package can be found at
|
||||
* http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __MINILZO_H_INCLUDED
|
||||
#define __MINILZO_H_INCLUDED 1
|
||||
|
||||
|
||||
@ -2,15 +2,23 @@ QT += core widgets
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++17
|
||||
|
||||
SOURCES += $$files($$PWD/*.cpp, true) \
|
||||
xdatastream.cpp
|
||||
HEADERS += $$files($$PWD/*.h, true) \
|
||||
xdatastream.h
|
||||
SOURCES += \
|
||||
highlighter_cfg.cpp \
|
||||
highlighter_shock.cpp \
|
||||
highlighter_rumble.cpp \
|
||||
highlighter_gsc.cpp \
|
||||
logmanager.cpp \
|
||||
statusbarmanager.cpp
|
||||
|
||||
LIBS += -L$$OUT_PWD/../libs/xassets -lxassets
|
||||
|
||||
INCLUDEPATH += $$PWD/../xassets
|
||||
|
||||
DEPENDPATH += $$PWD/../xassets
|
||||
HEADERS += \
|
||||
enums.h \
|
||||
highlighter_cfg.h \
|
||||
highlighter_shock.h \
|
||||
highlighter_rumble.h \
|
||||
highlighter_gsc.h \
|
||||
logmanager.h \
|
||||
stringutils.h \
|
||||
utils.h \
|
||||
statusbarmanager.h
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
|
||||
@ -3,10 +3,32 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
enum FF_PLATFORM {
|
||||
FF_PLATFORM_NONE = 0x00, // No platform
|
||||
FF_PLATFORM_XBOX = 0x01, // Xbox 360
|
||||
FF_PLATFORM_PS3 = 0x02, // Playstation 3
|
||||
FF_PLATFORM_PC = 0x03, // PC
|
||||
FF_PLATFORM_WII = 0x04, // WII
|
||||
FF_PLATFORM_WIIU = 0x05 // WII U
|
||||
};
|
||||
|
||||
enum FF_GAME {
|
||||
FF_GAME_NONE = 0x00, // No game
|
||||
FF_GAME_COD1 = 0x01, // Call of Duty
|
||||
FF_GAME_COD2 = 0x02, // Call of Duty 2
|
||||
FF_GAME_COD3 = 0x03, // Call of Duty 3
|
||||
FF_GAME_COD4 = 0x04, // Modern Warware 1
|
||||
FF_GAME_COD5 = 0x05, // World at War
|
||||
FF_GAME_COD6 = 0x06, // Modern Warfare 2
|
||||
FF_GAME_COD7 = 0x07, // Black Ops 1
|
||||
FF_GAME_COD8 = 0x08, // Modern Warfare 3
|
||||
FF_GAME_COD9 = 0x09, // Black Ops 2
|
||||
};
|
||||
|
||||
enum IWI_VERSION {
|
||||
IWI_VERSION_COD2 = 0x05, // 05 CoD2
|
||||
IWI_VERSION_COD4 = 0x06, // 06 CoD4
|
||||
IWI_VERSION_COD5 = 0x06, // 06 CoD5
|
||||
IWI_VERSION_COD2 = 0x05, // 05 CoD2
|
||||
IWI_VERSION_COD4 = 0x06, // 06 CoD4
|
||||
IWI_VERSION_COD5 = 0x06, // 06 CoD5
|
||||
IWI_VERSION_CODMW2 = 0x08, // 08 CoDMW2
|
||||
IWI_VERSION_CODMW3 = 0x08, // 08 CoDMW3
|
||||
IWI_VERSION_CODBO1 = 0x0D, // 13 CoDBO1
|
||||
@ -16,37 +38,37 @@ enum IWI_VERSION {
|
||||
enum IWI_FORMAT {
|
||||
// IWI Format
|
||||
IWI_FORMAT_ARGB32 = 0x01, // 01 ARGB32
|
||||
IWI_FORMAT_RGB24 = 0x02, // 02 RGB24
|
||||
IWI_FORMAT_GA16 = 0x03, // 03 GA16
|
||||
IWI_FORMAT_A8 = 0x04, // 04 A8
|
||||
IWI_FORMAT_DXT1 = 0x0B, // 11 DXT1
|
||||
IWI_FORMAT_DXT3 = 0x0C, // 12 DXT3
|
||||
IWI_FORMAT_DXT5 = 0x0D // 13 DXT5
|
||||
IWI_FORMAT_RGB24 = 0x02, // 02 RGB24
|
||||
IWI_FORMAT_GA16 = 0x03, // 03 GA16
|
||||
IWI_FORMAT_A8 = 0x04, // 04 A8
|
||||
IWI_FORMAT_DXT1 = 0x0B, // 11 DXT1
|
||||
IWI_FORMAT_DXT3 = 0x0C, // 12 DXT3
|
||||
IWI_FORMAT_DXT5 = 0x0D // 13 DXT5
|
||||
};
|
||||
|
||||
enum DDS_FLAGS {
|
||||
DDSD_CAPS = 0x1,
|
||||
DDSD_HEIGHT = 0x2,
|
||||
DDSD_WIDTH = 0x4,
|
||||
DDSD_PITCH = 0x8,
|
||||
DDSD_CAPS = 0x1,
|
||||
DDSD_HEIGHT = 0x2,
|
||||
DDSD_WIDTH = 0x4,
|
||||
DDSD_PITCH = 0x8,
|
||||
DDSD_PIXELFORMAT = 0x1000,
|
||||
DDSD_MIPMAPCOUNT = 0x20000,
|
||||
DDSD_LINEARSIZE = 0x80000,
|
||||
DDSD_DEPTH = 0x800000
|
||||
DDSD_LINEARSIZE = 0x80000,
|
||||
DDSD_DEPTH = 0x800000
|
||||
};
|
||||
|
||||
enum DDS_PIXELFORMAT_FLAGS {
|
||||
DDPF_ALPHAPIXELS = 0x1,
|
||||
DDPF_ALPHA = 0x2,
|
||||
DDPF_FOURCC = 0x4,
|
||||
DDPF_RGB = 0x40,
|
||||
DDPF_YUV = 0x200,
|
||||
DDPF_LUMINANCE = 0x20000
|
||||
DDPF_ALPHA = 0x2,
|
||||
DDPF_FOURCC = 0x4,
|
||||
DDPF_RGB = 0x40,
|
||||
DDPF_YUV = 0x200,
|
||||
DDPF_LUMINANCE = 0x20000
|
||||
};
|
||||
|
||||
enum DDS_CAPS_FLAGS {
|
||||
DDSCAPS_COMPLEX = 0x8,
|
||||
DDSCAPS_MIPMAP = 0x400000,
|
||||
DDSCAPS_MIPMAP = 0x400000,
|
||||
DDSCAPS_TEXTURE = 0x1000
|
||||
};
|
||||
|
||||
@ -189,15 +211,15 @@ enum MENU_ITEM_TYPE {
|
||||
ITEM_TYPE_RADIOBUTTON = 2, // toggle button, may be grouped
|
||||
ITEM_TYPE_CHECKBOX = 3, // check box
|
||||
ITEM_TYPE_EDITFIELD = 4, // editable text, associated with a dvar
|
||||
ITEM_TYPE_COMBO = 5, // drop down list
|
||||
ITEM_TYPE_COMBO = 5, // drop down list
|
||||
ITEM_TYPE_LISTBOX = 6, // scrollable list
|
||||
ITEM_TYPE_MODEL = 7, // model
|
||||
ITEM_TYPE_MODEL = 7, // model
|
||||
ITEM_TYPE_OWNERDRAW = 8, // owner draw, name specs what it is
|
||||
ITEM_TYPE_NUMERICFIELD = 9, // editable text, associated with a dvar
|
||||
ITEM_TYPE_SLIDER = 10, // mouse speed, volume, etc.
|
||||
ITEM_TYPE_YESNO = 11, // yes no dvar setting
|
||||
ITEM_TYPE_MULTI = 12, // multiple list setting, enumerated
|
||||
ITEM_TYPE_DVARENUM = 13, // multiple list setting, enumerated from a dvar
|
||||
ITEM_TYPE_YESNO = 11, // yes no dvar setting
|
||||
ITEM_TYPE_MULTI = 12, // multiple list setting, enumerated
|
||||
ITEM_TYPE_DVARENUM = 13, // multiple list setting, enumerated from a dvar
|
||||
ITEM_TYPE_BIND = 14, // bind
|
||||
ITEM_TYPE_MENUMODEL = 15, // special menu model
|
||||
ITEM_TYPE_VALIDFILEFIELD = 16, // text must be valid for use in a dos filename
|
||||
@ -410,7 +432,7 @@ enum MENU_FONT_TYPE{
|
||||
UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small
|
||||
UI_FONT_NORMAL = 1,
|
||||
UI_FONT_BIG = 2,
|
||||
UI_GameFontMALL = 3,
|
||||
UI_FONT_SMALL = 3,
|
||||
UI_FONT_BOLD = 4,
|
||||
UI_FONT_CONSOLE = 5,
|
||||
UI_FONT_OBJECTIVE = 6,
|
||||
|
||||
@ -2,19 +2,15 @@
|
||||
#define UTILS_H
|
||||
|
||||
#include "enums.h"
|
||||
#include "QtZlib/zlib.h"
|
||||
#include "qdir.h"
|
||||
#include "qicon.h"
|
||||
#include "xasset.h"
|
||||
#include "xassettype.h"
|
||||
|
||||
#include <QMetaEnum>
|
||||
#include <QString>
|
||||
#include <QtZlib/zlib.h>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
class Utils : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
class Utils {
|
||||
public:
|
||||
static bool ExportData(const QString aFileName, const QByteArray aData) {
|
||||
QDir workingDir = QDir::currentPath();
|
||||
@ -34,29 +30,6 @@ public:
|
||||
b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
|
||||
return b;
|
||||
}
|
||||
static QIcon CreateAssetIcon(XAssetType aAssetType, QColor color = QColor()) {
|
||||
const QString assetTypeStr = XAsset::XAssetTypeToString(aAssetType);
|
||||
|
||||
QString assetAbbr;
|
||||
for (int i = 0; i < assetTypeStr.length(); i++)
|
||||
{
|
||||
if (assetTypeStr[i].isUpper())
|
||||
{
|
||||
assetAbbr += assetTypeStr[i];
|
||||
}
|
||||
}
|
||||
return CreateAssetIcon(assetAbbr, color);
|
||||
|
||||
// QString name;
|
||||
// const QStringList parts = assetTypeStr.split('_').mid(1);
|
||||
// foreach (const QString part, parts) {
|
||||
// name += part[0];
|
||||
// }
|
||||
// if (parts.size() == 1) {
|
||||
// name += parts.first()[1];
|
||||
// }
|
||||
// return CreateAssetIcon(name, color);
|
||||
}
|
||||
static QIcon CreateAssetIcon(const QString& name, QColor color = QColor()) {
|
||||
constexpr int iconSize = 32;
|
||||
constexpr int padding = 4;
|
||||
@ -223,7 +196,7 @@ public:
|
||||
|
||||
return color;
|
||||
}
|
||||
static bool ReadUntilString(XDataStream* stream, const QString& targetString) {
|
||||
static bool ReadUntilString(QDataStream* stream, const QString& targetString) {
|
||||
if (!stream || targetString.isEmpty()) {
|
||||
return false; // Invalid input
|
||||
}
|
||||
@ -257,7 +230,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ReadUntilHex(XDataStream* stream, const QString& hexString) {
|
||||
static bool ReadUntilHex(QDataStream* stream, const QString& hexString) {
|
||||
if (!stream || hexString.isEmpty() || hexString.size() % 2 != 0) {
|
||||
return false; // Invalid input
|
||||
}
|
||||
@ -407,6 +380,34 @@ public:
|
||||
return PadInt4(size) - size;
|
||||
}
|
||||
|
||||
static QString GetOpenFastFileName(QWidget *parent = nullptr) {
|
||||
// Open file dialog to steam apps
|
||||
const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
|
||||
const QString fastFilePath = QFileDialog::getOpenFileName(parent, "Open Fast File", steamPath, "Fast File (*.ff);;All Files (*.*)");
|
||||
if (fastFilePath.isNull()) {
|
||||
// User pressed cancel
|
||||
return "";
|
||||
} else if (!QFile::exists(fastFilePath)) {
|
||||
QMessageBox::warning(parent, "Warning!", QString("%1 does not exist!.").arg(fastFilePath));
|
||||
return "";
|
||||
}
|
||||
return fastFilePath;
|
||||
}
|
||||
|
||||
static QString GetOpenZoneFileName(QWidget *parent = nullptr) {
|
||||
// Open file dialog to steam apps
|
||||
const QString steamPath = "C:/Program Files (x86)/Steam/steamapps/common/Call of Duty World at War/zone/english/";
|
||||
const QString zoneFilePath = QFileDialog::getOpenFileName(parent, "Open Zone File", steamPath, "Zone File (*.zone);;All Files (*.*)");
|
||||
if (zoneFilePath.isNull()) {
|
||||
// User pressed cancel
|
||||
return "";
|
||||
} else if (!QFile::exists(zoneFilePath)) {
|
||||
QMessageBox::warning(parent, "Warning!", QString("%1 does not exist!.").arg(zoneFilePath));
|
||||
return nullptr;
|
||||
}
|
||||
return zoneFilePath;
|
||||
}
|
||||
|
||||
static QString CompanyEnumToStr(FF_COMPANY aCompany) {
|
||||
switch (aCompany) {
|
||||
case COMPANY_NONE:
|
||||
|
||||
@ -1,243 +0,0 @@
|
||||
#include "xdatastream.h"
|
||||
|
||||
#include <QIODevice>
|
||||
#include <QDebug>
|
||||
|
||||
XDataStream::XDataStream(QIODevice *aDevice)
|
||||
: QDataStream(aDevice)
|
||||
, mDebug(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XDataStream::XDataStream()
|
||||
: QDataStream()
|
||||
, mDebug(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XDataStream::XDataStream(const QByteArray &aData)
|
||||
: QDataStream(aData)
|
||||
, mDebug(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XDataStream::XDataStream(QByteArray *aData, OpenMode aFlags)
|
||||
: QDataStream(aData, aFlags)
|
||||
, mDebug(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
XDataStream::~XDataStream()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void XDataStream::SetDebug(bool aDebug)
|
||||
{
|
||||
mDebug = aDebug;
|
||||
}
|
||||
|
||||
qint8 XDataStream::ParseInt8(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
qint8 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
quint8 XDataStream::ParseUInt8(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
quint8 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
qint16 XDataStream::ParseInt16(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
qint16 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
quint16 XDataStream::ParseUInt16(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
quint16 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
qint32 XDataStream::ParseInt32(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
qint32 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
quint32 XDataStream::ParseUInt32(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
quint32 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
qint64 XDataStream::ParseInt64(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
qint64 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
quint64 XDataStream::ParseUInt64(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
quint64 val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
float XDataStream::ParseSingle(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
|
||||
float val;
|
||||
quint32 rawVal;
|
||||
*this >> rawVal;
|
||||
memcpy(&val, &rawVal, sizeof(val));
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
double XDataStream::ParseDouble(const QString& aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
float val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
bool XDataStream::ParseBool(const QString &aDebugString)
|
||||
{
|
||||
qint64 start = this->device()->pos();
|
||||
|
||||
char val;
|
||||
*this >> val;
|
||||
|
||||
if (mDebug)
|
||||
{
|
||||
qDebug() << QString("[%1-%2] Parsed %3: %4")
|
||||
.arg(start, 10, 10, QChar('0'))
|
||||
.arg(this->device()->pos(), 10, 10, QChar('0'))
|
||||
.arg(aDebugString)
|
||||
.arg(val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
#ifndef XDATASTREAM_H
|
||||
#define XDATASTREAM_H
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QString>
|
||||
|
||||
class XDataStream : public QDataStream
|
||||
{
|
||||
public:
|
||||
explicit XDataStream(QIODevice* aDevice);
|
||||
XDataStream();
|
||||
XDataStream(const QByteArray& aData);
|
||||
XDataStream(QByteArray* aData, OpenMode aFlags);
|
||||
~XDataStream();
|
||||
|
||||
void SetDebug(bool aDebug = true);
|
||||
|
||||
qint8 ParseInt8(const QString& aDebugString = "");
|
||||
quint8 ParseUInt8(const QString& aDebugString = "");
|
||||
qint16 ParseInt16(const QString& aDebugString = "");
|
||||
quint16 ParseUInt16(const QString& aDebugString = "");
|
||||
qint32 ParseInt32(const QString& aDebugString = "");
|
||||
quint32 ParseUInt32(const QString& aDebugString = "");
|
||||
qint64 ParseInt64(const QString& aDebugString = "");
|
||||
quint64 ParseUInt64(const QString& aDebugString = "");
|
||||
float ParseSingle(const QString& aDebugString = "");
|
||||
double ParseDouble(const QString& aDebugString = "");
|
||||
bool ParseBool(const QString& aDebugString = "");
|
||||
|
||||
private:
|
||||
bool mDebug;
|
||||
};
|
||||
|
||||
#endif // XDATASTREAM_H
|
||||
@ -35,7 +35,7 @@ DDSPixelFormat DDSFile::CalculatePixelFormat(quint8 aIWIFormat) {
|
||||
return ddsPixelFormat;
|
||||
}
|
||||
|
||||
void DDSFile::SetupExportDirs() const {
|
||||
void DDSFile::SetupExportDirs() {
|
||||
QDir dir = QDir::currentPath();
|
||||
if (!dir.exists("exports/")) {
|
||||
dir.mkdir("exports/");
|
||||
@ -89,92 +89,92 @@ DDSFile::DDSFile(const QString &aFilePath)
|
||||
}
|
||||
|
||||
DDSFile::DDSFile(const QByteArray aDDSData, const QString aFileStem) {
|
||||
// QDataStream ddsIn(aDDSData);
|
||||
// ddsIn.setByteOrder(QDataStream::LittleEndian);
|
||||
QDataStream ddsIn(aDDSData);
|
||||
ddsIn.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// DDSHeader ddsHeader;
|
||||
// if (ddsIn.readRawData(reinterpret_cast<char*>(&ddsHeader), sizeof(DDSHeader)) != sizeof(DDSHeader)) {
|
||||
// qDebug() << "Error: Failed to read DDSHeader from QByteArray!";
|
||||
// return;
|
||||
// }
|
||||
DDSHeader ddsHeader;
|
||||
if (ddsIn.readRawData(reinterpret_cast<char*>(&ddsHeader), sizeof(DDSHeader)) != sizeof(DDSHeader)) {
|
||||
qDebug() << "Error: Failed to read DDSHeader from QByteArray!";
|
||||
return;
|
||||
}
|
||||
|
||||
// fileStem = aFileStem;
|
||||
// header = ddsHeader;
|
||||
fileStem = aFileStem;
|
||||
header = ddsHeader;
|
||||
|
||||
// // Ensure DevIL is initialized once globally
|
||||
// static bool devilInitialized = false;
|
||||
// if (!devilInitialized) {
|
||||
// ilInit();
|
||||
// devilInitialized = true;
|
||||
// }
|
||||
// Ensure DevIL is initialized once globally
|
||||
static bool devilInitialized = false;
|
||||
if (!devilInitialized) {
|
||||
ilInit();
|
||||
devilInitialized = true;
|
||||
}
|
||||
|
||||
// // Generate and bind an image
|
||||
// ILuint imageID;
|
||||
// ilGenImages(1, &imageID);
|
||||
// ilBindImage(imageID);
|
||||
// Generate and bind an image
|
||||
ILuint imageID;
|
||||
ilGenImages(1, &imageID);
|
||||
ilBindImage(imageID);
|
||||
|
||||
// ilEnable(IL_ORIGIN_SET);
|
||||
// ilOriginFunc(IL_ORIGIN_UPPER_LEFT);
|
||||
ilEnable(IL_ORIGIN_SET);
|
||||
ilOriginFunc(IL_ORIGIN_UPPER_LEFT);
|
||||
|
||||
// // Load DDS file
|
||||
// if (!ilLoadL(IL_DDS, aDDSData.constData(), aDDSData.size())) {
|
||||
// ILuint devilError = ilGetError();
|
||||
// qDebug() << "DevIL Error while loading DDS: " << devilError;
|
||||
// ilDeleteImages(1, &imageID);
|
||||
// return;
|
||||
// }
|
||||
// Load DDS file
|
||||
if (!ilLoadL(IL_DDS, aDDSData.constData(), aDDSData.size())) {
|
||||
ILuint devilError = ilGetError();
|
||||
qDebug() << "DevIL Error while loading DDS: " << devilError;
|
||||
ilDeleteImages(1, &imageID);
|
||||
return;
|
||||
}
|
||||
|
||||
// // Get mipmap count
|
||||
// ILint numMipmaps = ilGetInteger(IL_NUM_MIPMAPS);
|
||||
// qDebug() << "Number of mipmaps: " << numMipmaps;
|
||||
// Get mipmap count
|
||||
ILint numMipmaps = ilGetInteger(IL_NUM_MIPMAPS);
|
||||
qDebug() << "Number of mipmaps: " << numMipmaps;
|
||||
|
||||
// // Loop over all mipmap levels (0 is the base image)
|
||||
// for (ILint level = 0; level <= numMipmaps; ++level) {
|
||||
// ilBindImage(imageID);
|
||||
// if (!ilActiveMipmap(level)) {
|
||||
// qDebug() << "DevIL failed to activate mipmap level" << level;
|
||||
// continue;
|
||||
// }
|
||||
// Loop over all mipmap levels (0 is the base image)
|
||||
for (ILint level = 0; level <= numMipmaps; ++level) {
|
||||
ilBindImage(imageID);
|
||||
if (!ilActiveMipmap(level)) {
|
||||
qDebug() << "DevIL failed to activate mipmap level" << level;
|
||||
continue;
|
||||
}
|
||||
|
||||
// // Get mipmap properties
|
||||
// int width = ilGetInteger(IL_IMAGE_WIDTH);
|
||||
// int height = ilGetInteger(IL_IMAGE_HEIGHT);
|
||||
// int depth = ilGetInteger(IL_IMAGE_DEPTH);
|
||||
// int format = ilGetInteger(IL_IMAGE_FORMAT);
|
||||
// int bpp = 0;
|
||||
// Get mipmap properties
|
||||
int width = ilGetInteger(IL_IMAGE_WIDTH);
|
||||
int height = ilGetInteger(IL_IMAGE_HEIGHT);
|
||||
int depth = ilGetInteger(IL_IMAGE_DEPTH);
|
||||
int format = ilGetInteger(IL_IMAGE_FORMAT);
|
||||
int bpp = 0;
|
||||
|
||||
// switch (format) {
|
||||
// case IL_RGB:
|
||||
// bpp = 3;
|
||||
// break;
|
||||
// case IL_RGBA:
|
||||
// bpp = 4;
|
||||
// break;
|
||||
// default:
|
||||
// qDebug() << "Unsupported image format.";
|
||||
// continue;
|
||||
// }
|
||||
switch (format) {
|
||||
case IL_RGB:
|
||||
bpp = 3;
|
||||
break;
|
||||
case IL_RGBA:
|
||||
bpp = 4;
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Unsupported image format.";
|
||||
continue;
|
||||
}
|
||||
|
||||
// int dataSize = width * height * depth * bpp;
|
||||
int dataSize = width * height * depth * bpp;
|
||||
|
||||
// ILubyte *data = ilGetData();
|
||||
// if (!data) {
|
||||
// qDebug() << "Error: DevIL returned null data for mipmap level" << level;
|
||||
// continue;
|
||||
// }
|
||||
ILubyte *data = ilGetData();
|
||||
if (!data) {
|
||||
qDebug() << "Error: DevIL returned null data for mipmap level" << level;
|
||||
continue;
|
||||
}
|
||||
|
||||
// // Create a mipmap structure
|
||||
// DDSMipmap mipmap;
|
||||
// mipmap.width = width;
|
||||
// mipmap.height = height;
|
||||
// mipmap.data = QByteArray(reinterpret_cast<const char*>(data), dataSize);
|
||||
// mipmap.size = dataSize;
|
||||
// Create a mipmap structure
|
||||
DDSMipmap mipmap;
|
||||
mipmap.width = width;
|
||||
mipmap.height = height;
|
||||
mipmap.data = QByteArray(reinterpret_cast<const char*>(data), dataSize);
|
||||
mipmap.size = dataSize;
|
||||
|
||||
// // Store in DDS file
|
||||
// mipmaps.append(mipmap);
|
||||
// }
|
||||
// Store in DDS file
|
||||
mipmaps.append(mipmap);
|
||||
}
|
||||
|
||||
// ilDeleteImages(1, &imageID);
|
||||
ilDeleteImages(1, &imageID);
|
||||
}
|
||||
|
||||
DDSFile::DDSFile(const DDSFile &ddsFile) :
|
||||
@ -248,7 +248,7 @@ DDSFile &DDSFile::operator=(const DDSFile &other) {
|
||||
}
|
||||
|
||||
// Write a DDS file from a DDSFile object
|
||||
bool DDSFile::SaveDDS() const {
|
||||
bool DDSFile::SaveDDS() {
|
||||
SetupExportDirs();
|
||||
|
||||
QFile file("exports/dds/" + fileStem + ".dds");
|
||||
@ -268,7 +268,7 @@ bool DDSFile::SaveDDS() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DDSFile::SaveIWI() const {
|
||||
bool DDSFile::SaveIWI() {
|
||||
SetupExportDirs();
|
||||
|
||||
IWIFile iwiFile(*this);
|
||||
@ -279,7 +279,7 @@ bool DDSFile::SaveIWI() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DDSFile::SavePNG() const {
|
||||
bool DDSFile::SavePNG() {
|
||||
SetupExportDirs();
|
||||
|
||||
int mipmapIndex = 1;
|
||||
@ -311,7 +311,7 @@ bool DDSFile::SavePNG() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DDSFile::SaveJPG() const {
|
||||
bool DDSFile::SaveJPG() {
|
||||
SetupExportDirs();
|
||||
|
||||
int mipmapIndex = 1;
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
//#include <IL/il.h>
|
||||
#include <IL/il.h>
|
||||
|
||||
struct DDSPixelFormat {
|
||||
quint32 size;
|
||||
@ -68,12 +68,12 @@ public:
|
||||
DDSFile(const DDSFile &ddsFile);
|
||||
DDSFile& operator=(const DDSFile& other);
|
||||
|
||||
bool SaveDDS() const;
|
||||
bool SaveIWI() const;
|
||||
bool SavePNG() const;
|
||||
bool SaveJPG() const;
|
||||
bool SaveDDS();
|
||||
bool SaveIWI();
|
||||
bool SavePNG();
|
||||
bool SaveJPG();
|
||||
|
||||
void SetupExportDirs() const;
|
||||
void SetupExportDirs();
|
||||
static DDSPixelFormat CalculatePixelFormat(quint8 aIWIFormat);
|
||||
|
||||
private:
|
||||
|
||||
@ -2,21 +2,26 @@ QT += core
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++17
|
||||
|
||||
SOURCES += $$files($$PWD/*.cpp, true)
|
||||
HEADERS += $$files($$PWD/*.h, true)
|
||||
SOURCES += \
|
||||
ddsfile.cpp
|
||||
|
||||
HEADERS += \
|
||||
dds_structs.h \
|
||||
ddsfile.h \
|
||||
enums.h
|
||||
|
||||
LIBS += \
|
||||
#-L$$PWD/../../third_party/devil_sdk/lib/ -lDevIL \
|
||||
#-L$$PWD/../../third_party/devil_sdk/lib/ -lILU \
|
||||
#-L$$PWD/../../third_party/devil_sdk/lib/ -lILUT \
|
||||
-L$$PWD/../../third_party/devil_sdk/lib/ -lDevIL \
|
||||
-L$$PWD/../../third_party/devil_sdk/lib/ -lILU \
|
||||
-L$$PWD/../../third_party/devil_sdk/lib/ -lILUT \
|
||||
-L$$OUT_PWD/../libs/iwifile -liwifile
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../iwifile/ \
|
||||
#$$PWD/../../third_party/devil_sdk/include/
|
||||
$$PWD/../../third_party/devil_sdk/include/
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../iwifile/ \
|
||||
#$$PWD/../../third_party/devil_sdk/include/
|
||||
$$PWD/../../third_party/devil_sdk/include/
|
||||
|
||||
DESTDIR = $$OUT_PWD/../
|
||||
|
||||
@ -24,9 +24,9 @@ enum FF_GAME {
|
||||
};
|
||||
|
||||
enum IWI_VERSION {
|
||||
IWI_VERSION_COD2 = 0x05, // 05 CoD2
|
||||
IWI_VERSION_COD4 = 0x06, // 06 CoD4
|
||||
IWI_VERSION_COD5 = 0x06, // 06 CoD5
|
||||
IWI_VERSION_COD2 = 0x05, // 05 CoD2
|
||||
IWI_VERSION_COD4 = 0x06, // 06 CoD4
|
||||
IWI_VERSION_COD5 = 0x06, // 06 CoD5
|
||||
IWI_VERSION_CODMW2 = 0x08, // 08 CoDMW2
|
||||
IWI_VERSION_CODMW3 = 0x08, // 08 CoDMW3
|
||||
IWI_VERSION_CODBO1 = 0x0D, // 13 CoDBO1
|
||||
@ -36,37 +36,37 @@ enum IWI_VERSION {
|
||||
enum IWI_FORMAT {
|
||||
// IWI Format
|
||||
IWI_FORMAT_ARGB32 = 0x01, // 01 ARGB32
|
||||
IWI_FORMAT_RGB24 = 0x02, // 02 RGB24
|
||||
IWI_FORMAT_GA16 = 0x03, // 03 GA16
|
||||
IWI_FORMAT_A8 = 0x04, // 04 A8
|
||||
IWI_FORMAT_DXT1 = 0x0B, // 11 DXT1
|
||||
IWI_FORMAT_DXT3 = 0x0C, // 12 DXT3
|
||||
IWI_FORMAT_DXT5 = 0x0D // 13 DXT5
|
||||
IWI_FORMAT_RGB24 = 0x02, // 02 RGB24
|
||||
IWI_FORMAT_GA16 = 0x03, // 03 GA16
|
||||
IWI_FORMAT_A8 = 0x04, // 04 A8
|
||||
IWI_FORMAT_DXT1 = 0x0B, // 11 DXT1
|
||||
IWI_FORMAT_DXT3 = 0x0C, // 12 DXT3
|
||||
IWI_FORMAT_DXT5 = 0x0D // 13 DXT5
|
||||
};
|
||||
|
||||
enum DDS_FLAGS {
|
||||
DDSD_CAPS = 0x1,
|
||||
DDSD_HEIGHT = 0x2,
|
||||
DDSD_WIDTH = 0x4,
|
||||
DDSD_PITCH = 0x8,
|
||||
DDSD_CAPS = 0x1,
|
||||
DDSD_HEIGHT = 0x2,
|
||||
DDSD_WIDTH = 0x4,
|
||||
DDSD_PITCH = 0x8,
|
||||
DDSD_PIXELFORMAT = 0x1000,
|
||||
DDSD_MIPMAPCOUNT = 0x20000,
|
||||
DDSD_LINEARSIZE = 0x80000,
|
||||
DDSD_DEPTH = 0x800000
|
||||
DDSD_LINEARSIZE = 0x80000,
|
||||
DDSD_DEPTH = 0x800000
|
||||
};
|
||||
|
||||
enum DDS_PIXELFORMAT_FLAGS {
|
||||
DDPF_ALPHAPIXELS = 0x1,
|
||||
DDPF_ALPHA = 0x2,
|
||||
DDPF_FOURCC = 0x4,
|
||||
DDPF_RGB = 0x40,
|
||||
DDPF_YUV = 0x200,
|
||||
DDPF_LUMINANCE = 0x20000
|
||||
DDPF_ALPHA = 0x2,
|
||||
DDPF_FOURCC = 0x4,
|
||||
DDPF_RGB = 0x40,
|
||||
DDPF_YUV = 0x200,
|
||||
DDPF_LUMINANCE = 0x20000
|
||||
};
|
||||
|
||||
enum DDS_CAPS_FLAGS {
|
||||
DDSCAPS_COMPLEX = 0x8,
|
||||
DDSCAPS_MIPMAP = 0x400000,
|
||||
DDSCAPS_MIPMAP = 0x400000,
|
||||
DDSCAPS_TEXTURE = 0x1000
|
||||
};
|
||||
|
||||
@ -209,15 +209,15 @@ enum MENU_ITEM_TYPE {
|
||||
ITEM_TYPE_RADIOBUTTON = 2, // toggle button, may be grouped
|
||||
ITEM_TYPE_CHECKBOX = 3, // check box
|
||||
ITEM_TYPE_EDITFIELD = 4, // editable text, associated with a dvar
|
||||
ITEM_TYPE_COMBO = 5, // drop down list
|
||||
ITEM_TYPE_COMBO = 5, // drop down list
|
||||
ITEM_TYPE_LISTBOX = 6, // scrollable list
|
||||
ITEM_TYPE_MODEL = 7, // model
|
||||
ITEM_TYPE_MODEL = 7, // model
|
||||
ITEM_TYPE_OWNERDRAW = 8, // owner draw, name specs what it is
|
||||
ITEM_TYPE_NUMERICFIELD = 9, // editable text, associated with a dvar
|
||||
ITEM_TYPE_SLIDER = 10, // mouse speed, volume, etc.
|
||||
ITEM_TYPE_YESNO = 11, // yes no dvar setting
|
||||
ITEM_TYPE_MULTI = 12, // multiple list setting, enumerated
|
||||
ITEM_TYPE_DVARENUM = 13, // multiple list setting, enumerated from a dvar
|
||||
ITEM_TYPE_YESNO = 11, // yes no dvar setting
|
||||
ITEM_TYPE_MULTI = 12, // multiple list setting, enumerated
|
||||
ITEM_TYPE_DVARENUM = 13, // multiple list setting, enumerated from a dvar
|
||||
ITEM_TYPE_BIND = 14, // bind
|
||||
ITEM_TYPE_MENUMODEL = 15, // special menu model
|
||||
ITEM_TYPE_VALIDFILEFIELD = 16, // text must be valid for use in a dos filename
|
||||
@ -430,7 +430,7 @@ enum MENU_FONT_TYPE{
|
||||
UI_FONT_DEFAULT = 0, // auto-chose betwen big/reg/small
|
||||
UI_FONT_NORMAL = 1,
|
||||
UI_FONT_BIG = 2,
|
||||
UI_GameFontMALL = 3,
|
||||
UI_FONT_SMALL = 3,
|
||||
UI_FONT_BOLD = 4,
|
||||
UI_FONT_CONSOLE = 5,
|
||||
UI_FONT_OBJECTIVE = 6,
|
||||
|
||||
@ -1,5 +1,15 @@
|
||||
/* ecrypt-portable.h */
|
||||
|
||||
/*
|
||||
* WARNING: the conversions defined below are implemented as macros,
|
||||
* and should be used carefully. They should NOT be used with
|
||||
* parameters which perform some action. E.g., the following two lines
|
||||
* are not equivalent:
|
||||
*
|
||||
* 1) ++x; y = ROTL32(x, n);
|
||||
* 2) y = ROTL32(++x, n);
|
||||
*/
|
||||
|
||||
/*
|
||||
* *** Please do not edit this file. ***
|
||||
*
|
||||
@ -17,10 +27,10 @@
|
||||
/*
|
||||
* The following types are defined (if available):
|
||||
*
|
||||
* u8: quint32eger type, at least 8 bits
|
||||
* u16: quint32eger type, at least 16 bits
|
||||
* u32: quint32eger type, at least 32 bits
|
||||
* u64: quint32eger type, at least 64 bits
|
||||
* u8: unsigned integer type, at least 8 bits
|
||||
* u16: unsigned integer type, at least 16 bits
|
||||
* u32: unsigned integer type, at least 32 bits
|
||||
* u64: unsigned integer type, at least 64 bits
|
||||
*
|
||||
* s8, s16, s32, s64 -> signed counterparts of u8, u16, u32, u64
|
||||
*
|
||||
|
||||
@ -1,35 +1,27 @@
|
||||
#include <QtCore>
|
||||
#include "encryption.h"
|
||||
#include "QtZlib/zlib.h"
|
||||
#include "ecrypt-sync.h"
|
||||
#include "sha1.h"
|
||||
#include "encryption.h"
|
||||
#include "compression.h"
|
||||
|
||||
static QVector<quint32> ivCounter(4, 1); // start all counters at 1
|
||||
|
||||
void Encryption::Convert32BitTo8Bit(quint32 value, quint8 *array)
|
||||
{
|
||||
void Encryption::Convert32BitTo8Bit(quint32 value, quint8 *array) {
|
||||
array[0] = static_cast<quint8>(value >> 0);
|
||||
array[1] = static_cast<quint8>(value >> 8);
|
||||
array[2] = static_cast<quint8>(value >> 16);
|
||||
array[3] = static_cast<quint8>(value >> 24);
|
||||
}
|
||||
|
||||
quint32 Encryption::ConvertArrayTo32Bit(const QByteArray &array)
|
||||
{
|
||||
quint32 Encryption::ConvertArrayTo32Bit(const QByteArray &array) {
|
||||
return ((static_cast<quint32>(static_cast<uchar>(array[0])) << 0) |
|
||||
(static_cast<quint32>(static_cast<uchar>(array[1])) << 8) |
|
||||
(static_cast<quint32>(static_cast<uchar>(array[2])) << 16) |
|
||||
(static_cast<quint32>(static_cast<uchar>(array[3])) << 24));
|
||||
}
|
||||
|
||||
quint32 Encryption::Rotate(quint32 value, quint32 numBits)
|
||||
{
|
||||
quint32 Encryption::Rotate(quint32 value, quint32 numBits) {
|
||||
return (value << numBits) | (value >> (32 - numBits));
|
||||
}
|
||||
|
||||
QByteArray Encryption::InitIVTable(const QByteArray &feed)
|
||||
{
|
||||
QByteArray Encryption::InitIVTable(const QByteArray &feed) {
|
||||
const int tableSize = 0xFB0;
|
||||
QByteArray table;
|
||||
table.resize(tableSize);
|
||||
@ -39,7 +31,7 @@ QByteArray Encryption::InitIVTable(const QByteArray &feed)
|
||||
if (static_cast<uchar>(feed.at(ptr)) == 0x00)
|
||||
ptr = 0;
|
||||
int base = i * 20 + x * 4;
|
||||
table[base] = feed.at(ptr);
|
||||
table[base] = feed.at(ptr);
|
||||
table[base + 1] = feed.at(ptr);
|
||||
table[base + 2] = feed.at(ptr);
|
||||
table[base + 3] = feed.at(ptr);
|
||||
@ -56,23 +48,22 @@ QByteArray Encryption::InitIVTable(const QByteArray &feed)
|
||||
return table;
|
||||
}
|
||||
|
||||
int Encryption::unk(quint64 arg1, quint8 arg2)
|
||||
{
|
||||
int Encryption::unk(quint64 arg1, quint8 arg2) {
|
||||
if (arg2 >= 0x40)
|
||||
return 0;
|
||||
return static_cast<int>(arg1 >> arg2);
|
||||
}
|
||||
|
||||
QByteArray Encryption::GetIV(const QByteArray &table, int index)
|
||||
{
|
||||
int num1 = (4 * index % 4 + 0xFA0) + index % 4 + (index - (index % 4));
|
||||
QByteArray Encryption::GetIV(const QByteArray &table, int index) {
|
||||
int num1 = 0xFA0 + index;
|
||||
int num2 = unk(0x51EB851FLL * num1, 0x20);
|
||||
int startIndex = 20 * (num1 - 200 * ((num2 >> 6) + (num2 >> 31)));
|
||||
int adjust = ((num2 >> 6) + (num2 >> 31));
|
||||
int startIndex = 20 * (num1 - 200 * adjust);
|
||||
// Return 8 bytes from that location.
|
||||
return table.mid(startIndex, 8);
|
||||
}
|
||||
|
||||
void Encryption::UpdateIVTable(QByteArray &table, int index, const QByteArray §ionHash)
|
||||
{
|
||||
void Encryption::UpdateIVTable(QByteArray &table, int index, const QByteArray §ionHash) {
|
||||
int blockNumIndex = index % 4;
|
||||
int baseOffset = 0xFA0 + blockNumIndex * 4;
|
||||
quint32 blockNumVal = (static_cast<uchar>(table.at(baseOffset)) ) |
|
||||
@ -86,7 +77,7 @@ void Encryption::UpdateIVTable(QByteArray &table, int index, const QByteArray &s
|
||||
int hashIndex = 0;
|
||||
for (int x = 0; x < 4; ++x) {
|
||||
table[startIndex - 1] = table.at(startIndex - 1) ^ sectionHash.at(hashIndex);
|
||||
table[startIndex] = table.at(startIndex) ^ sectionHash.at(hashIndex + 1);
|
||||
table[startIndex] = table.at(startIndex) ^ sectionHash.at(hashIndex + 1);
|
||||
table[startIndex + 1] = table.at(startIndex + 1) ^ sectionHash.at(hashIndex + 2);
|
||||
table[startIndex + 2] = table.at(startIndex + 2) ^ sectionHash.at(hashIndex + 3);
|
||||
table[startIndex + 3] = table.at(startIndex + 3) ^ sectionHash.at(hashIndex + 4);
|
||||
@ -95,9 +86,8 @@ void Encryption::UpdateIVTable(QByteArray &table, int index, const QByteArray &s
|
||||
}
|
||||
}
|
||||
|
||||
quint32 Encryption::ToUInt32(const QByteArray &data, int offset)
|
||||
{
|
||||
// Converts 4 bytes (starting at offset) from data into a 32-bit quint32eger (little-endian)
|
||||
quint32 Encryption::ToUInt32(const QByteArray &data, int offset) {
|
||||
// Converts 4 bytes (starting at offset) from data into a 32-bit unsigned integer (little-endian)
|
||||
return ((static_cast<quint32>(static_cast<uchar>(data[offset])) ) |
|
||||
(static_cast<quint32>(static_cast<uchar>(data[offset+1])) << 8 ) |
|
||||
(static_cast<quint32>(static_cast<uchar>(data[offset+2])) << 16) |
|
||||
@ -361,8 +351,96 @@ void Encryption::generateNewIV(int index, const QByteArray &hash, QByteArray &iv
|
||||
ivCounter[index]++;
|
||||
}
|
||||
|
||||
QByteArray Encryption::decryptFastFile_BO3(const QByteArray &fastFileData)
|
||||
QByteArray Encryption::decryptFastFile_BO2(const QByteArray &fastFileData)
|
||||
{
|
||||
const QByteArray bo2_salsa20_key = QByteArray::fromHex("641D8A2FE31D3AA63622BBC9CE8587229D42B0F8ED9B924130BF88B65EDC50BE");
|
||||
|
||||
QByteArray fileData = fastFileData;
|
||||
QByteArray finalFastFile;
|
||||
|
||||
QByteArray ivTable(16000, 0);
|
||||
fillIVTable(fileData, ivTable, 16000 - 1);
|
||||
|
||||
QVector<quint32> ivCounter(4, 1);
|
||||
QDataStream stream(fileData);
|
||||
stream.setByteOrder(QDataStream::LittleEndian);
|
||||
stream.skipRawData(0x138);
|
||||
|
||||
QByteArray sha1Hash(20, 0);
|
||||
QByteArray ivPtr(8, 0);
|
||||
int chunkIndex = 0;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
quint32 dataLength;
|
||||
stream >> dataLength;
|
||||
|
||||
if (dataLength == 0 || dataLength > fileData.size() - stream.device()->pos()) {
|
||||
qWarning() << "Invalid data length at offset: " << stream.device()->pos();
|
||||
break;
|
||||
}
|
||||
|
||||
fillIV(chunkIndex % 4, ivPtr, ivTable, ivCounter);
|
||||
|
||||
ECRYPT_ctx x;
|
||||
ECRYPT_keysetup(&x, reinterpret_cast<const u8*>(bo2_salsa20_key.constData()), 256, 0);
|
||||
ECRYPT_ivsetup(&x, reinterpret_cast<const u8*>(ivPtr.constData()));
|
||||
|
||||
QByteArray encryptedBlock = fileData.mid(stream.device()->pos(), dataLength);
|
||||
QByteArray decryptedBlock;
|
||||
decryptedBlock.resize(dataLength);
|
||||
|
||||
ECRYPT_decrypt_bytes(&x, reinterpret_cast<const u8*>(encryptedBlock.constData()),
|
||||
reinterpret_cast<u8*>(decryptedBlock.data()), dataLength);
|
||||
|
||||
QCryptographicHash sha1(QCryptographicHash::Sha1);
|
||||
sha1.addData(decryptedBlock);
|
||||
sha1Hash = sha1.result();
|
||||
|
||||
z_stream strm = {};
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = static_cast<uInt>(decryptedBlock.size());
|
||||
strm.next_in = reinterpret_cast<Bytef*>(decryptedBlock.data());
|
||||
|
||||
QByteArray decompressedData;
|
||||
decompressedData.resize(fmax(dataLength * 2, 4096));
|
||||
strm.avail_out = decompressedData.size();
|
||||
strm.next_out = reinterpret_cast<Bytef*>(decompressedData.data());
|
||||
|
||||
int zReturn = inflateInit2(&strm, -15);
|
||||
if (zReturn != Z_OK) {
|
||||
qWarning() << "inflateInit2 failed with error code" << zReturn;
|
||||
break;
|
||||
}
|
||||
|
||||
zReturn = inflate(&strm, Z_FINISH);
|
||||
inflateEnd(&strm);
|
||||
|
||||
if (zReturn != Z_STREAM_END) {
|
||||
qDebug() << "Error decompressing at offset: " << stream.device()->pos() << " : " << zReturn;
|
||||
decompressedData.clear();
|
||||
} else {
|
||||
decompressedData.resize(strm.total_out);
|
||||
}
|
||||
|
||||
finalFastFile.append(decompressedData);
|
||||
|
||||
generateNewIV(chunkIndex % 4, sha1Hash, ivTable, ivCounter);
|
||||
|
||||
if (stream.device()->pos() + static_cast<qint64>(dataLength) > fileData.size()) {
|
||||
qWarning() << "Skipping past file size!";
|
||||
break;
|
||||
}
|
||||
|
||||
stream.skipRawData(dataLength);
|
||||
chunkIndex++;
|
||||
}
|
||||
|
||||
return finalFastFile;
|
||||
}
|
||||
|
||||
QByteArray Encryption::decryptFastFile_BO3(const QByteArray &fastFileData) {
|
||||
const QByteArray salsaKey = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
|
||||
QByteArray ivTable(0xFB0, 0);
|
||||
@ -426,71 +504,3 @@ QByteArray Encryption::decryptFastFile_BO3(const QByteArray &fastFileData)
|
||||
|
||||
return finalFastFile;
|
||||
}
|
||||
|
||||
QByteArray Encryption::DecryptFile(const QByteArray &fastFileData, const QString &aFileName, const QByteArray &aKey)
|
||||
{
|
||||
Q_UNUSED(aFileName);
|
||||
|
||||
const QByteArray salsaKey = QByteArray::fromHex(aKey);
|
||||
|
||||
QByteArray ivTable(0xFB0, 0);
|
||||
fillIVTable(fastFileData, ivTable, 0xFB0 - 1);
|
||||
|
||||
QVector<quint32> ivCounter(4, 1);
|
||||
QDataStream stream(fastFileData);
|
||||
stream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
QByteArray finalFastFile;
|
||||
QByteArray sha1Hash(20, 0);
|
||||
QByteArray ivPtr(8, 0);
|
||||
int chunkIndex = 0;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
if (stream.device()->bytesAvailable() < 4) {
|
||||
qWarning() << "No sufficient data for chunk size at offset:" << stream.device()->pos();
|
||||
break;
|
||||
}
|
||||
|
||||
quint32 dataLength;
|
||||
stream >> dataLength;
|
||||
|
||||
if (dataLength == 0 || dataLength > fastFileData.size() - stream.device()->pos()) {
|
||||
qWarning() << "Invalid data length at offset:" << stream.device()->pos();
|
||||
break;
|
||||
}
|
||||
|
||||
fillIV(chunkIndex % 4, ivPtr, ivTable, ivCounter);
|
||||
|
||||
ECRYPT_ctx x;
|
||||
ECRYPT_keysetup(&x, reinterpret_cast<const u8*>(salsaKey.constData()), 256, 0);
|
||||
ECRYPT_ivsetup(&x, reinterpret_cast<const u8*>(ivPtr.constData()));
|
||||
|
||||
QByteArray encryptedBlock = fastFileData.mid(stream.device()->pos(), dataLength);
|
||||
QByteArray decryptedBlock(dataLength, Qt::Uninitialized);
|
||||
|
||||
ECRYPT_decrypt_bytes(&x,
|
||||
reinterpret_cast<const u8*>(encryptedBlock.constData()),
|
||||
reinterpret_cast<u8*>(decryptedBlock.data()),
|
||||
dataLength);
|
||||
|
||||
// SHA1 hash update
|
||||
sha1Hash = QCryptographicHash::hash(decryptedBlock, QCryptographicHash::Sha1);
|
||||
|
||||
// Decompress (ZLIB raw DEFLATE)
|
||||
QByteArray decompressedData = Compression::DecompressDeflate(decryptedBlock);
|
||||
if (decompressedData.isEmpty()) {
|
||||
qWarning() << "Failed decompression at chunk index:" << chunkIndex;
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
finalFastFile.append(decompressedData);
|
||||
|
||||
// Update IV table using SHA1
|
||||
generateNewIV(chunkIndex % 4, sha1Hash, ivTable, ivCounter);
|
||||
|
||||
stream.skipRawData(dataLength);
|
||||
chunkIndex++;
|
||||
}
|
||||
|
||||
return finalFastFile;
|
||||
}
|
||||
|
||||
@ -46,9 +46,8 @@ public:
|
||||
|
||||
static void generateNewIV(int index, const QByteArray& hash, QByteArray& ivTable, QVector<quint32>& ivCounter);
|
||||
|
||||
//static QByteArray decryptFastFile_BO2(const QByteArray& fastFileData);
|
||||
static QByteArray decryptFastFile_BO2(const QByteArray& fastFileData);
|
||||
static QByteArray decryptFastFile_BO3(const QByteArray& fastFileData);
|
||||
static QByteArray DecryptFile(const QByteArray& fastFileData, const QString& aFileName, const QByteArray& aKey);
|
||||
};
|
||||
|
||||
#endif // ENCRYPTION_H
|
||||
|
||||
@ -2,8 +2,20 @@ QT += core
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib c++17
|
||||
|
||||
SOURCES += $$files($$PWD/*.cpp, true)
|
||||
HEADERS += $$files($$PWD/*.h, true)
|
||||
SOURCES += \
|
||||
salsa20.cpp \
|
||||
sha1.cpp \
|
||||
encryption.cpp
|
||||
|
||||
HEADERS += \
|
||||
ecrypt-config.h \
|
||||
ecrypt-machine.h \
|
||||
ecrypt-portable.h \
|
||||
ecrypt-sync.h \
|
||||
encryption.h \
|
||||
os_types.h \
|
||||
config_win32.h \
|
||||
sha1.h
|
||||
|
||||
app.depends += \
|
||||
compression
|
||||
|
||||
@ -59,7 +59,7 @@ void ECRYPT_encrypt_bytes(ECRYPT_ctx *x,const u8 *m,u8 *c,u32 bytes)
|
||||
u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
|
||||
u8 *ctarget;
|
||||
u8 tmp[64];
|
||||
u32 i;
|
||||
unsigned int i;
|
||||
|
||||
if (!bytes) return;
|
||||
|
||||
@ -82,10 +82,7 @@ void ECRYPT_encrypt_bytes(ECRYPT_ctx *x,const u8 *m,u8 *c,u32 bytes)
|
||||
|
||||
for (;;) {
|
||||
if (bytes < 64) {
|
||||
for (i = 0; i < bytes; ++i)
|
||||
{
|
||||
tmp[i] = m[i];
|
||||
}
|
||||
for (i = 0;i < bytes;++i) tmp[i] = m[i];
|
||||
m = tmp;
|
||||
ctarget = c;
|
||||
c = tmp;
|
||||
|
||||
@ -10,7 +10,7 @@ Still 100% Public Domain
|
||||
|
||||
Corrected a problem which generated improper hash values on 16 bit machines
|
||||
Routine SHA1Update changed from
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, quint32
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int
|
||||
len)
|
||||
to
|
||||
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned
|
||||
@ -27,7 +27,7 @@ be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
|
||||
"a"s).
|
||||
|
||||
I also changed the declaration of variables i & j in SHA1Update to
|
||||
unsigned long from quint32 for the same reason.
|
||||
unsigned long from unsigned int for the same reason.
|
||||
|
||||
These changes should make no difference to any 32 bit implementations since
|
||||
an
|
||||
@ -94,6 +94,7 @@ void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
|
||||
|
||||
/* blk0() and blk() perform the initial expand. */
|
||||
/* I got the idea of expanding during the round function from SSLeay */
|
||||
/* FIXME: can we do this in an endian-proof way? */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define blk0(i) block->l[i]
|
||||
#else
|
||||
|
||||
@ -36,7 +36,7 @@ FastFile_COD10_360::~FastFile_COD10_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD10_360::GetBinaryData() const {
|
||||
QByteArray FastFile_COD10_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -69,9 +69,15 @@ bool FastFile_COD10_360::Load(const QString aFilePath) {
|
||||
bool FastFile_COD10_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Create a XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// For COD7/COD9, use BigEndian.
|
||||
fastFileStream.setByteOrder(QDataStream::BigEndian);
|
||||
|
||||
// Select key based on game.
|
||||
QByteArray key = QByteArray::fromHex("0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
|
||||
// Read the 8-byte magic.
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
@ -90,7 +96,7 @@ bool FastFile_COD10_360::Load(const QByteArray aData) {
|
||||
QByteArray rsaSignature(256, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(rsaSignature.data(), 256);
|
||||
|
||||
decompressedData = Encryption::DecryptFile(aData, fileName, "0E50F49F412317096038665622DD091332A209BA0A05A00E1377CEDB0A3CB1D3");
|
||||
decompressedData = Encryption::decryptFastFile_BO2(aData);
|
||||
|
||||
// For COD9, write out the complete decompressed zone for testing.
|
||||
QFile testFile("exports/" + GetBaseStem() + ".zone");
|
||||
@ -98,16 +104,12 @@ bool FastFile_COD10_360::Load(const QByteArray aData) {
|
||||
testFile.write(decompressedData);
|
||||
testFile.close();
|
||||
}
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD10_360* zoneFile = new ZoneFile_COD10_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
ZoneFile_COD10_360 zoneFile;
|
||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD10_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ public:
|
||||
FastFile_COD10_360(const QString aFilePath);
|
||||
~FastFile_COD10_360();
|
||||
|
||||
QByteArray GetBinaryData() const override;
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
|
||||
@ -38,7 +38,7 @@ FastFile_COD11_360::~FastFile_COD11_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD11_360::GetBinaryData() const {
|
||||
QByteArray FastFile_COD11_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -68,84 +68,40 @@ bool FastFile_COD11_360::Load(const QString aFilePath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
enum DB_CompressorType : qint32
|
||||
{
|
||||
DB_COMPRESSOR_INVALID = 0x0,
|
||||
DB_COMPRESSOR_ZLIB = 0x1,
|
||||
DB_COMPRESSOR_LZX = 0x2,
|
||||
DB_COMPRESSOR_PASSTHROUGH = 0x3,
|
||||
};
|
||||
|
||||
bool FastFile_COD11_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Prepare data stream for parsing
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Verify magic header
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
quint32 version = fastFileStream.ParseUInt32();
|
||||
|
||||
fastFileStream.skipRawData(1);
|
||||
|
||||
DB_CompressorType compressorType = (DB_CompressorType)fastFileStream.ParseInt8();
|
||||
|
||||
fastFileStream.skipRawData(10);
|
||||
|
||||
qint32 blockCount = fastFileStream.ParseInt32();
|
||||
|
||||
if (version != 1838)
|
||||
{
|
||||
qWarning() << "Invalid fast file version:" << version << "!";
|
||||
if (fileMagic != "TAff0000") {
|
||||
qWarning() << "Invalid fast file magic for COD12!";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (blockCount > 17280)
|
||||
{
|
||||
qWarning() << "Fast file has too many blocks:" << blockCount << "> 17280!";
|
||||
return false;
|
||||
}
|
||||
fastFileStream.skipRawData(12 * blockCount);
|
||||
// Skip: File size (4 bytes), flags/version (4 bytes), unknown (8 bytes), build tag (32 bytes), RSA signature (256 bytes)
|
||||
fastFileStream.skipRawData(4 + 4 + 8 + 32 + 256); // total 304 bytes skipped so far + 8 bytes magic = 312 bytes at correct position.
|
||||
|
||||
qint32 startPos = fastFileStream.ParseInt32();
|
||||
Q_UNUSED(startPos);
|
||||
// Correctly positioned at 0x138
|
||||
QByteArray encryptedData = aData.mid(0x138);
|
||||
decompressedData = Encryption::decryptFastFile_BO3(encryptedData);
|
||||
|
||||
qint32 endPos = fastFileStream.ParseInt32();
|
||||
Q_UNUSED(endPos);
|
||||
|
||||
if (fileMagic == "S1ffu100")
|
||||
{
|
||||
QByteArray compressedData = aData.mid(fastFileStream.device()->pos());
|
||||
if (compressorType == DB_COMPRESSOR_ZLIB)
|
||||
{
|
||||
decompressedData = Compression::DecompressZLIB(compressedData);
|
||||
}
|
||||
else if (compressorType == DB_COMPRESSOR_LZX)
|
||||
{
|
||||
decompressedData = Compression::DecompressXMem(compressedData, 0, 0x80000, 0);
|
||||
}
|
||||
}
|
||||
else if (fileMagic == "S1ff0100")
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "Invalid fast file magic:" << fileMagic << "!";
|
||||
return false;
|
||||
}
|
||||
// Output for verification/testing
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with decompressed data
|
||||
ZoneFile_COD11_360* zoneFile = new ZoneFile_COD11_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
ZoneFile_COD11_360 zoneFile;
|
||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile.Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD11_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ public:
|
||||
FastFile_COD11_360(const QString aFilePath);
|
||||
~FastFile_COD11_360();
|
||||
|
||||
QByteArray GetBinaryData() const override;
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
|
||||
@ -38,7 +38,7 @@ FastFile_COD12_360::~FastFile_COD12_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD12_360::GetBinaryData() const {
|
||||
QByteArray FastFile_COD12_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -72,80 +72,36 @@ bool FastFile_COD12_360::Load(const QByteArray aData) {
|
||||
QByteArray decompressedData;
|
||||
|
||||
// Prepare data stream for parsing
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
// Skip header magic
|
||||
fastFileStream.skipRawData(8);
|
||||
|
||||
quint32 version;
|
||||
fastFileStream >> version;
|
||||
|
||||
quint8 unknownFlag, compressionFlag, platformFlag, encryptionFlag;
|
||||
fastFileStream >> unknownFlag >> compressionFlag >> platformFlag >> encryptionFlag;
|
||||
|
||||
if (compressionFlag != 1) {
|
||||
qDebug() << "Invalid fastfile compression: " << compressionFlag;
|
||||
return false;
|
||||
} else if (platformFlag != 4) {
|
||||
qDebug() << "Invalid platform: " << platformFlag;
|
||||
return false;
|
||||
} else if (encryptionFlag != 0) {
|
||||
qDebug() << "Decryption not supported yet!";
|
||||
// Verify magic header
|
||||
QByteArray fileMagic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(fileMagic.data(), 8);
|
||||
if (fileMagic != "TAff0000") {
|
||||
qWarning() << "Invalid fast file magic for COD12!";
|
||||
return false;
|
||||
}
|
||||
|
||||
fastFileStream.skipRawData(128);
|
||||
// Skip: File size (4 bytes), flags/version (4 bytes), unknown (8 bytes), build tag (32 bytes), RSA signature (256 bytes)
|
||||
fastFileStream.skipRawData(4 + 4 + 8 + 32 + 256); // total 304 bytes skipped so far + 8 bytes magic = 312 bytes at correct position.
|
||||
|
||||
quint64 size;
|
||||
fastFileStream >> size;
|
||||
// Correctly positioned at 0x138
|
||||
QByteArray encryptedData = aData.mid(0x138);
|
||||
decompressedData = Encryption::decryptFastFile_BO3(encryptedData);
|
||||
|
||||
fastFileStream.skipRawData(432);
|
||||
|
||||
int consumed = 0;
|
||||
while(consumed < size)
|
||||
{
|
||||
// Read Block Header
|
||||
quint32 compressedSize, decompressedSize, blockSize, blockPosition;
|
||||
fastFileStream >> compressedSize >> decompressedSize >> blockSize >> blockPosition;
|
||||
|
||||
// Validate the block position, it should match
|
||||
if(blockPosition != fastFileStream.device()->pos() - 16)
|
||||
{
|
||||
qDebug() << "Block Position does not match Stream Position.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for padding blocks
|
||||
if(decompressedSize == 0)
|
||||
{
|
||||
fastFileStream.device()->read((((fastFileStream.device()->pos()) + ((0x800000) - 1)) & ~((0x800000) - 1)) - fastFileStream.device()->pos());
|
||||
continue;
|
||||
}
|
||||
|
||||
fastFileStream.device()->read(2);
|
||||
|
||||
QByteArray compressedData(compressedSize - 2, Qt::Uninitialized);
|
||||
qDebug() << "Data position: " << fastFileStream.device()->pos() << " - Size: " << compressedSize;
|
||||
fastFileStream.readRawData(compressedData.data(), compressedSize - 2);
|
||||
decompressedData.append(Compression::DecompressDeflate(compressedData));
|
||||
|
||||
consumed += decompressedSize;
|
||||
|
||||
// Sinze Fast Files are aligns, we must skip the full block
|
||||
fastFileStream.device()->seek(blockPosition + 16 + blockSize);
|
||||
}
|
||||
// Output for verification/testing
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with decompressed data
|
||||
ZoneFile_COD12_360* zoneFile = new ZoneFile_COD12_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
ZoneFile_COD12_360 zoneFile;
|
||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile.Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD12_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ public:
|
||||
FastFile_COD12_360(const QString aFilePath);
|
||||
~FastFile_COD12_360();
|
||||
|
||||
QByteArray GetBinaryData() const override;
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
|
||||
@ -38,7 +38,7 @@ FastFile_COD2_360::~FastFile_COD2_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD2_360::GetBinaryData() const {
|
||||
QByteArray FastFile_COD2_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -68,9 +68,9 @@ bool FastFile_COD2_360::Load(const QString aFilePath) {
|
||||
}
|
||||
|
||||
bool FastFile_COD2_360::Load(const QByteArray aData) {
|
||||
// Create a XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
Utils::ReadUntilHex(&fastFileStream, "78");
|
||||
QByteArray compressedData = aData.mid(fastFileStream.device()->pos());
|
||||
@ -79,13 +79,10 @@ bool FastFile_COD2_360::Load(const QByteArray aData) {
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
// Load the zone file with the decompressed data (using an Xbox platform flag).
|
||||
ZoneFile_COD2_360* zoneFile = new ZoneFile_COD2_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
ZoneFile_COD2_360 zoneFile;
|
||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD2_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ public:
|
||||
FastFile_COD2_360(const QString aFilePath);
|
||||
~FastFile_COD2_360();
|
||||
|
||||
QByteArray GetBinaryData() const override;
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
|
||||
@ -39,7 +39,7 @@ FastFile_COD4_360::~FastFile_COD4_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD4_360::GetBinaryData() const {
|
||||
QByteArray FastFile_COD4_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -80,9 +80,9 @@ bool FastFile_COD4_360::Load(const QByteArray aData) {
|
||||
// For COD5, simply decompress from offset 12.
|
||||
decompressedData = Compression::DecompressZLIB(aData.mid(12));
|
||||
} else if (header == "IWff0100") {
|
||||
// Create a XDataStream on the input data.
|
||||
XDataStream fastFileStream(aData.mid(12));
|
||||
fastFileStream.setByteOrder(XDataStream::LittleEndian);
|
||||
// Create a QDataStream on the input data.
|
||||
QDataStream fastFileStream(aData.mid(12));
|
||||
fastFileStream.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
QByteArray magic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(magic.data(), 8);
|
||||
@ -126,15 +126,14 @@ bool FastFile_COD4_360::Load(const QByteArray aData) {
|
||||
}
|
||||
decompressedData = Compression::DecompressZLIB(compressedData);
|
||||
}
|
||||
|
||||
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD4_360* zoneFile = new ZoneFile_COD4_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
ZoneFile_COD4_360 zoneFile;
|
||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD4_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ public:
|
||||
FastFile_COD4_360(const QString aFilePath);
|
||||
~FastFile_COD4_360();
|
||||
|
||||
QByteArray GetBinaryData() const override;
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
|
||||
@ -39,7 +39,7 @@ FastFile_COD5_360::~FastFile_COD5_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD5_360::GetBinaryData() const {
|
||||
QByteArray FastFile_COD5_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -80,13 +80,10 @@ bool FastFile_COD5_360::Load(const QByteArray aData) {
|
||||
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD5_360* zoneFile = new ZoneFile_COD5_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
SetZoneFile(zoneFile);
|
||||
ZoneFile_COD5_360 zoneFile;
|
||||
zoneFile.SetStem(GetBaseStem() + ".zone");
|
||||
zoneFile.Load(decompressedData);
|
||||
SetZoneFile(std::make_shared<ZoneFile_COD5_360>(zoneFile));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ public:
|
||||
FastFile_COD5_360(const QString aFilePath);
|
||||
~FastFile_COD5_360();
|
||||
|
||||
QByteArray GetBinaryData() const override;
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
|
||||
@ -39,7 +39,7 @@ FastFile_COD6_360::~FastFile_COD6_360() {
|
||||
|
||||
}
|
||||
|
||||
QByteArray FastFile_COD6_360::GetBinaryData() const {
|
||||
QByteArray FastFile_COD6_360::GetBinaryData() {
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
@ -70,55 +70,39 @@ bool FastFile_COD6_360::Load(const QString aFilePath) {
|
||||
}
|
||||
|
||||
bool FastFile_COD6_360::Load(const QByteArray aData) {
|
||||
XDataStream fastFileStream(aData);
|
||||
fastFileStream.setByteOrder(XDataStream::BigEndian);
|
||||
|
||||
QByteArray magic(8, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(magic.data(), 8);
|
||||
|
||||
quint32 version = fastFileStream.ParseUInt32();
|
||||
|
||||
if (version != 269)
|
||||
const qint64 zlibOffset = Compression::FindZlibOffset(aData);
|
||||
if (zlibOffset == -1)
|
||||
{
|
||||
qDebug() << QString("Invalid version: %1!").arg(version);
|
||||
qWarning() << "Z-Lib stream not found";
|
||||
return false;
|
||||
}
|
||||
QByteArray compressed = aData.mid(zlibOffset);
|
||||
|
||||
// 2. Try plain decompression first ------------------------------
|
||||
QByteArray decompressed = Compression::DecompressZLIB(compressed);
|
||||
|
||||
// 3. If that failed or looks too small, try stripping hash blocks
|
||||
if (decompressed.isEmpty() || decompressed.size() < 1024)
|
||||
{
|
||||
QByteArray stripped = Compression::StripHashBlocks(compressed);
|
||||
QByteArray retry = Compression::DecompressZLIB(stripped);
|
||||
if (!retry.isEmpty())
|
||||
decompressed.swap(retry);
|
||||
}
|
||||
|
||||
if (decompressed.isEmpty())
|
||||
{
|
||||
qWarning() << "Unable to decompress fast-file";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool localPatch = fastFileStream.ParseBool();
|
||||
Q_UNUSED(localPatch);
|
||||
// Optional – keep a copy on disk for quick inspection
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressed);
|
||||
|
||||
quint8 compressor = fastFileStream.ParseUInt8();
|
||||
Q_UNUSED(compressor);
|
||||
|
||||
// Skip fastfile date/time
|
||||
fastFileStream.skipRawData(11);
|
||||
|
||||
quint32 hashCount = fastFileStream.ParseUInt32();
|
||||
fastFileStream.skipRawData(12 * hashCount);
|
||||
|
||||
fastFileStream.skipRawData(8);
|
||||
|
||||
QByteArray decompressedData;
|
||||
if (magic == "IWff0100")
|
||||
{
|
||||
|
||||
}
|
||||
else if (magic == "IWffu100")
|
||||
{
|
||||
quint32 zlibSize = aData.size() - fastFileStream.device()->pos();
|
||||
QByteArray zlibData(zlibSize, Qt::Uninitialized);
|
||||
fastFileStream.readRawData(zlibData.data(), zlibSize);
|
||||
|
||||
decompressedData = Compression::DecompressZLIB(zlibData);
|
||||
}
|
||||
Utils::ExportData(GetBaseStem() + ".zone", decompressedData);
|
||||
|
||||
ZoneFile_COD6_360* zoneFile = new ZoneFile_COD6_360();
|
||||
zoneFile->SetStem(GetBaseStem() + ".zone");
|
||||
if (!zoneFile->Load(decompressedData)) {
|
||||
qWarning() << "Failed to load ZoneFile!";
|
||||
return false;
|
||||
}
|
||||
// 4. Forward to zone-file loader --------------------------------
|
||||
auto zoneFile = std::make_shared<ZoneFile_COD6_360>();
|
||||
zoneFile->SetStem(GetStem());
|
||||
zoneFile->Load(decompressed);
|
||||
SetZoneFile(zoneFile);
|
||||
|
||||
return true;
|
||||
|
||||
@ -11,7 +11,7 @@ public:
|
||||
FastFile_COD6_360(const QString aFilePath);
|
||||
~FastFile_COD6_360();
|
||||
|
||||
QByteArray GetBinaryData() const override;
|
||||
QByteArray GetBinaryData() override;
|
||||
|
||||
bool Load(const QString aFilePath) override;
|
||||
bool Load(const QByteArray aData) override;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user