Skip to content

Commit fc96476

Browse files
committed
fix fw version generation
1 parent eda9384 commit fc96476

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

tests/ps4_package.cmake

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
function(create_pkg pkg_title_id fw_major fw_minor src_files)
2-
# Pad FW_MINOR to 2 digits
3-
if(${fw_minor} LESS 10)
4-
set(FW_MINOR_PADDED "0${fw_minor}")
5-
else()
6-
set(FW_MINOR_PADDED "${fw_minor}")
7-
endif()
2+
# Create fw version
3+
set(fw_major_hex "0x${fw_major}")
4+
set(fw_minor_hex "0x${fw_minor}")
85

9-
set(FW_VERSION_HEX_STR "0x${fw_major}${FW_MINOR_PADDED}00000")
10-
math(EXPR FW_VERSION_HEX "${FW_VERSION_HEX_STR}")
6+
math(EXPR FW_VERSION_INT "(${fw_major_hex} << 24) | ${fw_minor_hex} << 16")
7+
8+
execute_process(
9+
COMMAND printf "0x%08X" ${FW_VERSION_INT}
10+
OUTPUT_VARIABLE FW_VERSION_INT_HEX
11+
OUTPUT_STRIP_TRAILING_WHITESPACE
12+
)
1113

1214
# Set variables for the package
1315
string(SUBSTRING "${pkg_title_id}" 0 4 title)
@@ -17,12 +19,12 @@ function(create_pkg pkg_title_id fw_major fw_minor src_files)
1719
set(PKG_VERSION "1.0")
1820
set(PKG_CONTENT_ID "IV0000-${pkg_title_id}_00-PS4SUBSYS0000000")
1921
set(PKG_DOWNLOADSIZE 0x100)
20-
set(PKG_SYSVER ${FW_VERSION_HEX})
22+
set(PKG_SYSVER ${FW_VERSION_INT_HEX})
2123
set(PKG_ATTRIBS1 0)
2224
set(PKG_ATTRIBS2 0)
2325

2426
# Print debug info if needed
25-
message(STATUS "Creating package ${PKG_TITLE} with id: ${PKG_TITLE_ID}")
27+
message(STATUS "Creating package ${PKG_TITLE} id:${PKG_TITLE_ID} fw:${PKG_SYSVER}")
2628

2729
OpenOrbisPackage_PreProject()
2830

@@ -49,4 +51,4 @@ function(create_pkg pkg_title_id fw_major fw_minor src_files)
4951
add_dependencies(${pkg_title_id} CppUTest)
5052

5153
OpenOrbisPackage_PostProject(${out_dir})
52-
endfunction()
54+
endfunction(create_pkg)

0 commit comments

Comments
 (0)