Skip to content

Commit 4f94cf9

Browse files
committed
fixups
1 parent e0e65af commit 4f94cf9

File tree

5 files changed

+63
-63
lines changed

5 files changed

+63
-63
lines changed

CMakeLists.txt

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
cmake_minimum_required(VERSION 3.24)
22

3+
set(CMAKE_CXX_STANDARD 23)
4+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
5+
6+
if(APPLE)
7+
enable_language(OBJC)
8+
set(CMAKE_OSX_DEPLOYMENT_TARGET 14)
9+
endif()
10+
311
project(BB_Launcher LANGUAGES CXX)
412

513
option(FORCE_UAC "Requires running as Admin on Windows" ON)
@@ -31,29 +39,55 @@ if (APPLE AND ARCHITECTURE STREQUAL "x86_64" AND CMAKE_SYSTEM_PROCESSOR STREQUAL
3139
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
3240
endif()
3341

34-
set(CMAKE_AUTOUIC ON)
35-
set(CMAKE_AUTOMOC ON)
36-
set(CMAKE_AUTORCC ON)
42+
# Setup a custom clang-format target (if clang-format can be found) that will run
43+
# against all the src files. This should be used before making a pull request.
3744

38-
set(CMAKE_CXX_STANDARD 23)
39-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
45+
if (CLANG_FORMAT)
46+
set(SRCS ${PROJECT_SOURCE_DIR)
47+
set(CCOMMENT "Running clang format against all the .h and .cpp files in src/")
48+
if (WIN32)
49+
add_custom_target(clang-format
50+
COMMAND powershell.exe -Command "Get-ChildItem '${SRCS}/*' -Include *.cpp,*.h,*.mm -Recurse | Foreach {&'${CLANG_FORMAT}' -i $_.fullname}"
51+
COMMENT ${CCOMMENT})
52+
else()
53+
add_custom_target(clang-format
54+
COMMAND find ${SRCS} -iname *.h -o -iname *.cpp -o -iname *.mm | xargs ${CLANG_FORMAT} -i
55+
COMMENT ${CCOMMENT})
56+
endif()
57+
unset(SRCS)
58+
unset(CCOMMENT)
59+
endif()
4060

41-
if(APPLE)
42-
enable_language(OBJC)
43-
set(CMAKE_OSX_DEPLOYMENT_TARGET 14)
61+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
62+
63+
# generate git revision information
64+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/settings/updater/cmake-modules/")
65+
include(GetGitRevisionDescription)
66+
get_git_head_revision(GIT_REF_SPEC GIT_REV)
67+
git_describe(GIT_DESC --always --long --dirty)
68+
git_branch_name(GIT_BRANCH)
69+
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")
70+
71+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/settings/updater/BuildInfo.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/settings/updater/BuildInfo.cpp" @ONLY)
72+
73+
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT MSVC)
74+
find_package(cryptopp 8.9.0 MODULE)
4475
endif()
4576

77+
add_subdirectory(externals)
78+
4679
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Network)
4780
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Network)
4881

82+
set(CMAKE_AUTOUIC ON)
83+
set(CMAKE_AUTOMOC ON)
84+
set(CMAKE_AUTORCC ON)
85+
86+
4987
if (UNIX AND NOT APPLE)
5088
find_package(OpenSSL REQUIRED)
5189
endif()
5290

