From 6cb80ed9b41d4b673757f316f63067e6aa927896 Mon Sep 17 00:00:00 2001 From: jonghwan Date: Fri, 26 Apr 2024 14:14:02 +0900 Subject: [PATCH] Problem: missing support for ue 5.4 (fix #351) support ue 5.4 change version add release --- .github/workflows/release.yml | 37 ++++++++++++++++++- CHANGELOG.md | 6 ++- CronosPlayUnreal.uplugin | 4 +- .../Private/DynamicContractObject.cpp | 8 +++- .../Private/PlayCppSdkDownloader.cpp | 7 ++-- Source/CronosPlayUnreal/Private/Utlis.cpp | 10 ++--- Source/CronosPlayUnreal/Public/Utlis.h | 6 +-- 7 files changed, 61 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b80f4400..840d5eb6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -182,4 +182,39 @@ jobs: ${{ env.release_file }} ${{ env.checksum_file }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + Unreal_Release_5_4: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + submodules: recursive + + - name: Prepare PlayCppSdk + run: | + TARGET=5.4 make + python change_version.py 5.4 + + + - name: Package For Windows,Mac + run: | + FILENAME="CronosPlayForUnrealEngine5.4.zip" + zip -r ${FILENAME} Source Resources CronosPlayUnreal.uplugin + sha256sum ${FILENAME} > "checksums.txt" + echo "release_file=${FILENAME}" >> $GITHUB_ENV + echo "checksum_file=checksums.txt" >> $GITHUB_ENV + + + - name: Upload binaries and bindings to Release + uses: softprops/action-gh-release@v1 + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + with: + draft: true + files: | + ${{ env.release_file }} + ${{ env.checksum_file }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 55a2c697..0f97a8db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # Changelog ## [Unreleased] -- Fix WC 2.0 for defiwallet + +## [v0.0.19-alpha] - 2024-4-27 +- Fix WC 2.0 for defiwallet +- Support UE 5.4 + ## [v0.0.18-alpha] - 2024-1-2 - Support metamask send-tx for wallet-connect 2.0 diff --git a/CronosPlayUnreal.uplugin b/CronosPlayUnreal.uplugin index b69508c9..ef64c101 100644 --- a/CronosPlayUnreal.uplugin +++ b/CronosPlayUnreal.uplugin @@ -2,8 +2,8 @@ "FileVersion": 3, "FriendlyName": "Cronos Play for Unreal Engine", "Version": 1, - "VersionName": "v0.0.18-alpha", - "EngineVersion": "5.3.0", + "VersionName": "v0.0.19-alpha", + "EngineVersion": "5.4", "Description": "Cronos labs", "Category": "Programming", "CreatedBy": "Cronos labs", diff --git a/Source/CronosPlayUnreal/Private/DynamicContractObject.cpp b/Source/CronosPlayUnreal/Private/DynamicContractObject.cpp index 819fb175..f47e0074 100644 --- a/Source/CronosPlayUnreal/Private/DynamicContractObject.cpp +++ b/Source/CronosPlayUnreal/Private/DynamicContractObject.cpp @@ -1,7 +1,11 @@ // Copyright 2022, Cronos Labs. All Rights Reserved - #include "DynamicContractObject.h" +#include "DefiWalletCoreActor.h" +using namespace org::defi_wallet_core; +void convertCronosTXReceipt( + ::org::defi_wallet_core::CronosTransactionReceiptRaw &src, + FCronosTransactionReceiptRaw &dst); UDynamicContractObject::UDynamicContractObject() { defiWallet = NULL; _coreContract = NULL; @@ -178,7 +182,7 @@ void UDynamicContractObject::NewSigningEthContract(FString contractaddress, } char hdpath[100]; - snprintf(hdpath, sizeof(hdpath), "m/44'/%d'/0'/0/%d", EthCoinType, + snprintf(hdpath, sizeof(hdpath), "m/44'/%d'/0'/0/%d", 60, walletindex); rust::cxxbridge1::Box privatekey = defiWallet->getCoreWallet()->get_key(hdpath); diff --git a/Source/CronosPlayUnreal/Private/PlayCppSdkDownloader.cpp b/Source/CronosPlayUnreal/Private/PlayCppSdkDownloader.cpp index 8f7a37fc..419b5412 100644 --- a/Source/CronosPlayUnreal/Private/PlayCppSdkDownloader.cpp +++ b/Source/CronosPlayUnreal/Private/PlayCppSdkDownloader.cpp @@ -5,6 +5,7 @@ #include "Interfaces/IHttpRequest.h" #include "Interfaces/IHttpResponse.h" #include "Kismet/KismetRenderingLibrary.h" + FString UPlayCppSdkDownloader::UserAgent = TEXT("CronosPlay-UnrealEngine-Agent"); // ipfs:// -> https://ipfs.io/ipfs/ @@ -46,7 +47,7 @@ void UPlayCppSdkDownloader::GetJsonStringFromUri(FString tokenuriuser, } FString tokenuri = convert_ipfs_url(tokenuriuser); - assert(HttpModule != NULL); + check(HttpModule != NULL); TSharedRef httprequest = HttpModule->CreateRequest(); httprequest->SetVerb(TEXT("GET")); @@ -96,7 +97,7 @@ void UPlayCppSdkDownloader::GetNftImageInfoFromUri(FString tokenuriuser, } FString tokenuri = convert_ipfs_url(tokenuriuser); - assert(HttpModule != NULL); + check(HttpModule != NULL); TSharedRef httprequest = HttpModule->CreateRequest(); @@ -161,7 +162,7 @@ void UPlayCppSdkDownloader::GetNftImageFromUrl(FString imageurl, bool &success, return; } - assert(HttpModule != NULL); + check(HttpModule != NULL); TSharedRef httprequest = HttpModule->CreateRequest(); httprequest->SetVerb(TEXT("GET")); diff --git a/Source/CronosPlayUnreal/Private/Utlis.cpp b/Source/CronosPlayUnreal/Private/Utlis.cpp index 32df11c1..c70f25db 100644 --- a/Source/CronosPlayUnreal/Private/Utlis.cpp +++ b/Source/CronosPlayUnreal/Private/Utlis.cpp @@ -1,19 +1,19 @@ -// Copyright 2022, Cronos Labs. All Rights Reserved - #include "Utlis.h" #include "Containers/UnrealString.h" -FString UUtlis::ToHex(TArray address) { +FString UUtlis::ToHex(const TArray &address) { return BytesToHex(address.GetData(), address.Num()); } -std::array UUtlis::ToArray(TArray address) { +std::array UUtlis::ToArray(const TArray &address) { std::array std_array{}; + if (address.Num() == 20) { - auto data_begin = address.GetData(); + const uint8 *data_begin = address.GetData(); std::copy_n(data_begin, 20, std_array.begin()); } else { std_array.fill(0); } + return std_array; } diff --git a/Source/CronosPlayUnreal/Public/Utlis.h b/Source/CronosPlayUnreal/Public/Utlis.h index 71154be8..33f54300 100644 --- a/Source/CronosPlayUnreal/Public/Utlis.h +++ b/Source/CronosPlayUnreal/Public/Utlis.h @@ -1,7 +1,7 @@ // Copyright 2022, Cronos Labs. All Rights Reserved #pragma once - +#include #include "CoreMinimal.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "Utlis.generated.h" @@ -23,7 +23,7 @@ class CRONOSPLAYUNREAL_API UUtlis : public UBlueprintFunctionLibrary { UFUNCTION(BlueprintCallable, meta = (DisplayName = "ToHex", Keywords = "PlayCppSdk"), Category = "Utils") - static FString ToHex(TArray address); + static FString ToHex(const TArray& address); /** * Convert TArray to std::array @@ -32,5 +32,5 @@ class CRONOSPLAYUNREAL_API UUtlis : public UBlueprintFunctionLibrary { * return all 0 * */ - static std::array ToArray(TArray address); + static std::array ToArray(const TArray& address); };