Compare commits

..

14 Commits

Author SHA1 Message Date
CounterFire2023
76a4c47151 修正cpp调用rust时, 可能的memory leak 2024-01-25 18:59:35 +08:00
CounterFire2023
f3cddf9f8e 增加一个手动释放rust string的方法 2024-01-25 18:44:08 +08:00
CounterFire2023
14a9ca9671 修改discord登录代码, 改为通用的oauth登录 2024-01-25 12:18:04 +08:00
CounterFire2023
e8f07f028c add login with discord 2024-01-24 16:12:23 +08:00
CounterFire2023
3e00bfb18f 增加aes相关方法 2023-10-20 15:56:45 +08:00
CounterFire2023
0c6d9286d3 增加一些用于relay的方法 2023-10-17 11:48:24 +08:00
CounterFire2023
a5aa4b1374 修正xcode15编译报错的问题 2023-10-17 11:47:42 +08:00
CounterFire2023
93f084fada 修正使用ios17sdk,在ios14+上crash的问题 2023-10-17 11:46:14 +08:00
CounterFire2023
324608d49a remove some unused method 2023-09-15 11:44:26 +08:00
CounterFire2023
531c85e065 增加一些android下使用的平台方法 2023-09-11 10:13:33 +08:00
CounterFire2023
ef730baa16 增加generate_clientid 2023-08-17 16:55:01 +08:00
CounterFire2023
18b5d82244 export aes encrypt and decrypt methof in jsb_global.h 2023-08-15 15:15:14 +08:00
CounterFire2023
72151488a1 移除libfreetype 2023-08-09 15:30:54 +08:00
CounterFire2023
cefd5352dc 增加google支付 2023-07-09 18:55:35 +08:00
20 changed files with 1178 additions and 956 deletions

View File

