Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: missing support for ue 5.4 (fix #351) #352

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,39 @@ jobs:
${{ env.release_file }}
${{ env.checksum_file }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 }}
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions CronosPlayUnreal.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions Source/CronosPlayUnreal/Private/DynamicContractObject.cpp
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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> privatekey =
defiWallet->getCoreWallet()->get_key(hdpath);
Expand Down
7 changes: 4 additions & 3 deletions Source/CronosPlayUnreal/Private/PlayCppSdkDownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -46,7 +47,7 @@ void UPlayCppSdkDownloader::GetJsonStringFromUri(FString tokenuriuser,
}

FString tokenuri = convert_ipfs_url(tokenuriuser);
assert(HttpModule != NULL);
check(HttpModule != NULL);
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httprequest =
HttpModule->CreateRequest();
httprequest->SetVerb(TEXT("GET"));
Expand Down Expand Up @@ -96,7 +97,7 @@ void UPlayCppSdkDownloader::GetNftImageInfoFromUri(FString tokenuriuser,
}

FString tokenuri = convert_ipfs_url(tokenuriuser);
assert(HttpModule != NULL);
check(HttpModule != NULL);
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httprequest =
HttpModule->CreateRequest();

Expand Down Expand Up @@ -161,7 +162,7 @@ void UPlayCppSdkDownloader::GetNftImageFromUrl(FString imageurl, bool &success,
return;
}

assert(HttpModule != NULL);
check(HttpModule != NULL);
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> httprequest =
HttpModule->CreateRequest();
httprequest->SetVerb(TEXT("GET"));
Expand Down
10 changes: 5 additions & 5 deletions Source/CronosPlayUnreal/Private/Utlis.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Copyright 2022, Cronos Labs. All Rights Reserved

#include "Utlis.h"
#include "Containers/UnrealString.h"

FString UUtlis::ToHex(TArray<uint8> address) {
FString UUtlis::ToHex(const TArray<uint8> &address) {
return BytesToHex(address.GetData(), address.Num());
}

std::array<std::uint8_t, 20> UUtlis::ToArray(TArray<uint8> address) {
std::array<std::uint8_t, 20> UUtlis::ToArray(const TArray<uint8> &address) {
std::array<std::uint8_t, 20> 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;
}
6 changes: 3 additions & 3 deletions Source/CronosPlayUnreal/Public/Utlis.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022, Cronos Labs. All Rights Reserved

#pragma once

#include <array>
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Utlis.generated.h"
Expand All @@ -23,7 +23,7 @@ class CRONOSPLAYUNREAL_API UUtlis : public UBlueprintFunctionLibrary {
UFUNCTION(BlueprintCallable,
meta = (DisplayName = "ToHex", Keywords = "PlayCppSdk"),
Category = "Utils")
static FString ToHex(TArray<uint8> address);
static FString ToHex(const TArray<uint8>& address);

/**
* Convert TArray<uint8> to std::array<uint8_t, 20>
Expand All @@ -32,5 +32,5 @@ class CRONOSPLAYUNREAL_API UUtlis : public UBlueprintFunctionLibrary {
* return all 0
*
*/
static std::array<std::uint8_t, 20> ToArray(TArray<uint8> address);
static std::array<std::uint8_t, 20> ToArray(const TArray<uint8>& address);
};
Loading