diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 072c334..a41ab3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build MudletBootstrap +name: Build MudletInstaller on: push: branches: [master, development] @@ -244,7 +244,7 @@ jobs: # Start building the release body cat > release-body.md << 'EOF' - ## MudletBootstrap Release ${{ github.ref_name }} + ## MudletInstaller Release ${{ github.ref_name }} Choose your game below and download the appropriate file for your operating system: @@ -289,19 +289,19 @@ jobs: ### Windows 1. Download the `.exe` file for your game - 2. Run MudletBootstrap - it'll download & install Mudlet for you - 3. You can delete MudletBootstrap after - Mudlet is all set up to play your favourite game. - + 2. Run MudletInstaller - it'll download & install Mudlet for you + 3. You can delete MudletInstaller after - Mudlet is all set up to play your favourite game. + ### macOS 1. Download the `.dmg` file for your game 2. Open the DMG file - 3. Runt he MudletBootstrap app from within the mounted DMG - + 3. Run the MudletInstaller app from within the mounted DMG + ### Linux 1. Download the `.AppImage.tar` file for your game - 2. Extract it: `tar -xf MudletBootstrap-[game]-Linux.AppImage.tar` - 2. Extract and run the AppImage within: `MudletBootstrap-[game].AppImage` - 3. You can delete MudletBootstrap after - Mudlet is all set up to play your favourite + 2. Extract it: `tar -xf MudletInstaller-[game]-Linux.AppImage.tar` + 2. Extract and run the AppImage within: `MudletInstaller-[game].AppImage` + 3. You can delete MudletInstaller after - Mudlet is all set up to play your favourite EOF echo "Generated release body:" @@ -312,7 +312,7 @@ jobs: with: files: organized-releases/**/* tag_name: ${{ github.ref_name }} - name: MudletBootstrap ${{ github.ref_name }} + name: MudletInstaller ${{ github.ref_name }} body_path: release-body.md draft: false prerelease: false diff --git a/CI/deploy-win.sh b/CI/deploy-win.sh index 51f2e43..54ac603 100644 --- a/CI/deploy-win.sh +++ b/CI/deploy-win.sh @@ -92,19 +92,19 @@ while IFS= read -r line || [[ -n "$line" ]]; do # Remove specific file types from the directory rm ./*.cpp ./*.o - mv "$PACKAGE_DIR/MudletBootstrap.exe" "MudletBootstrap-${gameName}.exe" + mv "$PACKAGE_DIR/MudletInstaller.exe" "MudletInstaller-${gameName}.exe" # Sign the executable if Azure token is available if [ -n "${AZURE_ACCESS_TOKEN}" ]; then - echo "=== Signing MudletBootstrap-${gameName}.exe ===" - EXECUTABLE_WINPATH="$(cygpath -aw "${PACKAGE_DIR}/MudletBootstrap-${gameName}.exe")" + echo "=== Signing MudletInstaller-${gameName}.exe ===" + EXECUTABLE_WINPATH="$(cygpath -aw "${PACKAGE_DIR}/MudletInstaller-${gameName}.exe")" java.exe -jar "${JAVA_JAR_WINPATHFILE}" \ --storetype TRUSTEDSIGNING \ --keystore eus.codesigning.azure.net \ --storepass "${AZURE_ACCESS_TOKEN}" \ --alias Mudlet/Mudlet \ "${EXECUTABLE_WINPATH}" - echo "Signing completed for MudletBootstrap-${gameName}.exe" + echo "Signing completed for MudletInstaller-${gameName}.exe" fi # Move packaged files to the upload directory @@ -116,8 +116,8 @@ while IFS= read -r line || [[ -n "$line" ]]; do if [ "$IS_RELEASE" = true ]; then echo "Creating release version for $gameName" mkdir -p "${GITHUB_WORKSPACE_UNIX_PATH}/extracted-games/$gameName" - cp "${PACKAGE_DIR}/MudletBootstrap-${gameName}.exe" \ - "${GITHUB_WORKSPACE_UNIX_PATH}/extracted-games/$gameName/MudletBootstrap-$gameName-Windows.exe" + cp "${PACKAGE_DIR}/MudletInstaller-${gameName}.exe" \ + "${GITHUB_WORKSPACE_UNIX_PATH}/extracted-games/$gameName/MudletInstaller-$gameName-Windows.exe" fi cd "$GITHUB_WORKSPACE" || exit 1 @@ -132,5 +132,5 @@ fi # Append these variables to the GITHUB_ENV to make them available in subsequent steps { echo "FOLDER_TO_UPLOAD=${uploadDir}\\" - echo "UPLOAD_FILENAME=MudletBootstrap-${MSYSTEM}" + echo "UPLOAD_FILENAME=MudletInstaller-${MSYSTEM}" } >> "$GITHUB_ENV" diff --git a/CI/organize-launchers.sh b/CI/organize-launchers.sh index 8071092..54ff30a 100644 --- a/CI/organize-launchers.sh +++ b/CI/organize-launchers.sh @@ -36,12 +36,12 @@ if [ ! "$(ls -A organized-releases 2>/dev/null)" ]; then if [ -f "$launcher" ]; then filename=$(basename "$launcher") echo " Found Windows launcher: $filename" - # Extract game name (format: MudletBootstrap-GameName.exe) - if [[ "$filename" =~ MudletBootstrap-(.+)\.exe$ ]]; then + # Extract game name (format: MudletInstaller-GameName.exe) + if [[ "$filename" =~ MudletInstaller-(.+)\.exe$ ]]; then gameName="${BASH_REMATCH[1]}" echo " Game: $gameName" mkdir -p "organized-releases/$gameName" - cp "$launcher" "organized-releases/$gameName/MudletBootstrap-$gameName-Windows.exe" + cp "$launcher" "organized-releases/$gameName/MudletInstaller-$gameName-Windows.exe" fi fi done @@ -52,12 +52,12 @@ if [ ! "$(ls -A organized-releases 2>/dev/null)" ]; then if [ -f "$launcher" ]; then filename=$(basename "$launcher") echo " Found macOS launcher: $filename" - # Extract game name (format: MudletBootstrap-GameName.dmg) - if [[ "$filename" =~ MudletBootstrap-(.+)\.dmg$ ]]; then + # Extract game name (format: MudletInstaller-GameName.dmg) + if [[ "$filename" =~ MudletInstaller-(.+)\.dmg$ ]]; then gameName="${BASH_REMATCH[1]}" echo " Game: $gameName" mkdir -p "organized-releases/$gameName" - cp "$launcher" "organized-releases/$gameName/MudletBootstrap-$gameName-macOS.dmg" + cp "$launcher" "organized-releases/$gameName/MudletInstaller-$gameName-macOS.dmg" fi fi done @@ -68,12 +68,12 @@ if [ ! "$(ls -A organized-releases 2>/dev/null)" ]; then if [ -f "$launcher" ]; then filename=$(basename "$launcher") echo " Found Linux launcher: $filename" - # Extract game name (format: MudletBootstrap-linux-x64-GameName.AppImage.tar) - if [[ "$filename" =~ MudletBootstrap-linux-x64-(.+)\.AppImage\.tar$ ]]; then + # Extract game name (format: MudletInstaller-linux-x64-GameName.AppImage.tar) + if [[ "$filename" =~ MudletInstaller-linux-x64-(.+)\.AppImage\.tar$ ]]; then gameName="${BASH_REMATCH[1]}" echo " Game: $gameName" mkdir -p "organized-releases/$gameName" - cp "$launcher" "organized-releases/$gameName/MudletBootstrap-$gameName-Linux.AppImage.tar" + cp "$launcher" "organized-releases/$gameName/MudletInstaller-$gameName-Linux.AppImage.tar" fi fi done diff --git a/CI/package-linux.sh b/CI/package-linux.sh index 07509fc..40cf66f 100644 --- a/CI/package-linux.sh +++ b/CI/package-linux.sh @@ -45,10 +45,10 @@ while IFS= read -r line || [[ -n "$line" ]]; do mkdir app mkdir app/lib - cp build-${gameName}/MudletBootstrap app/ + cp build-${gameName}/MudletInstaller app/ cp "$SOURCE_DIR"/mudlet{.png,.svg} app/ - cp "$SOURCE_DIR"/mudletbootstrap.desktop app/ + cp "$SOURCE_DIR"/mudletinstaller.desktop app/ ./linuxdeployqt.AppImage --appimage-extract @@ -62,7 +62,7 @@ while IFS= read -r line || [[ -n "$line" ]]; do echo "No OpenSSL libraries to copy found. Aborting..." fi - ./squashfs-root/AppRun ./app/MudletBootstrap -appimage \ + ./squashfs-root/AppRun ./app/MudletInstaller -appimage \ -executable=app/lib/libssl.so.1.1 \ -executable=app/lib/libssl.so.1.0.0 @@ -71,18 +71,18 @@ while IFS= read -r line || [[ -n "$line" ]]; do BUILD_COMMIT=$(git rev-parse --short HEAD) - mv MudletBootstrap-${BUILD_COMMIT}-x86_64.AppImage MudletBootstrap.AppImage - chmod +x "MudletBootstrap.AppImage" - tar -cvf "MudletBootstrap-linux-x64.AppImage.tar" "MudletBootstrap.AppImage" + mv MudletInstaller-${BUILD_COMMIT}-x86_64.AppImage MudletInstaller.AppImage + chmod +x "MudletInstaller.AppImage" + tar -cvf "MudletInstaller-linux-x64.AppImage.tar" "MudletInstaller.AppImage" - mv "MudletBootstrap-linux-x64.AppImage.tar" "${GITHUB_WORKSPACE}/upload/MudletBootstrap-linux-x64-${gameName}.AppImage.tar" + mv "MudletInstaller-linux-x64.AppImage.tar" "${GITHUB_WORKSPACE}/upload/MudletInstaller-linux-x64-${gameName}.AppImage.tar" # If this is a release, also copy to extracted-games with standardized naming if [ "$IS_RELEASE" = true ]; then echo "Creating release version for $gameName" mkdir -p "${GITHUB_WORKSPACE}/extracted-games/$gameName" - cp "${GITHUB_WORKSPACE}/upload/MudletBootstrap-linux-x64-${gameName}.AppImage.tar" \ - "${GITHUB_WORKSPACE}/extracted-games/$gameName/MudletBootstrap-$gameName-Linux.AppImage.tar" + cp "${GITHUB_WORKSPACE}/upload/MudletInstaller-linux-x64-${gameName}.AppImage.tar" \ + "${GITHUB_WORKSPACE}/extracted-games/$gameName/MudletInstaller-$gameName-Linux.AppImage.tar" fi rm -rf app/ @@ -100,7 +100,7 @@ fi { echo "FOLDER_TO_UPLOAD=${GITHUB_WORKSPACE}/upload" - echo "UPLOAD_FILENAME=MudletBootstrap-linux-x64" + echo "UPLOAD_FILENAME=MudletInstaller-linux-x64" } >> "$GITHUB_ENV" DEPLOY_URL="Github artifact, see https://github.com/$GITHUB_REPOSITORY/runs/$GITHUB_RUN_ID" diff --git a/CI/package-mac.sh b/CI/package-mac.sh index 04780fe..2661db0 100644 --- a/CI/package-mac.sh +++ b/CI/package-mac.sh @@ -63,9 +63,9 @@ fi #if [ -n "${GITHUB_REPOSITORY}" ]; then -# mv "${BUILD_DIR}/mudletbootstrap.app" "${BUILD_DIR}/${appBaseName}.app" +# mv "${BUILD_DIR}/mudletinstaller.app" "${BUILD_DIR}/${appBaseName}.app" #else -# mv "${BUILD_DIR}/MudletBootstrap.app" "${BUILD_DIR}/${appBaseName}.app" +# mv "${BUILD_DIR}/MudletInstaller.app" "${BUILD_DIR}/${appBaseName}.app" #fi #./make-installer.sh "${appBaseName}.app" @@ -113,7 +113,7 @@ fi while IFS= read -r line || [[ -n "$line" ]]; do gameName=$(echo "$line" | tr -cd '[:alnum:]_-') - appBaseName="MudletBootstrap" + appBaseName="MudletInstaller" BUILD_DIR="${GITHUB_WORKSPACE}/build-${gameName}" cd "${BUILD_DIR}" @@ -122,8 +122,8 @@ while IFS= read -r line || [[ -n "$line" ]]; do app=$(basename "${appBaseName}.app") if [ -z "$app" ]; then - echo "No MudletBootstrap app folder to package given." - echo "Usage: $pgm " + echo "No MudletInstaller app folder to package given." + echo "Usage: $(basename "$0") " exit 2 fi find . -iname "${app}" -type d @@ -143,11 +143,11 @@ while IFS= read -r line || [[ -n "$line" ]]; do # fix unfinished deployment of macdeployqt echo "Running macdeployqtfix" - python ${GITHUB_WORKSPACE}/macdeployqtfix.py "${app}/Contents/MacOS/MudletBootstrap" "${QT_DIR}" $( [ -n "$DEBUG" ] && echo "--verbose" ) + python ${GITHUB_WORKSPACE}/macdeployqtfix.py "${app}/Contents/MacOS/MudletInstaller" "${QT_DIR}" $( [ -n "$DEBUG" ] && echo "--verbose" ) echo "Fixing plist entries..." - /usr/libexec/PlistBuddy -c "Add CFBundleName string MudletBootstrap" "${app}/Contents/Info.plist" || true - /usr/libexec/PlistBuddy -c "Add CFBundleDisplayName string MudletBootstrap" "${app}/Contents/Info.plist" || true + /usr/libexec/PlistBuddy -c "Add CFBundleName string MudletInstaller" "${app}/Contents/Info.plist" || true + /usr/libexec/PlistBuddy -c "Add CFBundleDisplayName string MudletInstaller" "${app}/Contents/Info.plist" || true /usr/libexec/PlistBuddy -c "Add CFBundleShortVersionString string ${shortVersion}" "${app}/Contents/Info.plist" || true /usr/libexec/PlistBuddy -c "Add CFBundleVersion string ${version}" "${app}/Contents/Info.plist" || true @@ -161,7 +161,7 @@ while IFS= read -r line || [[ -n "$line" ]]; do # Generate final .dmg cd ../../ - rm -f ~/Desktop/[mM]udletBootstrap-${gameName}*.dmg + rm -f ~/Desktop/[mM]udletInstaller-${gameName}*.dmg echo "PWD:" pwd @@ -170,19 +170,19 @@ while IFS= read -r line || [[ -n "$line" ]]; do echo "SOURCE_DIR: ${SOURCE_DIR}" echo "Modifying config file..." - cp ${SOURCE_DIR}/mudletbootstrap-appdmg.json ${BUILD_DIR} + cp ${SOURCE_DIR}/mudletinstaller-appdmg.json ${BUILD_DIR} # Modify appdmg config file according to the app file to package - perl -pi -e "s|../source/build/.*MudletBootstrap.*\\.app|${BUILD_DIR}/${app}|i" "${BUILD_DIR}/mudletbootstrap-appdmg.json" + perl -pi -e "s|../source/build/.*MudletInstaller.*\\.app|${BUILD_DIR}/${app}|i" "${BUILD_DIR}/mudletinstaller-appdmg.json" # Update icons to the correct type - perl -pi -e "s|../source/src/icons/.*\\.icns|${SOURCE_DIR}/mudlet.icns|i" "${BUILD_DIR}/mudletbootstrap-appdmg.json" + perl -pi -e "s|../source/src/icons/.*\\.icns|${SOURCE_DIR}/mudlet.icns|i" "${BUILD_DIR}/mudletinstaller-appdmg.json" echo "Listing config file:" - cat ${BUILD_DIR}/mudletbootstrap-appdmg.json + cat ${BUILD_DIR}/mudletinstaller-appdmg.json echo "Creating appdmg..." # Last: build *.dmg file - appdmg "${BUILD_DIR}/mudletbootstrap-appdmg.json" "${HOME}/Desktop/$(basename "${app%.*}").dmg" + appdmg "${BUILD_DIR}/mudletinstaller-appdmg.json" "${HOME}/Desktop/$(basename "${app%.*}").dmg" if [ -n "$MACOS_SIGNING_PASS" ]; then sign_and_notarize "${HOME}/Desktop/${appBaseName}.dmg" @@ -195,7 +195,7 @@ while IFS= read -r line || [[ -n "$line" ]]; do echo "Creating release version for $gameName" mkdir -p "${GITHUB_WORKSPACE}/extracted-games/$gameName" cp "${GITHUB_WORKSPACE}/upload/${appBaseName}-${gameName}.dmg" \ - "${GITHUB_WORKSPACE}/extracted-games/$gameName/MudletBootstrap-$gameName-macOS.dmg" + "${GITHUB_WORKSPACE}/extracted-games/$gameName/MudletInstaller-$gameName-macOS.dmg" fi done < "${GITHUB_WORKSPACE}/GameList.txt" diff --git a/CI/package-win.sh b/CI/package-win.sh index 4eed737..8ee926f 100644 --- a/CI/package-win.sh +++ b/CI/package-win.sh @@ -102,21 +102,19 @@ while IFS= read -r line || [[ -n "$line" ]]; do echo "Copying wanted compiled files from ${GITHUB_WORKSPACE}/build-${gameName} to ${GITHUB_WORKSPACE}/package-${gameName} ..." echo "" - if [ ! -f "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletBootstrap.exe" ]; then - echo "ERROR: no MudletBootstrap executable found - did the previous build" + if [ ! -f "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletInstaller.exe" ]; then + echo "ERROR: no MudletInstaller executable found - did the previous build" echo "complete sucessfully?" exit 6 fi - cp "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletBootstrap.exe" "${PACKAGE_DIR}/" - if [ -f "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletBootstrap.exe.debug" ]; then - cp "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletBootstrap.exe.debug" "${PACKAGE_DIR}/" + cp "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletInstaller.exe" "${PACKAGE_DIR}/" + if [ -f "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletInstaller.exe.debug" ]; then + cp "${GITHUB_WORKSPACE_UNIX_PATH}/build-${gameName}/MudletInstaller.exe.debug" "${PACKAGE_DIR}/" fi - "${RUNNER_WORKSPACE}/qt-static-install/bin/windeployqt6" ./MudletBootstrap.exe - - ZIP_FILE_NAME="MudletBootstrap" + "${RUNNER_WORKSPACE}/qt-static-install/bin/windeployqt6" ./MudletInstaller.exe # To determine which system libraries have to be copied in it requires # continually trying to run the executable on the target type system @@ -132,9 +130,9 @@ while IFS= read -r line || [[ -n "$line" ]]; do # "luasql/sqlite3.dll" needed "libsqlite3-0.dll"! # echo "" - #echo "Examining MudletBootstrap application to identify other needed libraries..." + #echo "Examining MudletInstaller application to identify other needed libraries..." - # NEEDED_LIBS=$("${MINGW_INTERNAL_BASE_DIR}/bin/ntldd" --recursive ./MudletBootstrap.exe \ + # NEEDED_LIBS=$("${MINGW_INTERNAL_BASE_DIR}/bin/ntldd" --recursive ./MudletInstaller.exe \ # | /usr/bin/grep -v "Qt6" \ # | /usr/bin/grep -i "mingw" \ # | /usr/bin/cut -d ">" -f2 \ diff --git a/CMakeLists.txt b/CMakeLists.txt index aa1e842..c9061f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(MudletBootstrap VERSION 0.1 LANGUAGES CXX) +project(MudletInstaller VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) @@ -55,25 +55,25 @@ else() endif() -set(TS_FILES MudletBootstrap_en_US.ts) +set(TS_FILES MudletInstaller_en_US.ts) set(PROJECT_SOURCES main.cpp - MudletBootstrap.h - MudletBootstrap.cpp + MudletInstaller.h + MudletInstaller.cpp ${TS_FILES} ) -qt_add_executable(MudletBootstrap +qt_add_executable(MudletInstaller MANUAL_FINALIZATION ${PROJECT_SOURCES} ) # Add resources qt_add_resources(RESOURCES resources.qrc) -target_sources(MudletBootstrap PRIVATE ${RESOURCES}) +target_sources(MudletInstaller PRIVATE ${RESOURCES}) # Link Qt libraries -target_link_libraries(MudletBootstrap PRIVATE +target_link_libraries(MudletInstaller PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::StateMachine @@ -130,7 +130,7 @@ if(WIN32) # Don't link libraries early - let Qt's dependencies handle them # Just ensure they're available at the end with --whole-archive - target_link_options(MudletBootstrap PRIVATE + target_link_options(MudletInstaller PRIVATE "LINKER:--whole-archive" "LINKER:${MSYS2_LIB_PATH}/libbz2.a" "LINKER:${MSYS2_LIB_PATH}/libbrotlicommon.a" @@ -140,7 +140,7 @@ if(WIN32) ) # Only link Windows system libraries - target_link_libraries(MudletBootstrap PRIVATE + target_link_libraries(MudletInstaller PRIVATE ws2_32 winmm imm32 wtsapi32 dwmapi uxtheme rpcrt4 crypt32 secur32 ole32 oleaut32 uuid advapi32 shell32 user32 kernel32 gdi32 comdlg32 winspool @@ -154,32 +154,32 @@ message(STATUS "Project Version Minor: ${PROJECT_VERSION_MINOR}" ) -set_target_properties(MudletBootstrap PROPERTIES +set_target_properties(MudletInstaller PROPERTIES ${BUNDLE_ID_OPTION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE MACOSX_BUNDLE_ICON_FILE mudlet.icns - MACOSX_BUNDLE_BUNDLE_NAME MudletBootstrap - MACOSX_BUNDLE_GUI_IDENTIFIER org.mudlet.bootstrap + MACOSX_BUNDLE_BUNDLE_NAME MudletInstaller + MACOSX_BUNDLE_GUI_IDENTIFIER org.mudlet.installer WIN32_EXECUTABLE TRUE ) if(APPLE) file(GLOB ICON_FILE "mudlet.icns") message(STATUS "Using icon file: ${ICON_FILE}") - target_sources(MudletBootstrap PRIVATE ${ICON_FILE}) + target_sources(MudletInstaller PRIVATE ${ICON_FILE}) set_source_files_properties(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) endif() include(GNUInstallDirs) -install(TARGETS MudletBootstrap +install(TARGETS MudletInstaller BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) if(QT_VERSION_MAJOR EQUAL 6) - qt_finalize_executable(MudletBootstrap) + qt_finalize_executable(MudletInstaller) endif() diff --git a/MudletBootstrap.cpp b/MudletInstaller.cpp similarity index 91% rename from MudletBootstrap.cpp rename to MudletInstaller.cpp index c4d3366..d97ad40 100644 --- a/MudletBootstrap.cpp +++ b/MudletInstaller.cpp @@ -1,4 +1,4 @@ -#include "MudletBootstrap.h" +#include "MudletInstaller.h" #include #include #include @@ -18,7 +18,6 @@ #include #include #include -#include QMap getPlatformFeedMap(const QString &type) { @@ -118,7 +117,7 @@ bool verifyFileSha256(const QString &filePath, const QString &expectedHash) { } -MudletBootstrap::MudletBootstrap(QObject *parent) : +MudletInstaller::MudletInstaller(QObject *parent) : QObject(parent), currentReply(nullptr), m_stateMachine(nullptr), @@ -154,7 +153,7 @@ MudletBootstrap::MudletBootstrap(QObject *parent) : * @brief Initialize the QStateMachine * */ -void MudletBootstrap::initStateMachine() { +void MudletInstaller::initStateMachine() { m_stateMachine = new QStateMachine(this); // Create states @@ -171,35 +170,35 @@ void MudletBootstrap::initStateMachine() { m_stateMachine->setInitialState(m_downloadFeedState); // Connect state entry actions - connect(m_downloadFeedState, &QState::entered, this, &MudletBootstrap::fetchPlatformFeed); - connect(m_checkExistingState, &QState::entered, this, &MudletBootstrap::checkExistingFile); - connect(m_downloadState, &QState::entered, this, &MudletBootstrap::startDownload); - connect(m_retryState, &QState::entered, this, &MudletBootstrap::retryDownload); - connect(m_verifyHashState, &QState::entered, this, &MudletBootstrap::verifyHash); - connect(m_installState, &QState::entered, this, &MudletBootstrap::installApplication); - connect(m_errorState, &QState::entered, this, &MudletBootstrap::handleError); - connect(m_doneState, &QState::entered, this, &MudletBootstrap::cleanup); + connect(m_downloadFeedState, &QState::entered, this, &MudletInstaller::fetchPlatformFeed); + connect(m_checkExistingState, &QState::entered, this, &MudletInstaller::checkExistingFile); + connect(m_downloadState, &QState::entered, this, &MudletInstaller::startDownload); + connect(m_retryState, &QState::entered, this, &MudletInstaller::retryDownload); + connect(m_verifyHashState, &QState::entered, this, &MudletInstaller::verifyHash); + connect(m_installState, &QState::entered, this, &MudletInstaller::installApplication); + connect(m_errorState, &QState::entered, this, &MudletInstaller::handleError); + connect(m_doneState, &QState::entered, this, &MudletInstaller::cleanup); // Add state transitions - m_downloadFeedState->addTransition(this, &MudletBootstrap::feedFetched, m_checkExistingState); - m_downloadFeedState->addTransition(this, &MudletBootstrap::errorOccurred, m_errorState); + m_downloadFeedState->addTransition(this, &MudletInstaller::feedFetched, m_checkExistingState); + m_downloadFeedState->addTransition(this, &MudletInstaller::errorOccurred, m_errorState); - m_checkExistingState->addTransition(this, &MudletBootstrap::fileExists, m_verifyHashState); - m_checkExistingState->addTransition(this, &MudletBootstrap::fileNotExists, m_downloadState); + m_checkExistingState->addTransition(this, &MudletInstaller::fileExists, m_verifyHashState); + m_checkExistingState->addTransition(this, &MudletInstaller::fileNotExists, m_downloadState); - m_downloadState->addTransition(this, &MudletBootstrap::downloadComplete, m_verifyHashState); - m_downloadState->addTransition(this, &MudletBootstrap::errorOccurred, m_retryState); + m_downloadState->addTransition(this, &MudletInstaller::downloadComplete, m_verifyHashState); + m_downloadState->addTransition(this, &MudletInstaller::errorOccurred, m_retryState); - m_retryState->addTransition(this, &MudletBootstrap::fileNotExists, m_downloadState); // retry download - m_retryState->addTransition(this, &MudletBootstrap::errorOccurred, m_errorState); // max retries reached + m_retryState->addTransition(this, &MudletInstaller::fileNotExists, m_downloadState); // retry download + m_retryState->addTransition(this, &MudletInstaller::errorOccurred, m_errorState); // max retries reached - m_verifyHashState->addTransition(this, &MudletBootstrap::hashValid, m_installState); - m_verifyHashState->addTransition(this, &MudletBootstrap::hashInvalid, m_errorState); + m_verifyHashState->addTransition(this, &MudletInstaller::hashValid, m_installState); + m_verifyHashState->addTransition(this, &MudletInstaller::hashInvalid, m_errorState); - m_installState->addTransition(this, &MudletBootstrap::installComplete, m_doneState); - m_installState->addTransition(this, &MudletBootstrap::errorOccurred, m_errorState); + m_installState->addTransition(this, &MudletInstaller::installComplete, m_doneState); + m_installState->addTransition(this, &MudletInstaller::errorOccurred, m_errorState); - m_errorState->addTransition(this, &MudletBootstrap::finished, m_doneState); + m_errorState->addTransition(this, &MudletInstaller::finished, m_doneState); // Connect state machine finished signal connect(m_stateMachine, &QStateMachine::finished, this, [this]() { @@ -237,7 +236,7 @@ void MudletBootstrap::initStateMachine() { * @brief Start the state machine * */ -void MudletBootstrap::start() { +void MudletInstaller::start() { m_stateMachine->start(); } @@ -245,7 +244,7 @@ void MudletBootstrap::start() { /** * @brief Query the platform OS and fetch the proper platform feed from dblsqd */ -void MudletBootstrap::fetchPlatformFeed() { +void MudletInstaller::fetchPlatformFeed() { QSettings settings(":/resources/launch.ini", QSettings::IniFormat); @@ -265,7 +264,7 @@ void MudletBootstrap::fetchPlatformFeed() { currentReply = networkManager.get(QNetworkRequest(QUrl(feedUrl))); - connect(currentReply, &QNetworkReply::finished, this, &MudletBootstrap::onFetchPlatformFeedFinished); + connect(currentReply, &QNetworkReply::finished, this, &MudletInstaller::onFetchPlatformFeedFinished); // Show the progress bar window progressWindow->show(); @@ -275,7 +274,7 @@ void MudletBootstrap::fetchPlatformFeed() { * @brief Called upon complete receipt of the platform feed. * Extracts the url and sha256 from the JSON and sets up a new download for the proper file. */ -void MudletBootstrap::onFetchPlatformFeedFinished() { +void MudletInstaller::onFetchPlatformFeedFinished() { if (currentReply->error() != QNetworkReply::NoError) { qDebug() << "Error fetching feed:" << currentReply->errorString(); currentReply->deleteLater(); @@ -343,7 +342,7 @@ void MudletBootstrap::onFetchPlatformFeedFinished() { * @brief Check if outputFile exists and emit corresponding state signal * Also determines bytes already downloaded for resume functionality */ -void MudletBootstrap::checkExistingFile() { +void MudletInstaller::checkExistingFile() { statusLabel->setText("Checking existing file..."); qDebug() << "Checking if file exists:" << outputFile; @@ -367,7 +366,7 @@ void MudletBootstrap::checkExistingFile() { * @brief Create a request and start downloading the Mudlet installer * Supports resuming downloads using HTTP Range requests */ -void MudletBootstrap::startDownload() { +void MudletInstaller::startDownload() { QNetworkRequest request{QUrl(info.url)}; // If we have bytes already downloaded, request only the remaining part @@ -385,13 +384,13 @@ void MudletBootstrap::startDownload() { currentReply = networkManager.get(request); - connect(currentReply, &QNetworkReply::downloadProgress, this, &MudletBootstrap::onDownloadProgress); - connect(currentReply, &QNetworkReply::finished, this, &MudletBootstrap::onDownloadFinished); - connect(currentReply, &QNetworkReply::errorOccurred, this, &MudletBootstrap::onDownloadError); + connect(currentReply, &QNetworkReply::downloadProgress, this, &MudletInstaller::onDownloadProgress); + connect(currentReply, &QNetworkReply::finished, this, &MudletInstaller::onDownloadFinished); + connect(currentReply, &QNetworkReply::errorOccurred, this, &MudletInstaller::onDownloadError); } -void MudletBootstrap::onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) { +void MudletInstaller::onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) { if (bytesTotal > 0) { int progress = static_cast((bytesReceived * 100) / bytesTotal); progressBar->setValue(progress); @@ -411,7 +410,7 @@ void MudletBootstrap::onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal * Called upon completion of the Mudlet installer download. * Supports appending to existing file when resuming. */ -void MudletBootstrap::onDownloadFinished() { +void MudletInstaller::onDownloadFinished() { if (currentReply->error() != QNetworkReply::NoError) { statusLabel->setText(QString("Error downloading file: %1").arg(currentReply->errorString())); emit errorOccurred(); @@ -444,12 +443,14 @@ void MudletBootstrap::onDownloadFinished() { } -void MudletBootstrap::onDownloadError(QNetworkReply::NetworkError error) { - qDebug() << "Download error:" << currentReply->errorString() << "Error code:" << error; - +void MudletInstaller::onDownloadError(QNetworkReply::NetworkError error) { + // Capture error string before deleteLater to avoid use-after-free + QString errorString = currentReply->errorString(); + qDebug() << "Download error:" << errorString << "Error code:" << error; + // Distinguish between retryable and non-retryable errors bool isRetryable = true; - + switch (error) { case QNetworkReply::ContentNotFoundError: // 404 case QNetworkReply::AuthenticationRequiredError: // 401 @@ -470,15 +471,15 @@ void MudletBootstrap::onDownloadError(QNetworkReply::NetworkError error) { qDebug() << "Retryable error detected"; break; } - + currentReply->deleteLater(); - + if (!isRetryable) { - statusLabel->setText(QString("Download failed: %1").arg(currentReply->errorString())); + statusLabel->setText(QString("Download failed: %1").arg(errorString)); // Skip retry logic and go directly to error state for non-retryable errors retryCount = MAX_RETRIES; // This will force retryDownload to give up immediately } - + emit errorOccurred(); } @@ -488,7 +489,7 @@ void MudletBootstrap::onDownloadError(QNetworkReply::NetworkError error) { * Emits corfresponding hashValid or hashInvalid state signals * */ -void MudletBootstrap::verifyHash() { +void MudletInstaller::verifyHash() { statusLabel->setText("Verifying SHA256..."); statusLabel->repaint(); qDebug() << "Verifying hash"; @@ -703,7 +704,7 @@ bool installAndRunAppImage(QProcessEnvironment &env, const QString& tarFilePath) * Emits corresponding installComplete or errorOccurred state signal. * */ -void MudletBootstrap::installApplication() { +void MudletInstaller::installApplication() { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); @@ -771,7 +772,7 @@ void MudletBootstrap::installApplication() { if (!installSuccess) { emit errorOccurred(); } else { - QString labelString = QString("%1 has been installed! You can now delete the MudletBoostrap-%1 app.").arg(launchProfile); + QString labelString = QString("%1 has been installed! You can now delete the MudletInstaller-%1 app.").arg(launchProfile); #if defined(Q_OS_WIN) if (shortcutCreated) { @@ -795,7 +796,7 @@ void MudletBootstrap::installApplication() { * For now, just set the status label to a generic error message. * */ -void MudletBootstrap::handleError() { +void MudletInstaller::handleError() { qDebug() << "Handling error state"; statusLabel->setText("An error occurred"); // Show error dialog? @@ -807,7 +808,7 @@ void MudletBootstrap::handleError() { * @brief Final state machine step. Deletes the downloaded file. * */ -void MudletBootstrap::cleanup() { +void MudletInstaller::cleanup() { qDebug() << "Cleaning up"; if (QFile::exists(outputFile)) { if (!QFile::remove(outputFile)) { @@ -824,7 +825,7 @@ void MudletBootstrap::cleanup() { * @brief Handle download retry logic * Decides whether to retry the download or give up based on retry count */ -void MudletBootstrap::retryDownload() { +void MudletInstaller::retryDownload() { qDebug() << "Retry state entered, retry count:" << retryCount; if (retryCount < MAX_RETRIES) { diff --git a/MudletBootstrap.h b/MudletInstaller.h similarity index 91% rename from MudletBootstrap.h rename to MudletInstaller.h index 5d7d90d..e5c190d 100644 --- a/MudletBootstrap.h +++ b/MudletInstaller.h @@ -1,5 +1,5 @@ -#ifndef MUDLETDOWNLOADER_H -#define MUDLETDOWNLOADER_H +#ifndef MUDLETINSTALLER_H +#define MUDLETINSTALLER_H #include #include @@ -17,11 +17,11 @@ struct DownloadInfo { QString sha256; }; -class MudletBootstrap : public QObject { +class MudletInstaller : public QObject { Q_OBJECT public: - explicit MudletBootstrap(QObject *parent = nullptr); + explicit MudletInstaller(QObject *parent = nullptr); void start(); private slots: diff --git a/MudletBootstrap_en_US.ts b/MudletInstaller_en_US.ts similarity index 100% rename from MudletBootstrap_en_US.ts rename to MudletInstaller_en_US.ts diff --git a/main.cpp b/main.cpp index e16d495..ead090b 100644 --- a/main.cpp +++ b/main.cpp @@ -4,14 +4,14 @@ #include #include -#include "MudletBootstrap.h" +#include "MudletInstaller.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); qDebug() << "Starting MudletDownloader..."; - MudletBootstrap app; + MudletInstaller app; app.start(); return a.exec(); diff --git a/mudletbootstrap-appdmg.json b/mudletinstaller-appdmg.json similarity index 70% rename from mudletbootstrap-appdmg.json rename to mudletinstaller-appdmg.json index 35b5620..150bc4d 100644 --- a/mudletbootstrap-appdmg.json +++ b/mudletinstaller-appdmg.json @@ -1,6 +1,6 @@ { - "title": "MudletBootstrap", - "app": "../source/build/MudletBootstrap.app", + "title": "MudletInstaller", + "app": "../source/build/MudletInstaller.app", "background": "../mudlet_osx_installer_background.png", "icon": "../source/src/icons/osx.icns", "icons": { diff --git a/mudletbootstrap.desktop b/mudletinstaller.desktop similarity index 61% rename from mudletbootstrap.desktop rename to mudletinstaller.desktop index e7f0d4d..31019fe 100644 --- a/mudletbootstrap.desktop +++ b/mudletinstaller.desktop @@ -1,9 +1,9 @@ [Desktop Entry] -Name=MudletBootstrap -X-AppInstall-Package=MudletBootstrap -GenericName=Mud Client Launcherf +Name=MudletInstaller +X-AppInstall-Package=MudletInstaller +GenericName=Mud Client Installer Comment=Play online text-based games (MUDs) -Exec=MudletBootstrap %f +Exec=MudletInstaller %f Terminal=false Type=Application MimeType=application/zip; diff --git a/mudletbootstrap.nuspec b/mudletinstaller.nuspec similarity index 92% rename from mudletbootstrap.nuspec rename to mudletinstaller.nuspec index e798d83..de160d7 100644 --- a/mudletbootstrap.nuspec +++ b/mudletinstaller.nuspec @@ -1,8 +1,8 @@ - MudletBootstrap - MudletBootstrap + MudletInstaller + MudletInstaller 0.0.0 Mudlet Makers Mudlet Makers