53-
add_subdirectory(externals)
54-
55-
qt_add_resources(RESOURCE_FILES dist/BBLauncher.qrc)
56-
5791
set(PROJECT_SOURCES
5892
main.cpp
5993
modules/bblauncher.cpp
@@ -108,40 +142,7 @@ set(PROJECT_SOURCES
108142
${RESOURCE_FILES}
109143
)
110144

111-
# Setup a custom clang-format target (if clang-format can be found) that will run
112-
# against all the src files. This should be used before making a pull request.
113-
114-
if (CLANG_FORMAT)
115-
set(SRCS ${PROJECT_SOURCE_DIR)
116-
set(CCOMMENT "Running clang format against all the .h and .cpp files in src/")
117-
if (WIN32)
118-
add_custom_target(clang-format
119-
COMMAND powershell.exe -Command "Get-ChildItem '${SRCS}/*' -Include *.cpp,*.h,*.mm -Recurse | Foreach {&'${CLANG_FORMAT}' -i $_.fullname}"
120-
COMMENT ${CCOMMENT})
121-
else()
122-
add_custom_target(clang-format
123-
COMMAND find ${SRCS} -iname *.h -o -iname *.cpp -o -iname *.mm | xargs ${CLANG_FORMAT} -i
124-
COMMENT ${CCOMMENT})
125-
endif()
126-
unset(SRCS)
127-
unset(CCOMMENT)
128-
endif()
129-
130-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
131-
132-
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR NOT MSVC)
133-
find_package(cryptopp 8.9.0 MODULE)
134-
endif()
135-
136-
# generate git revision information
137-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/settings/updater/cmake-modules/")
138-
include(GetGitRevisionDescription)
139-
get_git_head_revision(GIT_REF_SPEC GIT_REV)
140-
git_describe(GIT_DESC --always --long --dirty)
141-
git_branch_name(GIT_BRANCH)
142-
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")
143-
144-
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/settings/updater/BuildInfo.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/settings/updater/BuildInfo.cpp" @ONLY)
145+
qt_add_resources(RESOURCE_FILES dist/BBLauncher.qrc)
145146

146147
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
147148
qt_add_executable(BB_Launcher
@@ -159,10 +160,12 @@ else()
159160
endif()
160161
endif()
161162

162-
if (UNIX AND NOT APPLE)
163-
target_link_libraries(BB_Launcher PRIVATE ${OPENSSL_LIBRARIES})
163+
if (WIN32)
164+
target_sources(BB_Launcher PRIVATE dist/bblauncher.rc)
164165
endif()
165166

167+
target_include_directories(BB_Launcher PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
168+
166169
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC)
167170
target_link_libraries(BB_Launcher PRIVATE cryptoppwin)
168171
else()
@@ -193,16 +196,14 @@ set_target_properties(BB_Launcher PROPERTIES
193196
set_source_files_properties(dist/BBIcon.icns PROPERTIES
194197
MACOSX_PACKAGE_LOCATION Resources)
195198

196-
if (WIN32)
197-
target_sources(BB_Launcher PRIVATE dist/bblauncher.rc)
198-
endif()
199-
200199
if (WIN32 AND FORCE_UAC)
201200
SET_TARGET_PROPERTIES(BB_Launcher PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" ")
202201
add_definitions(-DFORCE_UAC)
203202
endif()
204203

205-
target_include_directories(BB_Launcher PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
204+
if (UNIX AND NOT APPLE)
205+
target_link_libraries(BB_Launcher PRIVATE ${OPENSSL_LIBRARIES})
206+
endif()
206207

207208
install(TARGETS BB_Launcher BUNDLE DESTINATION .)
208209

modules/TrophyDeps/io_file.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#define ftello _ftelli64
2222
#endif
2323

24-
namespace Common {
24+
namespace Common::FS {
2525

2626
namespace fs = std::filesystem;
2727

@@ -426,4 +426,4 @@ u64 GetDirectorySize(const std::filesystem::path& path) {
426426
return total;
427427
}
428428

429-
} // namespace Common
429+
} // namespace Common::FS

modules/TrophyDeps/io_file.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using u32 = std::uint32_t;
1616
using u64 = std::uint64_t;
1717
using s64 = std::int64_t;
1818

19-
namespace Common {
19+
namespace Common::FS {
2020

2121
enum class FileAccessMode {
2222
/**
@@ -227,4 +227,4 @@ class IOFile final {
227227

228228
u64 GetDirectorySize(const std::filesystem::path& path);
229229

230-
} // namespace Common
230+
} // namespace Common::FS

modules/TrophyDeps/trp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TRP::~TRP() = default;
99

1010
void TRP::GetNPcommID(const std::filesystem::path& trophyPath, int index) {
1111
std::filesystem::path trpPath = trophyPath / "sce_sys/npbind.dat";
12-
Common::IOFile npbindFile(trpPath, Common::FileAccessMode::Read);
12+
Common::FS::IOFile npbindFile(trpPath, Common::FS::FileAccessMode::Read);
1313
if (!npbindFile.IsOpen()) {
1414
// LOG_CRITICAL(Common_Filesystem, "Failed to open npbind.dat file");
1515
return;
@@ -59,7 +59,7 @@ bool TRP::Extract(const std::filesystem::path& trophyPath, const std::string tit
5959
if (it.is_regular_file()) {
6060
GetNPcommID(trophyPath, index);
6161

62-
Common::IOFile file(it.path(), Common::FileAccessMode::Read);
62+
Common::FS::IOFile file(it.path(), Common::FS::FileAccessMode::Read);
6363
if (!file.IsOpen()) {
6464
// LOG_CRITICAL(Common_Filesystem, "Unable to open trophy file for read");
6565
return false;
@@ -94,7 +94,7 @@ bool TRP::Extract(const std::filesystem::path& trophyPath, const std::string tit
9494
}
9595
std::vector<u8> icon(entry.entry_len);
9696
file.Read(icon);
97-
Common::IOFile::WriteBytes(trpFilesPath / "Icons" / name, icon);
97+
Common::FS::IOFile::WriteBytes(trpFilesPath / "Icons" / name, icon);
9898
}
9999
if (entry.flag == 3 && np_comm_id[0] == 'N' &&
100100
np_comm_id[1] == 'P') { // ESFM, encrypted.
@@ -120,7 +120,7 @@ bool TRP::Extract(const std::filesystem::path& trophyPath, const std::string tit
120120
if (pos != std::string::npos)
121121
xml_name.replace(pos, xml_name.length(), "XML");
122122
std::filesystem::path path = trpFilesPath / "Xml" / xml_name;
123-
size_t written = Common::IOFile::WriteBytes(path, XML);
123+
size_t written = Common::FS::IOFile::WriteBytes(path, XML);
124124
if (written != XML.size()) {
125125
// LOG_CRITICAL(
126126
// Common_Filesystem,

modules/TrophyManager.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class TrophyViewer : public QMainWindow {
2222
Q_OBJECT
2323
public:
2424
explicit TrophyViewer(QString trophyPath, QString gameTrpPath);
25-
~TrophyViewer();
2625

2726
private:
2827
void PopulateTrophyWidget(QString title);
@@ -31,7 +30,7 @@ class TrophyViewer : public QMainWindow {
3130
QTabWidget* tabWidget = nullptr;
3231
QStringList headers;
3332
QString gameTrpPath_;
34-
// TRP trp;
33+
TRP trp;
3534

3635
QString GetTrpType(const QChar trp_) {
3736
switch (trp_.toLatin1()) {

0 commit comments

Comments
 (0)