@ -286,7 +286,6 @@
D59AB429292DE3CF00714392 /* librustwallet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D59AB428292DE3CE00714392 /* librustwallet.a */; };
ED18118623D6A9B600DED444 /* edtaa3func.h in Headers */ = {isa = PBXBuildFile; fileRef = ED18118323D6A9B500DED444 /* edtaa3func.h */; };
ED18118823D6A9B600DED444 /* edtaa3func.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ED18118423D6A9B600DED444 /* edtaa3func.cpp */; };
ED18119823D6AA6700DED444 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED18119723D6AA6700DED444 /* libfreetype.a */; };
ED30578A1BEC77460083C3ED /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ED3057861BEC773E0083C3ED /* tinyxml2.cpp */; };
ED30578B1BEC774D0083C3ED /* ioapi_mem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ED3057771BEC76C90083C3ED /* ioapi_mem.cpp */; };
ED30578C1BEC77510083C3ED /* ioapi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ED3057791BEC76C90083C3ED /* ioapi.cpp */; };
@ -651,8 +650,6 @@
D59AB428292DE3CE00714392 /* librustwallet.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = librustwallet.a; path = ../external/ios/libs/librustwallet.a; sourceTree = "<group>"; };
ED18118323D6A9B500DED444 /* edtaa3func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = edtaa3func.h; path = ../external/sources/edtaa3func/edtaa3func.h; sourceTree = "<group>"; };
ED18118423D6A9B600DED444 /* edtaa3func.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = edtaa3func.cpp; path = ../external/sources/edtaa3func/edtaa3func.cpp; sourceTree = "<group>"; };
ED18119523D6AA4C00DED444 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../external/mac/libs/libfreetype.a; sourceTree = "<group>"; };
ED18119723D6AA6700DED444 /* libfreetype.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfreetype.a; path = ../external/ios/libs/libfreetype.a; sourceTree = "<group>"; };
ED3057761BEC76C90083C3ED /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crypt.h; path = ../external/sources/unzip/crypt.h; sourceTree = "<group>"; };
ED3057771BEC76C90083C3ED /* ioapi_mem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ioapi_mem.cpp; path = ../external/sources/unzip/ioapi_mem.cpp; sourceTree = "<group>"; };
ED3057781BEC76C90083C3ED /* ioapi_mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ioapi_mem.h; path = ../external/sources/unzip/ioapi_mem.h; sourceTree = "<group>"; };
@ -693,7 +690,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ED18119823D6AA6700DED444 /* libfreetype.a in Frameworks */,
468A968722F440AC005034BE /* libuv_a.a in Frameworks */,
468A968522F43F8F005034BE /* libv8_monolith.a in Frameworks */,
EDE5DFF81C0D6B3F0014147A /* libwebsockets.a in Frameworks */,
@ -738,8 +734,6 @@
1551A341158F2AB200E66CFE /* Frameworks */ = {
isa = PBXGroup;
children = (
ED18119523D6AA4C00DED444 /* libfreetype.a */,
ED18119723D6AA6700DED444 /* libfreetype.a */,
468A968622F440AC005034BE /* libuv_a.a */,
468A967D22F43F00005034BE /* libv8_monolith.a */,
468A968422F43F8F005034BE /* libv8_monolith.a */,

View File

@ -116,15 +116,27 @@ public:
inline char* getTmpPass() {return tmp_pass;}
inline char* getKeySeed() {return key_seed;}
void setKeyMaster(const char *val) {
if (key_master != nullptr) {
free(key_master);
}
key_master = strdup(val);
}
void setKeySecond(const char *val) {
if (key_second != nullptr) {
free(key_second);
}
key_second = strdup(val);
}
void setTmpPass(const char *val) {
if (tmp_pass != nullptr) {
free(tmp_pass);
}
tmp_pass = strdup(val);
}
void setKeySeed(const char *val) {
if (key_seed != nullptr) {
free(key_seed);
}
key_seed = strdup(val);
}

View File

@ -289,8 +289,6 @@ public class Cocos2dxHelper {
private static native void nativeSetApkPath(final String pApkPath);
private static native void nativeSetEditTextDialogResult(final byte[] pBytes);
private static native void nativeSetContext(final Context pContext, final AssetManager pAssetManager);
private static native void nativeSetAudioDeviceInfo(boolean isSupportLowLatency, int deviceSampleRate, int audioBufferSizeInFames);
@ -458,20 +456,7 @@ public class Cocos2dxHelper {
Cocos2dxHelper.sCocos2dxHelperListener.showDialog(pTitle, pMessage);
}
public static void setEditTextDialogResult(final String pResult) {
try {
final byte[] bytesUTF8 = pResult.getBytes("UTF8");
Cocos2dxHelper.sCocos2dxHelperListener.runOnGLThread(new Runnable() {
@Override
public void run() {
Cocos2dxHelper.nativeSetEditTextDialogResult(bytesUTF8);
}
});
} catch (UnsupportedEncodingException pUnsupportedEncodingException) {
/* Nothing. */
}
}
private static int displayMetricsToDPI(DisplayMetrics metrics)
{

View File

@ -38,39 +38,38 @@
#include "base/CCAutoreleasePool.h"
#include "base/CCGLUtils.h"
#define JNI_IMP_LOG_TAG "JniImp"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,JNI_IMP_LOG_TAG,__VA_ARGS__)
#define JNI_IMP_LOG_TAG "JniImp"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, JNI_IMP_LOG_TAG, __VA_ARGS__)
#ifndef ORG_RENDER_CLASS_NAME
#define ORG_RENDER_CLASS_NAME org_cocos2dx_lib_Cocos2dxRenderer
#endif
#define JNI_RENDER(FUNC) JNI_METHOD1(ORG_RENDER_CLASS_NAME,FUNC)
#define JNI_RENDER(FUNC) JNI_METHOD1(ORG_RENDER_CLASS_NAME, FUNC)
#ifndef ORG_JS_HELPER_CLASS_NAME
#define ORG_JS_HELPER_CLASS_NAME org_cocos2dx_lib_CocosJSHelper
#endif
#define JNI_JS_HELPER(FUNC) JNI_METHOD1(ORG_JS_HELPER_CLASS_NAME,FUNC)
#define JNI_JS_HELPER(FUNC) JNI_METHOD1(ORG_JS_HELPER_CLASS_NAME, FUNC)
#ifndef ORG_ACTIVITY_CLASS_NAME
#define ORG_ACTIVITY_CLASS_NAME org_cocos2dx_lib_Cocos2dxActivity
#endif
#define JNI_ACTIVITY(FUNC) JNI_METHOD1(ORG_ACTIVITY_CLASS_NAME,FUNC)
#define JNI_ACTIVITY(FUNC) JNI_METHOD1(ORG_ACTIVITY_CLASS_NAME, FUNC)
#ifndef ORG_ACCELEROMETER_CLASS_NAME
#define ORG_ACCELEROMETER_CLASS_NAME org_cocos2dx_lib_Cocos2dxAccelerometer
#endif
#define JNI_ACCELEROMETER(FUNC) JNI_METHOD1(ORG_ACCELEROMETER_CLASS_NAME,FUNC)
#define JNI_ACCELEROMETER(FUNC) JNI_METHOD1(ORG_ACCELEROMETER_CLASS_NAME, FUNC)
#ifndef ORG_HELPER_CLASS_NAME
#define ORG_HELPER_CLASS_NAME org_cocos2dx_lib_Cocos2dxHelper
#endif
#define JNI_HELPER(FUNC) JNI_METHOD1(ORG_HELPER_CLASS_NAME,FUNC)
#define JNI_HELPER(FUNC) JNI_METHOD1(ORG_HELPER_CLASS_NAME, FUNC)
#ifndef ORG_AUDIOFOCUS_CLASS_NAME
#define ORG_AUDIOFOCUS_CLASS_NAME org_cocos2dx_lib_Cocos2dxAudioFocusManager
#endif
#define JNI_AUDIO(FUNC) JNI_METHOD1(ORG_AUDIOFOCUS_CLASS_NAME,FUNC)
#define JNI_AUDIO(FUNC) JNI_METHOD1(ORG_AUDIOFOCUS_CLASS_NAME, FUNC)
#ifndef JCLS_HELPER
#define JCLS_HELPER "org/cocos2dx/lib/Cocos2dxHelper"
@ -84,7 +83,6 @@
#define JCSDK "com.jc.jcfw.JcSDK"
#endif
#define KEYCODE_BACK 0x04
#define KEYCODE_MENU 0x52
#define KEYCODE_DPAD_UP 0x13
@ -92,20 +90,19 @@
#define KEYCODE_DPAD_LEFT 0x15
#define KEYCODE_DPAD_RIGHT 0x16
#define KEYCODE_ENTER 0x42
#define KEYCODE_DPAD_CENTER 0x17
#define KEYCODE_DPAD_CENTER 0x17
using namespace cocos2d;
extern uint32_t __jsbInvocationCount;
namespace
{
bool __isOpenDebugView = false;
bool __isGLOptModeEnabled = true;
{
auto _isOpenDebugView = false;
auto _isGLOptModeEnabled = true;
std::string g_apkPath;
EditTextCallback s_editTextCallback = nullptr;
void* s_ctx = nullptr;
void *s_ctx = nullptr;
int g_deviceSampleRate = 44100;
int g_deviceAudioBufferSizeInFrames = 192;
int g_width = 0;
@ -114,12 +111,12 @@ namespace
bool g_isGameFinished = false;
int g_SDKInt = 0;
cocos2d::Application* g_app = nullptr;
cocos2d::Application *g_app = nullptr;
bool setCanvasCallback(se::Object* global)
bool setCanvasCallback(se::Object *global)
{
se::AutoHandleScope scope;
se::ScriptEngine* se = se::ScriptEngine::getInstance();
se::ScriptEngine *se = se::ScriptEngine::getInstance();
char commandBuf[200] = {0};
uint8_t devicePixelRatio = Application::getInstance()->getDevicePixelRatio();
sprintf(commandBuf, "window.innerWidth = %d; window.innerHeight = %d;",
@ -133,13 +130,13 @@ namespace
}
}
void cocos_jni_env_init (JNIEnv* env);
void cocos_jni_env_init(JNIEnv *env);
Application* cocos_android_app_init(int width, int height);
Application *cocos_android_app_init(int width, int height);
extern "C"
{
void getSDKInt(JNIEnv* env)
void getSDKInt(JNIEnv *env)
{
if (env && g_SDKInt == 0)
{
@ -165,361 +162,35 @@ extern "C"
return JNI_VERSION_1_4;
}
/*****************************************************
* Cocos2dxActivity native functions implementation.
*****************************************************/
JNIEXPORT jintArray JNICALL JNI_ACTIVITY(getGLContextAttrs)(JNIEnv* env, jclass thiz)
{
//REFINE
int tmp[7] = {8, 8, 8,
8, 0, 0, 0};
jintArray glContextAttrsJava = env->NewIntArray(7);
env->SetIntArrayRegion(glContextAttrsJava, 0, 7, tmp);
return glContextAttrsJava;
}
/*****************************************************
* Cocos2dxRenderer native functions implementation.
*****************************************************/
JNIEXPORT void JNICALL JNI_RENDER(nativeInit)(JNIEnv* env, jclass thiz, jint w, jint h, jstring jDefaultResourcePath)
{
g_width = w;
g_height = h;
g_app = cocos_android_app_init(w, h);
g_isGameFinished = false;
ccInvalidateStateCache();
std::string defaultResourcePath = JniHelper::jstring2string(jDefaultResourcePath);
LOGD("nativeInit: %d, %d, %s", w, h, defaultResourcePath.c_str());
if (!defaultResourcePath.empty())
FileUtils::getInstance()->setDefaultResourceRootPath(defaultResourcePath);
se::ScriptEngine* se = se::ScriptEngine::getInstance();
se->addRegisterCallback(setCanvasCallback);
EventDispatcher::init();
g_app->start();
g_isStarted = true;
}
JNIEXPORT void JNICALL JNI_RENDER(nativeRender)(JNIEnv* env)
{
if (g_isGameFinished)
{
// with Application destructor called, native resource will be released
delete g_app;
g_app = nullptr;
JniHelper::callStaticVoidMethod(JCLS_HELPER, "endApplication");
return;
}
if (!g_isStarted)
{
auto scheduler = Application::getInstance()->getScheduler();
scheduler->removeAllFunctionsToBePerformedInCocosThread();
scheduler->unscheduleAll();
se::ScriptEngine::getInstance()->cleanup();
cocos2d::PoolManager::getInstance()->getCurrentPool()->clear();
//REFINE: Wait HttpClient, WebSocket, Audio thread to exit
ccInvalidateStateCache();
se::ScriptEngine* se = se::ScriptEngine::getInstance();
se->addRegisterCallback(setCanvasCallback);
EventDispatcher::init();
if(!g_app->applicationDidFinishLaunching())
{
g_isGameFinished = true;
return;
}
g_isStarted = true;
}
static std::chrono::steady_clock::time_point prevTime;
static std::chrono::steady_clock::time_point now;
static float dt = 0.f;
static float dtSum = 0.f;
static uint32_t jsbInvocationTotalCount = 0;
static uint32_t jsbInvocationTotalFrames = 0;
bool downsampleEnabled = g_app->isDownsampleEnabled();
if (downsampleEnabled)
g_app->getRenderTexture()->prepare();
g_app->getScheduler()->update(dt);
EventDispatcher::dispatchTickEvent(dt);
if (downsampleEnabled)
g_app->getRenderTexture()->draw();
PoolManager::getInstance()->getCurrentPool()->clear();
now = std::chrono::steady_clock::now();
dt = std::chrono::duration_cast<std::chrono::microseconds>(now - prevTime).count() / 1000000.f;
prevTime = std::chrono::steady_clock::now();
if (__isOpenDebugView)
{
dtSum += dt;
++jsbInvocationTotalFrames;
jsbInvocationTotalCount += __jsbInvocationCount;
if (dtSum > 1.0f)
{
dtSum = 0.0f;
setJSBInvocationCountJNI(jsbInvocationTotalCount / jsbInvocationTotalFrames);
jsbInvocationTotalCount = 0;
jsbInvocationTotalFrames = 0;
}
}
__jsbInvocationCount = 0;
}
JNIEXPORT void JNICALL JNI_RENDER(nativeOnPause)()
{
if (g_isGameFinished) {
return;
}
if (g_app)
g_app->onPause();
}
JNIEXPORT void JNICALL JNI_RENDER(nativeOnResume)()
{
if (g_isGameFinished) {
return;
}
if (g_app)
g_app->onResume();
}
JNIEXPORT void JNICALL JNI_RENDER(nativeInsertText)(JNIEnv* env, jclass thiz, jstring text)
{
//REFINE
}
JNIEXPORT void JNICALL JNI_RENDER(nativeDeleteBackward)(JNIEnv* env, jclass thiz)
{
//REFINE
}
JNIEXPORT jstring JNICALL JNI_RENDER(nativeGetContentText)()
{
//REFINE
}
JNIEXPORT void JNICALL JNI_RENDER(nativeOnSurfaceChanged)(JNIEnv* env, jclass thiz, jint w, jint h)
{
//REFINE
}
/***********************************************************
* Cocos2dxAccelerometer native functions implementation.
***********************************************************/
JNIEXPORT void JNICALL JNI_ACCELEROMETER(onSensorChanged)(JNIEnv* env, jclass thiz, jfloat x, jfloat y, jfloat z, jlong timeStamp)
{
//REFINE
}
/***********************************************************
* Touches native functions implementation.
***********************************************************/
static void dispatchTouchEventWithOnePoint(JNIEnv* env, cocos2d::TouchEvent::Type type, jint id, jfloat x, jfloat y)
{
if (g_isGameFinished) {
return;
}
cocos2d::TouchEvent touchEvent;
touchEvent.type = type;
uint8_t devicePixelRatio = Application::getInstance()->getDevicePixelRatio();
cocos2d::TouchInfo touchInfo;
touchInfo.index = id;
touchInfo.x = x / devicePixelRatio;
touchInfo.y = y / devicePixelRatio;
touchEvent.touches.push_back(touchInfo);
cocos2d::EventDispatcher::dispatchTouchEvent(touchEvent);
}
static void dispatchTouchEventWithPoints(JNIEnv* env, cocos2d::TouchEvent::Type type, jintArray ids, jfloatArray xs, jfloatArray ys)
{
if (g_isGameFinished) {
return;
}
cocos2d::TouchEvent touchEvent;
touchEvent.type = type;
int size = env->GetArrayLength(ids);
jint id[size];
jfloat x[size];
jfloat y[size];
env->GetIntArrayRegion(ids, 0, size, id);
env->GetFloatArrayRegion(xs, 0, size, x);
env->GetFloatArrayRegion(ys, 0, size, y);
uint8_t devicePixelRatio = Application::getInstance()->getDevicePixelRatio();
for(int i = 0; i < size; i++)
{
cocos2d::TouchInfo touchInfo;
touchInfo.index = id[i];
touchInfo.x = x[i] / devicePixelRatio;
touchInfo.y = y[i] / devicePixelRatio;
touchEvent.touches.push_back(touchInfo);
}
cocos2d::EventDispatcher::dispatchTouchEvent(touchEvent);
}
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesBegin)(JNIEnv * env, jclass thiz, jint id, jfloat x, jfloat y)
{
if (g_isGameFinished) {
return;
}
dispatchTouchEventWithOnePoint(env, cocos2d::TouchEvent::Type::BEGAN, id, x, y);
}
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesEnd)(JNIEnv * env, jclass thiz, jint id, jfloat x, jfloat y)
{
if (g_isGameFinished) {
return;
}
dispatchTouchEventWithOnePoint(env, cocos2d::TouchEvent::Type::ENDED, id, x, y);
}
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesMove)(JNIEnv * env, jclass thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
{
if (g_isGameFinished) {
return;
}
dispatchTouchEventWithPoints(env, cocos2d::TouchEvent::Type::MOVED, ids, xs, ys);
}
JNIEXPORT void JNICALL JNI_RENDER(nativeTouchesCancel)(JNIEnv * env, jclass thiz, jintArray ids, jfloatArray xs, jfloatArray ys)
{
if (g_isGameFinished) {
return;
}
dispatchTouchEventWithPoints(env, cocos2d::TouchEvent::Type::CANCELLED, ids, xs, ys);
}
JNIEXPORT jboolean JNICALL JNI_RENDER(nativeKeyEvent)(JNIEnv * env, jclass thiz, jint keyCode, jboolean isPressed)
{
if (g_isGameFinished) {
return JNI_TRUE;
}
int keyInWeb = -1;
// key values in web, refer to http://docs.cocos.com/creator/api/en/enums/KEY.html
switch(keyCode)
{
case KEYCODE_BACK:
keyInWeb = 6;
break;
case KEYCODE_ENTER:
keyInWeb = 13;
break;
case KEYCODE_MENU:
keyInWeb = 18;
break;
case KEYCODE_DPAD_UP:
keyInWeb = 1003;
break;
case KEYCODE_DPAD_DOWN:
keyInWeb = 1004;
break;
case KEYCODE_DPAD_LEFT:
keyInWeb = 1000;
break;
case KEYCODE_DPAD_RIGHT:
keyInWeb = 1001;
break;
case KEYCODE_DPAD_CENTER:
keyInWeb = 1005;
break;
default:
keyInWeb = 0; // If the key can't be identified, this value is 0
}
KeyboardEvent event;
event.key = keyInWeb;
event.action = isPressed ? KeyboardEvent::Action::PRESS : KeyboardEvent::Action::RELEASE;
EventDispatcher::dispatchKeyboardEvent(event);
return JNI_TRUE;
}
/***********************************************************
* Cocos2dxHelper native functions implementation.
***********************************************************/
JNIEXPORT void JNICALL JNI_HELPER(nativeSetApkPath)(JNIEnv* env, jclass thiz, jstring apkPath)
JNIEXPORT void JNICALL JNI_HELPER(nativeSetApkPath)(JNIEnv *env, jclass thiz, jstring apkPath)
{
LOGD("nativeSetApkPath: %s", apkPath);
g_apkPath = JniHelper::jstring2string(apkPath);
LOGD("nativeSetApkPath: %s", g_apkPath.c_str());
}
JNIEXPORT void JNICALL JNI_HELPER(nativeSetContext)(JNIEnv* env, jclass thiz, jobject context, jobject assetManager)
JNIEXPORT void JNICALL JNI_HELPER(nativeSetContext)(JNIEnv *env, jclass thiz, jobject context, jobject assetManager)
{
JniHelper::setClassLoaderFrom(context);
FileUtilsAndroid::setassetmanager(AAssetManager_fromJava(env, assetManager));
}
JNIEXPORT void JNICALL JNI_HELPER(nativeSetAudioDeviceInfo)(JNIEnv* env, jclass thiz, jboolean isSupportLowLatency, jint deviceSampleRate, jint deviceAudioBufferSizeInFrames)
JNIEXPORT void JNICALL JNI_HELPER(nativeSetAudioDeviceInfo)(JNIEnv *env, jclass thiz, jboolean isSupportLowLatency, jint deviceSampleRate, jint deviceAudioBufferSizeInFrames)
{
g_deviceSampleRate = deviceSampleRate;
g_deviceAudioBufferSizeInFrames = deviceAudioBufferSizeInFrames;
LOGD("nativeSetAudioDeviceInfo: sampleRate: %d, bufferSizeInFrames: %d", g_deviceSampleRate, g_deviceAudioBufferSizeInFrames);
}
JNIEXPORT void JNICALL JNI_HELPER(nativeSetEditTextDialogResult)(JNIEnv* env, jclass obj, jbyteArray text)
{
jsize size = env->GetArrayLength(text);
if (size > 0)
{
jbyte * data = (jbyte*)env->GetByteArrayElements(text, 0);
char* buffer = (char*)malloc(size+1);
if (buffer != nullptr)
{
memcpy(buffer, data, size);
buffer[size] = '\0';
// pass data to edittext's delegate
if (s_editTextCallback)
s_editTextCallback(buffer, s_ctx);
free(buffer);
}
env->ReleaseByteArrayElements(text, data, 0);
}
else
{
if (s_editTextCallback)
s_editTextCallback("", s_ctx);
}
}
/***********************************************************
* Cocos2dxAudioFocusManager native functions implementation.
***********************************************************/
JNIEXPORT void JNICALL JNI_AUDIO(nativeOnAudioFocusChange)(JNIEnv* env, jclass thiz, jint focusChange)
JNIEXPORT void JNICALL JNI_AUDIO(nativeOnAudioFocusChange)(JNIEnv *env, jclass thiz, jint focusChange)
{
// cocos_audioengine_focus_change(focusChange);
}
@ -527,23 +198,23 @@ extern "C"
/***********************************************************
* CocosJSHelper native functions implementation.
***********************************************************/
JNIEXPORT void JNICALL JNI_JS_HELPER(nativeJSInit)(JNIEnv *env, jclass clazz, jstring resource_path) {
JNIEXPORT void JNICALL JNI_JS_HELPER(nativeJSInit)(JNIEnv *env, jclass clazz, jstring resource_path)
{
g_app = cocos_android_app_init(1, 1);
se::ScriptEngine* se = se::ScriptEngine::getInstance();
// se->addRegisterCallback(setCanvasCallback);
se::ScriptEngine *se = se::ScriptEngine::getInstance();
// se->addRegisterCallback(setCanvasCallback);
EventDispatcher::init();
g_app->start();
}
JNIEXPORT void JNICALL JNI_JS_HELPER(initNativeWallet)(JNIEnv *env, jclass clazz, jstring resource_path) {
JNIEXPORT void JNICALL JNI_JS_HELPER(initNativeWallet)(JNIEnv *env, jclass clazz, jstring resource_path)
{
se::Value rval;
se::ScriptEngine* se = se::ScriptEngine::getInstance();
se::ScriptEngine *se = se::ScriptEngine::getInstance();
se::AutoHandleScope hs;
std::string coder = "jc.wallet.currentAccount().address";
se::ScriptEngine::getInstance()->evalString(coder.c_str(), coder.size(), &rval);
// jsb_run_code("jc.wallet.currentAccount().address", &rval);
cocos2d::log("\n cpp init wallet: %s \n", &rval);
}
} // end of extern "C"
@ -556,28 +227,28 @@ void restartJSVM()
* Functions invoke from cpp to Java.
***********************************************************/
std::string getApkPathJNI()
std::string getApkPathJNI()
{
return g_apkPath;
}
std::string getPackageNameJNI()
std::string getPackageNameJNI()
{
return JniHelper::callStaticStringMethod(JCLS_HELPER, "getPackageName");
}
int getObbAssetFileDescriptorJNI(const std::string& path, long* startOffset, long* size)
int getObbAssetFileDescriptorJNI(const std::string &path, long *startOffset, long *size)
{
JniMethodInfo methodInfo;
int fd = 0;
if (JniHelper::getStaticMethodInfo(methodInfo, JCLS_HELPER, "getObbAssetFileDescriptor", "(Ljava/lang/String;)[J"))
{
jstring stringArg = methodInfo.env->NewStringUTF(path.c_str());
jlongArray newArray = (jlongArray)methodInfo.env->CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID, stringArg);
jsize theArrayLen = methodInfo.env->GetArrayLength(newArray);
if (3 == theArrayLen)
if (3 == theArrayLen)
{
jboolean copy = JNI_FALSE;
jlong *array = methodInfo.env->GetLongArrayElements(newArray, &copy);
@ -586,11 +257,11 @@ int getObbAssetFileDescriptorJNI(const std::string& path, long* startOffset, lon
*size = array[2];
methodInfo.env->ReleaseLongArrayElements(newArray, array, 0);
}
methodInfo.env->DeleteLocalRef(methodInfo.classID);
methodInfo.env->DeleteLocalRef(stringArg);
}
return fd;
}
@ -604,21 +275,21 @@ int getDeviceAudioBufferSizeInFramesJNI()
return g_deviceAudioBufferSizeInFrames;
}
void convertEncodingJNI(const std::string& src, int byteSize, const std::string& fromCharset, std::string& dst, const std::string& newCharset)
void convertEncodingJNI(const std::string &src, int byteSize, const std::string &fromCharset, std::string &dst, const std::string &newCharset)
{
JniMethodInfo methodInfo;
if (JniHelper::getStaticMethodInfo(methodInfo, JCLS_HELPER, "conversionEncoding", "([BLjava/lang/String;Ljava/lang/String;)[B"))
{
jbyteArray strArray = methodInfo.env->NewByteArray(byteSize);
methodInfo.env->SetByteArrayRegion(strArray, 0, byteSize, reinterpret_cast<const jbyte*>(src.c_str()));
methodInfo.env->SetByteArrayRegion(strArray, 0, byteSize, reinterpret_cast<const jbyte *>(src.c_str()));
jstring stringArg1 = methodInfo.env->NewStringUTF(fromCharset.c_str());
jstring stringArg2 = methodInfo.env->NewStringUTF(newCharset.c_str());
jbyteArray newArray = (jbyteArray)methodInfo.env->CallStaticObjectMethod(methodInfo.classID, methodInfo.methodID, strArray, stringArg1, stringArg2);
jsize theArrayLen = methodInfo.env->GetArrayLength(newArray);
methodInfo.env->GetByteArrayRegion(newArray, 0, theArrayLen, (jbyte*)dst.c_str());
methodInfo.env->GetByteArrayRegion(newArray, 0, theArrayLen, (jbyte *)dst.c_str());
methodInfo.env->DeleteLocalRef(strArray);
methodInfo.env->DeleteLocalRef(stringArg1);
@ -643,102 +314,144 @@ std::string getSystemVersionJNI()
return JniHelper::callStaticStringMethod(JCLS_HELPER, "getSystemVersion");
}
bool openURLJNI(const std::string& url)
bool openURLJNI(const std::string &url)
{
return JniHelper::callStaticBooleanMethod(JCLS_HELPER, "openURL", url);
}
void copyTextToClipboardJNI(const std::string& text)
void copyTextToClipboardJNI(const std::string &text)
{
JniHelper::callStaticVoidMethod(JCLS_HELPER, "copyTextToClipboard", text);
}
void showQRCodeJNI(const std::string& funid, const std::string& content)
void showQRCodeJNI(const std::string &funid, const std::string &content)
{
JniHelper::callStaticVoidMethod(JCSDK, "showQRCode", funid, content);
}
void showWebPageJNI(const std::string& funid, const std::string& content)
void showWebPageJNI(const std::string &funid, const std::string &content)
{
JniHelper::callStaticVoidMethod(JCSDK, "showWebPage", funid, content);
}
void scanQRCodeJNI(const std::string& funid, const std::string& title)
void scanQRCodeJNI(const std::string &funid, const std::string &title)
{
JniHelper::callStaticVoidMethod(JCSDK, "scanQRCode", funid, title);
}
void signWithGoogleJNI(const std::string& funid)
void signWithGoogleJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "signWithGoogle", funid);
}
void signWithAppleJNI(const std::string& funid)
void signWithAppleJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "signWithApple", funid);
}
void signWithTiktokJNI(const std::string& funid)
void signWithTiktokJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "signWithTiktok", funid);
}
void signOutGoogleJNI(const std::string& funid)
void signOutGoogleJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "signOutGoogle", funid);
}
void signWithFacebookJNI(const std::string& funid)
void signWithFacebookJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "signWithFacebook", funid);
}
void signWithTwitterJNI(const std::string& funid)
void signWithTwitterJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "signWithTwitter", funid);
}
void signWithEmailJNI(const std::string& funid)
void signWithEmailJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "signWithEmail", funid);
}
void signWithOAuthJNI(const std::string &funid, const std::string &jsondata)
{
JniHelper::callStaticVoidMethod(JCSDK, "signWithOAuth", funid, jsondata);
}
void callJcVoidMethodJNI(const std::string& funid, const std::string& method_name)
void callJcVoidMethodJNI(const std::string &funid, const std::string &method_name)
{
JniHelper::callStaticVoidMethod(JCSDK, method_name, funid);
}
void toWalletJNI(const std::string& url)
void toWalletJNI(const std::string &url)
{
JniHelper::callStaticVoidMethod(JCSDK, "toWallet", url);
}
void beginBuyJNI(const std::string &funid, const std::string &productid, const std::string &orderid)
{
JniHelper::callStaticVoidMethod(JCSDK, "buyProduct", funid, productid, orderid);
}
void passStorageStateJNI(const std::string &funid, const std::string &account)
{
JniHelper::callStaticVoidMethod(JCSDK, "passStorageState", funid, account);
}
void storagePassJNI(const std::string &funid, const std::string &account, std::string &password)
{
JniHelper::callStaticVoidMethod(JCSDK, "storagePass", funid, account, password);
}
void storageGameDataJNI(const std::string &content) {
JniHelper::callStaticVoidMethod(JCSDK, "storageGameData", content);
}
void onProxyCBJNI(const std::string &funid, const std::string &data) {
JniHelper::callStaticVoidMethod(JCSDK, "onProxyCB", funid, data);
}
void authGetStoragePassJNI(const std::string &funid, const std::string &account)
{
JniHelper::callStaticVoidMethod(JCSDK, "authGetStoragePass", funid, account);
}
void getClientIdJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "getClientId", funid);
}
void queryProductsJNI(const std::string &funid, const std::string &content)
{
JniHelper::callStaticVoidMethod(JCSDK, "queryProducts", funid, content);
}
void queryPurchaseJNI(const std::string &funid)
{
JniHelper::callStaticVoidMethod(JCSDK, "queryPurchase", funid);
}
void setPreferredFramesPerSecondJNI(int fps)
{
JniHelper::callStaticVoidMethod(JCLS_RENDERER, "setPreferredFramesPerSecond", fps);
}
void setGameInfoDebugViewTextJNI(int index, const std::string& text)
void setGameInfoDebugViewTextJNI(int index, const std::string &text)
{
if (!__isOpenDebugView)
if (!_isOpenDebugView)
return;
JniHelper::callStaticVoidMethod(JCLS_HELPER, "setGameInfoDebugViewText", index, text);
}
void setJSBInvocationCountJNI(int count)
{
if (!__isOpenDebugView)
if (!_isOpenDebugView)
return;
JniHelper::callStaticVoidMethod(JCLS_HELPER, "setJSBInvocationCount", count);
}
void openDebugViewJNI()
{
if (!__isOpenDebugView)
if (!_isOpenDebugView)
{
LOGD("openDebugViewJNI ...");
__isOpenDebugView = true;
_isOpenDebugView = true;
JniHelper::callStaticVoidMethod(JCLS_HELPER, "openDebugView");
if (!__isGLOptModeEnabled)
if (!_isGLOptModeEnabled)
{
JniHelper::callStaticVoidMethod(JCLS_HELPER, "disableBatchGLCommandsToNative");
}
@ -747,8 +460,8 @@ void openDebugViewJNI()
void disableBatchGLCommandsToNativeJNI()
{
__isGLOptModeEnabled = false;
if (__isOpenDebugView)
_isGLOptModeEnabled = false;
if (_isOpenDebugView)
{
JniHelper::callStaticVoidMethod(JCLS_HELPER, "disableBatchGLCommandsToNative");
}
@ -759,7 +472,6 @@ void exitApplication()
g_isGameFinished = true;
}
bool getApplicationExited()
{
return g_isGameFinished;
@ -769,4 +481,3 @@ int getAndroidSDKInt()
{
return g_SDKInt;
}

View File

@ -26,7 +26,7 @@
#include <string>
typedef void (*EditTextCallback)(const std::string& text, void* ctx);
typedef void (*EditTextCallback)(const std::string &text, void *ctx);
extern bool getApplicationExited();
@ -35,20 +35,30 @@ extern void exitApplication();
extern std::string getApkPathJNI();
extern std::string getPackageNameJNI();
void showQRCodeJNI(const std::string& funid, const std::string& content);
void scanQRCodeJNI(const std::string& funid, const std::string& title);
void showWebPageJNI(const std::string& funid, const std::string& url);
void signWithGoogleJNI(const std::string& funid);
void signWithAppleJNI(const std::string& funid);
void signWithTiktokJNI(const std::string& funid);
void signOutGoogleJNI(const std::string& funid);
void signWithFacebookJNI(const std::string& funid);
void signWithTwitterJNI(const std::string& funid);
void signWithEmailJNI(const std::string& funid);
void callJcVoidMethodJNI(const std::string& funid, const std::string& method_name);
void toWalletJNI(const std::string& url);
extern int getObbAssetFileDescriptorJNI(const std::string& path, long* startOffset, long* size);
extern void convertEncodingJNI(const std::string& src, int byteSize, const std::string& fromCharset, std::string& dst, const std::string& newCharset);
void showQRCodeJNI(const std::string &funid, const std::string &content);
void scanQRCodeJNI(const std::string &funid, const std::string &title);
void showWebPageJNI(const std::string &funid, const std::string &url);
void signWithGoogleJNI(const std::string &funid);
void signWithAppleJNI(const std::string &funid);
void signWithTiktokJNI(const std::string &funid);
void signOutGoogleJNI(const std::string &funid);
void signWithFacebookJNI(const std::string &funid);
void signWithTwitterJNI(const std::string &funid);
void signWithEmailJNI(const std::string &funid);
void signWithOAuthJNI(const std::string &funid, const std::string &jsondata);
void callJcVoidMethodJNI(const std::string &funid, const std::string &method_name);
void toWalletJNI(const std::string &url);
void beginBuyJNI(const std::string &funid, const std::string &productid, const std::string &orderid);
void passStorageStateJNI(const std::string &funid, const std::string &account);
void storagePassJNI(const std::string &funid, const std::string &account, std::string &password);
void authGetStoragePassJNI(const std::string &funid, const std::string &account);
void getClientIdJNI(const std::string &funid);
void queryProductsJNI(const std::string &funid, const std::string &content);
void queryPurchaseJNI(const std::string &funid);
void storageGameDataJNI(const std::string &content);
void onProxyCBJNI(const std::string &funid, const std::string &data);
extern int getObbAssetFileDescriptorJNI(const std::string &path, long *startOffset, long *size);
extern void convertEncodingJNI(const std::string &src, int byteSize, const std::string &fromCharset, std::string &dst, const std::string &newCharset);
extern int getDeviceSampleRateJNI();
extern int getDeviceAudioBufferSizeInFramesJNI();
@ -56,10 +66,10 @@ extern int getDeviceAudioBufferSizeInFramesJNI();
extern std::string getCurrentLanguageJNI();
extern std::string getCurrentLanguageCodeJNI();
extern std::string getSystemVersionJNI();
extern bool openURLJNI(const std::string& url);
extern void copyTextToClipboardJNI(const std::string& text);
extern bool openURLJNI(const std::string &url);
extern void copyTextToClipboardJNI(const std::string &text);
extern void setPreferredFramesPerSecondJNI(int fps);
extern void setGameInfoDebugViewTextJNI(int index, const std::string& text);
extern void setGameInfoDebugViewTextJNI(int index, const std::string &text);
extern void setJSBInvocationCountJNI(int count);
extern void openDebugViewJNI();
extern void disableBatchGLCommandsToNativeJNI();

View File

@ -138,10 +138,7 @@ namespace
[self stopMainLoop];
_displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(doCaller:)];
if (_systemVersion >= 10.0f)
[_displayLink setPreferredFramesPerSecond: _fps];
else
[_displayLink setFrameInterval: 60 / _fps];
[_displayLink setPreferredFramesPerSecond: _fps];
[_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
@ -263,7 +260,7 @@ bool Application::isDisplayStats() {
void Application::setDisplayStats(bool isShow) {
se::AutoHandleScope hs;
char commandBuf[100] = {0};
sprintf(commandBuf, "cc.debug.setDisplayStats(%s);", isShow ? "true" : "false");
snprintf(commandBuf, isShow ? 31 : 32, "cc.debug.setDisplayStats(%s);", isShow ? "true" : "false");
se::ScriptEngine::getInstance()->evalString(commandBuf);
}
@ -320,9 +317,14 @@ GLint Application::getMainFBO() const
bool Application::openURL(const std::string &url)
{
NSString* msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding];
NSURL* nsUrl = [NSURL URLWithString:msg];
return [[UIApplication sharedApplication] openURL:nsUrl];
NSString* msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding];
NSURL* nsUrl = [NSURL URLWithString:msg];
[[UIApplication sharedApplication] openURL:nsUrl options:@{} completionHandler:^(BOOL success) {
if (success) {
NSLog(@"Opened url");
}
}];
return true;
}
void Application::copyTextToClipboard(const std::string &text)
@ -356,6 +358,7 @@ void Application::loadKeyLocal(const std::string &account, std::string *outItem)
void Application::toWallet(const std::string &url) {
UIApplication *app = [UIApplication sharedApplication];
NSString *uri = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding];
NSLog(@"open url: %@", uri);
[app openURL:[NSURL URLWithString:uri] options:@{} completionHandler:^(BOOL success) {
if (success) {
NSLog(@"Opened url");

File diff suppressed because it is too large Load Diff

View File

@ -27,24 +27,32 @@
#include <string>
namespace se {
namespace se
{
class Object;
class Class;
class Value;
}
extern se::Object* __jsbObj;
extern se::Object* __glObj;
extern se::Object *__jsbObj;
extern se::Object *__glObj;
bool jsb_register_global_variables(se::Object* global);
bool jsb_register_global_variables(se::Object *global);
void jsb_init_file_operation_delegate();
bool jsb_enable_debugger(const std::string& debuggerServerAddr, uint32_t port, bool isWaitForConnect = false);
bool jsb_set_extend_property(const char* ns, const char* clsName);
bool jsb_run_script(const std::string& filePath, se::Value* rval = nullptr);
bool jsb_run_code(const std::string& coder, se::Value* rval = nullptr);
bool jsb_run_script_module(const std::string& filePath, se::Value* rval = nullptr);
bool jsb_enable_debugger(const std::string &debuggerServerAddr, uint32_t port, bool isWaitForConnect = false);
bool jsb_set_extend_property(const char *ns, const char *clsName);
bool jsb_run_script(const std::string &filePath, se::Value *rval = nullptr);
bool jsb_run_code(const std::string &coder, se::Value *rval = nullptr);
bool jsb_run_script_module(const std::string &filePath, se::Value *rval = nullptr);
void jsb_set_xxtea_key(const std::string& key);
void jsb_set_xxtea_key(const std::string &key);
bool jsb_global_load_image(const std::string& path, const se::Value& callbackVal);
bool jsb_global_load_image(const std::string &path, const se::Value &callbackVal);
std::string encrypt_aes(std::string &content, std::string &key);
std::string decrypt_aes(std::string &content, std::string &key);
std::string generate_clientid(std::string &content);
std::string getpk();
void store_encrypt_item(std::string key, std::string value);
bool load_encrypt_item(std::string key, std::string *value);

View File

@ -38,6 +38,7 @@
#include <functional>
#include <algorithm>
#include <sstream>
#include <locale>
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
#include "cocos/scripting/js-bindings/manual/jsb_conversions.hpp"
#include "cocos/network/HttpClient.h"
@ -350,11 +351,17 @@ void XMLHttpRequest::setReadyState(ReadyState readyState)
}
}
std::string to_lower(std::string s) {
for(char &c : s)
c = tolower(c);
return s;
}
void XMLHttpRequest::getHeader(const std::string& header)
{
// check for colon.
size_t found_header_field = header.find_first_of(":");
// size_t found_header_field = header.find_first_of(":");
unsigned long found_header_field = header.find(":");
if (found_header_field != std::string::npos)
{
// Found a header field.
@ -375,9 +382,10 @@ void XMLHttpRequest::getHeader(const std::string& header)
}
// Transform field name to lower case as they are case-insensitive
std::transform(http_field.begin(), http_field.end(), http_field.begin(), ::tolower);
std::string lower_http_field = to_lower(http_field);
// std::transform(http_field.begin(), http_field.end(), http_field.begin(), ::tolower);
_httpHeader[http_field] = http_value;
_httpHeader[lower_http_field] = http_value;
}
else
@ -1042,7 +1050,7 @@ static bool XMLHttpRequest_setTimeout(se::State& s)
unsigned long timeoutInMilliseconds = 0;
bool ok = seval_to_ulong(args[0], &timeoutInMilliseconds);
SE_PRECONDITION2(ok, false, "args[0] isn't a number");
if (timeoutInMilliseconds < 50)
if (timeoutInMilliseconds < 50 && timeoutInMilliseconds != 0)
{
SE_LOGE("The timeout value (%lu ms) is too small, please note that timeout unit is milliseconds!", timeoutInMilliseconds);
}
@ -1111,6 +1119,14 @@ static bool XMLHttpRequest_setResponseType(se::State& s)
{
xhr->setResponseType(XMLHttpRequest::ResponseType::BLOB);
}
else if (type == "ms-stream")
{
xhr->setResponseType(XMLHttpRequest::ResponseType::BLOB);
}
else if (type == "moz-chunked-arraybuffer")
{
xhr->setResponseType(XMLHttpRequest::ResponseType::BLOB);
}
else
{
SE_PRECONDITION2(false, false, "The response type isn't supported!");

View File

@ -18,6 +18,8 @@ char *sign_for_tran(const char *msg_key,
char *rencrypt(const char *pk, const char *msg);
char *rdecrypt(const char *sk, const char *msg);
char *wallet_encrypt(const char *msg_key,
const char *master_key,
const char *second_key,
@ -45,3 +47,15 @@ char *local_pass_hasher(const char *password);
bool verify_local_pass(const char *password, const char *pass_hash);
char *generate_client_key(const char *password, const char *openid, const char *salt);
char *simple_sign(const char *content, const char *key);
char *ramdonKey(void);
char *rsa_key_pair(void);
char *rsa_encrypt(const char *content, const char *p_key);
char *rsa_decrypt(const char *content, const char *s_key);
void free_cstr(char *s);

Binary file not shown.

View File

@ -18,6 +18,8 @@ char *sign_for_tran(const char *msg_key,
char *rencrypt(const char *pk, const char *msg);
char *rdecrypt(const char *sk, const char *msg);
char *wallet_encrypt(const char *msg_key,
const char *master_key,
const char *second_key,
@ -45,3 +47,15 @@ char *local_pass_hasher(const char *password);
bool verify_local_pass(const char *password, const char *pass_hash);
char *generate_client_key(const char *password, const char *openid, const char *salt);
char *simple_sign(const char *content, const char *key);
char *ramdonKey(void);
char *rsa_key_pair(void);
char *rsa_encrypt(const char *content, const char *p_key);
char *rsa_decrypt(const char *content, const char *s_key);
void free_cstr(char *s);

Binary file not shown.

View File

@ -18,6 +18,8 @@ char *sign_for_tran(const char *msg_key,
char *rencrypt(const char *pk, const char *msg);
char *rdecrypt(const char *sk, const char *msg);
char *wallet_encrypt(const char *msg_key,
const char *master_key,
const char *second_key,
@ -45,3 +47,15 @@ char *local_pass_hasher(const char *password);
bool verify_local_pass(const char *password, const char *pass_hash);
char *generate_client_key(const char *password, const char *openid, const char *salt);
char *simple_sign(const char *content, const char *key);
char *ramdonKey(void);
char *rsa_key_pair(void);
char *rsa_encrypt(const char *content, const char *p_key);
char *rsa_decrypt(const char *content, const char *s_key);
void free_cstr(char *s);

Binary file not shown.

View File

@ -18,6 +18,8 @@ char *sign_for_tran(const char *msg_key,
char *rencrypt(const char *pk, const char *msg);
char *rdecrypt(const char *sk, const char *msg);
char *wallet_encrypt(const char *msg_key,
const char *master_key,
const char *second_key,
@ -45,3 +47,15 @@ char *local_pass_hasher(const char *password);
bool verify_local_pass(const char *password, const char *pass_hash);
char *generate_client_key(const char *password, const char *openid, const char *salt);
char *simple_sign(const char *content, const char *key);
char *ramdonKey(void);
char *rsa_key_pair(void);
char *rsa_encrypt(const char *content, const char *p_key);
char *rsa_decrypt(const char *content, const char *s_key);
void free_cstr(char *s);

Binary file not shown.

View File

@ -18,6 +18,8 @@ char *sign_for_tran(const char *msg_key,
char *rencrypt(const char *pk, const char *msg);
char *rdecrypt(const char *sk, const char *msg);
char *wallet_encrypt(const char *msg_key,
const char *master_key,
const char *second_key,
@ -45,3 +47,15 @@ char *local_pass_hasher(const char *password);
bool verify_local_pass(const char *password, const char *pass_hash);
char *generate_client_key(const char *password, const char *openid, const char *salt);
char *simple_sign(const char *content, const char *key);
char *ramdonKey(void);
char *rsa_key_pair(void);
char *rsa_encrypt(const char *content, const char *p_key);
char *rsa_decrypt(const char *content, const char *s_key);
void free_cstr(char *s);

View File

@ -23,6 +23,24 @@
#ifndef UV_H
#define UV_H
#include "uv/errno.h"
#include "uv/version.h"
#include <stddef.h>
#include <stdio.h>
#if defined(_MSC_VER) && _MSC_VER < 1600
# include "uv/stdint-msvc2008.h"
#else
# include <stdint.h>
#endif
#if defined(_WIN32)
# include "uv/win.h"
#else
# include "uv/unix.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -45,22 +63,7 @@ extern "C" {
# define UV_EXTERN /* nothing */
#endif
#include "uv/errno.h"
#include "uv/version.h"
#include <stddef.h>
#include <stdio.h>
#if defined(_MSC_VER) && _MSC_VER < 1600
# include "uv/stdint-msvc2008.h"
#else
# include <stdint.h>
#endif
#if defined(_WIN32)
# include "uv/win.h"
#else
# include "uv/unix.h"
#endif
/* Expand this list if necessary. */
#define UV_ERRNO_MAP(XX) \

Binary file not shown.