#include <android/asset_manager.h>
#include <android/native_window_jni.h>
#include <jni.h>
#include <zlib.h>
#include <dlfcn.h>
#include "FTTJNI.h"
#include "AndroidApp.h"
#include "CFTTAWSKinesisFirehose.h"
#include "CFTTFileSystem_Android.h"
#include "CFTTMem.h"
#include "CFTTSerialize.h"
#include "CFTTServerTime.h"
#include "FTTGraphics.h"
#include "FTTMutex.h"
#include "IAP.h"
#include "Soccer.h"
#include "CStoryCore.h"
#include "CMyProfile.h"
#include "FTTInput.h"
#include "CFE.h"
#include "CFTTAndroidAppCInterface.h"
#include "CStoryProfile.h"
#include "FTTGraphics.h"
#include "log.h"

struct TFTTJNI {
  int field_0;
  int field_4;
  int field_8;
  int field_C;
  int field_10;
  int field_14;
  int field_18;
  int field_1C;
  int field_20;
  FTTMutex tMutex_24;
};

bool bool_348918;
int dword_34891C;
bool bSoccerInit_4B8540;
MYSTATIC TFTTJNI tFTTJNI_4B8550 = {SCR_WID, SCR_HEI, 0, 0, 0, 0, 0, 0, 0, FTTMutex{"JNIMutex", EFTTProtocol_0}};

bool FE_bBackButtonPressed;

typedef void (*func_AdjustCB)(int d);
func_AdjustCB g_fpAdjustCB = nullptr;

//-------------------------------------------------------------------------------------------------
extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
  return JNI_VERSION_1_6;
}
//-------------------------------------------------------------------------------------------------
//001F71D8
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_AddRepeatAndTimeNotifications(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_AddRepeatAndTimeNotifications Entry");
  MP_cMyProfile.SetNotificationRewards();
  CStoryCore::LoadConfigForTimeAndRepeatNotifications();
  LOGI("FTTJNI_AddRepeatAndTimeNotifications End");
}
//-------------------------------------------------------------------------------------------------
//001F6EA4
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_AddTouch(JNIEnv *env, jobject obj,
                                                                       jfloat paramjfloat1,
                                                                       jfloat paramjfloat2,
                                                                       jint paramjint1,
                                                                       jint paramjint2) {
  LOGI("FTTJNI_AddTouch");
  FTTInputTouch_AddAndroidTouchEvent(paramjfloat1, paramjfloat2, paramjint1, paramjint2);
}
//-------------------------------------------------------------------------------------------------
//001F7444
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_AdjustVerificationFailed(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_AdjustVerificationFailed Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  if (g_fpAdjustCB)
    g_fpAdjustCB(1);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_AdjustVerificationFailed End");
}
//-------------------------------------------------------------------------------------------------
//001F737C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_AdjustVerificationSucceeded(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_AdjustVerificationSucceeded Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  if (g_fpAdjustCB)
    g_fpAdjustCB(0);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_AdjustVerificationSucceeded End");
}
//-------------------------------------------------------------------------------------------------
//001F75D8
extern "C" JNIEXPORT jdouble Java_com_firsttouchgames_ftt_FTTJNI_AnalyticsUserGroupCB(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_AnalyticsUserGroupCB Entry");
  double dret = 0.0;
  tFTTJNI_4B8550.tMutex_24.Lock();

  // if (CFTTAnalytics::ms_fpUserGroupCB) {
  //   dret = -1.0;
  //   double v2 = 0.0;
  //   if (CFTTAnalytics::ms_fpUserGroupCB(&v2))
  //     dret = v2;
  // } else {
  //   dret = 0.0;
  // }

  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_AnalyticsUserGroupCB End");
  return dret;
}
//-------------------------------------------------------------------------------------------------
//001F7630
extern "C" JNIEXPORT jdouble Java_com_firsttouchgames_ftt_FTTJNI_AnalyticsUserIDCB(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_AnalyticsUserIDCB");
  return 0.0;
}
//-------------------------------------------------------------------------------------------------
//001F7528
extern "C" JNIEXPORT jdouble Java_com_firsttouchgames_ftt_FTTJNI_AnalyticsUserProgressCB(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_AnalyticsUserProgressCB Entry");
  double dret = 0.0;
  tFTTJNI_4B8550.tMutex_24.Lock();

  // if (CFTTAnalytics::ms_fpUserProgressCB) {
  //   dret = -1.0;
  //   double v2 = 0.0;
  //   if (CFTTAnalytics::ms_fpUserProgressCB(&v2))
  //     dret = v2;
  // } else {
  //   dret = 0.0;
  // }

  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_AnalyticsUserProgressCB End");
  return dret;
}
//-------------------------------------------------------------------------------------------------
//001F7580
extern "C" JNIEXPORT jdouble Java_com_firsttouchgames_ftt_FTTJNI_AnalyticsUserTypeCB(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_AnalyticsUserTypeCB Entry");
  double dret = 0.0;
  tFTTJNI_4B8550.tMutex_24.Lock();

  // if (CFTTAnalytics::ms_fpUserTypeCB) {
  //   dret = -1.0;
  //   double v2 = 0.0;
  //   if (CFTTAnalytics::ms_fpUserTypeCB(&v2))
  //     dret = v2;
  // } else {
  //   dret = 0.0;
  // }

  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_AnalyticsUserTypeCB End");
  return dret;
}
//-------------------------------------------------------------------------------------------------
//001F72F0
extern "C" JNIEXPORT jstring Java_com_firsttouchgames_ftt_FTTJNI_GetInstallSourceCampaign(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_GetInstallSourceCampaign Entry");
  jstring sret = nullptr;
  tFTTJNI_4B8550.tMutex_24.Lock();
  // const char *pST = CHeroAnalytics::InstallSourceCampaignCB();
  // if (pST && *pST) {
  //   sret = env->NewStringUTF(pST);
  // } else {
  //   sret = nullptr;
  // }
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_GetInstallSourceCampaign End");
  return sret;
}
//-------------------------------------------------------------------------------------------------
//001F72B4
extern "C" JNIEXPORT jstring Java_com_firsttouchgames_ftt_FTTJNI_GetInstallSourceTracker(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_GetInstallSourceTracker Entry");
  jstring sret = nullptr;
  tFTTJNI_4B8550.tMutex_24.Lock();
  // const char *pST = CHeroAnalytics::InstallSourceTrackerCB();
  // if (pST && *pST) {
  //   sret = env->NewStringUTF(pST);
  // } else {
  //   sret = nullptr;
  // }
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_GetInstallSourceTracker End");
  return sret;
}
//-------------------------------------------------------------------------------------------------
//001F732C
extern "C" JNIEXPORT jlong Java_com_firsttouchgames_ftt_FTTJNI_GetInstallTimestamp(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_GetInstallTimestamp");
  uint64 ts = 1000 * 4;
  //CHeroAnalytics::InstallTimestampCB(&ts);
  return ts;
}
//-------------------------------------------------------------------------------------------------
//001F71F0
extern "C" JNIEXPORT jint Java_com_firsttouchgames_ftt_FTTJNI_GetNotificationsSeconds(JNIEnv *env,
                                                                                      jobject obj,
                                                                                      jint paramjint1,
                                                                                      jint paramjint2) {
  LOGI("FTTJNI_GetNotificationsSeconds");
  return 0;
}
//-------------------------------------------------------------------------------------------------
//001F73AC
extern "C" JNIEXPORT jlong Java_com_firsttouchgames_ftt_FTTJNI_GetServerTimeMillseconds(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_GetServerTimeMillseconds Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  time_t t = CFTTServerTime::GetDateTime(true, false);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_GetServerTimeMillseconds End");
  return t * 1000;
}
//-------------------------------------------------------------------------------------------------
//001F7408
extern "C" JNIEXPORT jstring Java_com_firsttouchgames_ftt_FTTJNI_GetSessionID(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_GetSessionID Entry");
  jstring sret;
  tFTTJNI_4B8550.tMutex_24.Lock();
  char *pSid = CFTTAWSKinesisFirehose::GetSessionID();
  if (pSid && *pSid) {
    sret = env->NewStringUTF(pSid);
  } else {
    sret = nullptr;
  }
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_GetSessionID End");
  return sret;
}
//-------------------------------------------------------------------------------------------------
//001F71F4
extern "C" JNIEXPORT jboolean Java_com_firsttouchgames_ftt_FTTJNI_GetShouldSendNotification(JNIEnv *env, jobject obj, jint paramjint) {
  LOGI("FTTJNI_GetShouldSendNotification");
  return false;
}
//-------------------------------------------------------------------------------------------------
//001F724C
extern "C" JNIEXPORT jboolean Java_com_firsttouchgames_ftt_FTTJNI_HaveServerTimeForMatch(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_HaveServerTimeForMatch");
  return false;
}
//-------------------------------------------------------------------------------------------------
//001F7250
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_InstallSourceCB(JNIEnv *env,
                                                                              jobject obj,
                                                                              jstring paramjstring1,
                                                                              jstring paramjstring2) {
  LOGI("FTTJNI_InstallSourceCB Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  FTTInitialize(0, true, false);
  bool barg;
  MP_cMyProfile.DoLoadOnBoot(barg);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_InstallSourceCB End");
}
//-------------------------------------------------------------------------------------------------
//001F7198
extern "C" JNIEXPORT jboolean Java_com_firsttouchgames_ftt_FTTJNI_LoadProfile(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_LoadProfile Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_LoadProfile End");
  return false;
}
//-------------------------------------------------------------------------------------------------
//001F733C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_NativeDialogButton(JNIEnv *env, jobject obj, jint paramjint) {
  LOGI("FTTJNI_NativeDialogButton Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  switch (paramjint) {
    case 2:
      CFE::ContinueTermsOfServiceNativeDialog();
      break;
    case 1:
      CFE::OpenPrivacyPolicy();
      break;
    case 0:
      CFE::OpenTermsOfService();
      break;
  }
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_NativeDialogButton End");
}
//-------------------------------------------------------------------------------------------------
//001F7474
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_NotificationAppLaunchedCB(JNIEnv *env, jobject obj,
                                                                                        jstring paramjstring1,
                                                                                        jstring paramjstring2,
                                                                                        jstring paramjstring3) {
  LOGI("FTTJNI_NotificationAppLaunchedCB Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  const char *var_pst1 = nullptr;
  const char *var_pst2 = nullptr;
  const char *var_pst3 = nullptr;
  if (paramjstring1)
    var_pst1 = env->GetStringUTFChars(paramjstring1, nullptr);
  else
    var_pst1 = nullptr;

  if (paramjstring2)
    var_pst2 = env->GetStringUTFChars(paramjstring2, nullptr);
  else
    var_pst2 = nullptr;

  if (paramjstring3)
    var_pst3 = env->GetStringUTFChars(paramjstring3, nullptr);
  else
    var_pst3 = nullptr;

  //CHeroAnalytics::NotificationAppLaunched(var_pst1, var_pst2, var_pst3);

  if (var_pst1)
    env->ReleaseStringUTFChars(paramjstring1, var_pst1);

  if (var_pst2)
    env->ReleaseStringUTFChars(paramjstring2, var_pst2);

  if (var_pst3)
    env->ReleaseStringUTFChars(paramjstring3, var_pst3);

  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_NotificationAppLaunchedCB End");
}
//-------------------------------------------------------------------------------------------------
//001F7680
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SafeModeExitSafeMode(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_SafeModeExitSafeMode Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_SafeModeExitSafeMode End");
}
//-------------------------------------------------------------------------------------------------
//001F763C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SafeModeResetCustomData(JNIEnv *env, jobject obj) {
  //empty
  LOGI("FTTJNI_SafeModeResetCustomData");
}
//-------------------------------------------------------------------------------------------------
//001F763A
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SafeModeResetProfile(JNIEnv *env, jobject obj) {
  //empty
  LOGI("FTTJNI_SafeModeResetProfile");
}
//-------------------------------------------------------------------------------------------------
//001F7640
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SafeModeSetInSafeMode(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_SafeModeSetInSafeMode Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_SafeModeSetInSafeMode End");
}
//-------------------------------------------------------------------------------------------------
//001F7660
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SafeModeSetNotInSafeMode(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_SafeModeSetNotInSafeMode Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_SafeModeSetNotInSafeMode End");
}
//-------------------------------------------------------------------------------------------------
//001F6E50 //^_^
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SetScreen(JNIEnv *env,
                                                                        jobject obj,
                                                                        jint paramjint1,
                                                                        jint paramjint2) {
  LOGI("FTTJNI_SetScreen Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  FTTGraphicsAndroid_SetScreen(paramjint1, paramjint2);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_SetScreen End");
}
//-------------------------------------------------------------------------------------------------
//001F6E7C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SetScreenSize(JNIEnv *env, jobject obj, jfloat paramjfloat) {
  LOGI("FTTJNI_SetScreenSize Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  FTTGraphicsAndroid_SetScreenSize(paramjfloat);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_SetScreenSize End");
}
//-------------------------------------------------------------------------------------------------
//001F73DC
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_SetSessionID(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_SetSessionID Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  time_t v0 = CFTTServerTime::GetDateTime(true, false);
  CFTTAWSKinesisFirehose::SetSessionID(v0);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_SetSessionID End");
}
//-------------------------------------------------------------------------------------------------
//001F7378
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_ShowDownloadMessageBox(JNIEnv *env, jobject obj) {
  //empty
  LOGI("FTTJNI_ShowDownloadMessageBox");
}
//-------------------------------------------------------------------------------------------------
//001F702C //^_^
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_appBecomeActive(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_appBecomeActive Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  LOGI("FTTJNI_appBecomeActive Lock End");
  CFTTAndroidAppCInterface::m_bAppInForeground = true;
  if (CFTTAndroidAppCInterface::m_BecomeActive != nullptr) {
    LOGI("FTTJNI_appBecomeActive m_BecomeActive");
    CFTTAndroidAppCInterface::m_BecomeActive(nullptr);
    LOGI("FTTJNI_appBecomeActive m_BecomeActive End");
  }

  LOGI("FTTJNI_appBecomeActive MP_cMyProfile.NeedToCheckNotifications");
  MP_cMyProfile.NeedToCheckNotifications();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_appBecomeActive End");
}
//-------------------------------------------------------------------------------------------------
//001F7078
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_appDestroyed(JNIEnv *env, jobject obj) {
  if (bSoccerInit_4B8540) {
    LOGI("FTTJNI_appDestroyed Entry");
    tFTTJNI_4B8550.tMutex_24.Lock();
    if (CFTTAndroidAppCInterface::m_WillTerminate)
      CFTTAndroidAppCInterface::m_WillTerminate(nullptr);
    tFTTJNI_4B8550.tMutex_24.Unlock();
    LOGI("FTTJNI_appDestroyed End");
  }
}
//-------------------------------------------------------------------------------------------------
//001F6F5C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_appPaused(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_appPaused Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  CFTTAndroidAppCInterface::m_bAppInForeground = false;
  if (CFTTAndroidAppCInterface::m_DidEnterBackground)
    CFTTAndroidAppCInterface::m_DidEnterBackground(nullptr);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_appPaused End");
}
//-------------------------------------------------------------------------------------------------
//001F6FEC
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_appResignActive(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_appResignActive Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  CFTTAndroidAppCInterface::m_bAppHasFocus = false;
  if (CFTTAndroidAppCInterface::m_ResignActive != nullptr) {
    LOGI("FTTJNI_appResignActive CFTTAndroidAppCInterface::m_ResignActive");
    CFTTAndroidAppCInterface::m_ResignActive(nullptr);
    LOGI("FTTJNI_appResignActive CFTTAndroidAppCInterface::m_ResignActive End");
  }
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_appResignActive End");
}
//-------------------------------------------------------------------------------------------------
//001F6F9C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_appResumed(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_appResumed Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  CFTTAndroidAppCInterface::m_bAppInForeground = 1;
  if (CFTTAndroidAppCInterface::m_WillEnterForeground)
    CFTTAndroidAppCInterface::m_WillEnterForeground(nullptr);
  MP_cMyProfile.NeedToCheckNotifications();
  CFE::CheckTimeMinimised();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_appResumed End");
}
//-------------------------------------------------------------------------------------------------
//001F6B94
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_areConnectedToFacebook(JNIEnv *env, jobject obj, jstring paramjstring) {
  //忽略
  LOGI("FTTJNI_areConnectedToFacebook");
}
//-------------------------------------------------------------------------------------------------
//001F6B48
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_areConnectedToGoogle(JNIEnv *env, jobject obj, jboolean paramjboolean) {
  //忽略
  LOGI("FTTJNI_areConnectedToGoogle");
}
//-------------------------------------------------------------------------------------------------
//001F6EEC
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_backButtonPressed(JNIEnv *env, jobject obj) {
  FE_bBackButtonPressed = true;
  LOGI("FTTJNI_backButtonPressed");
}
//-------------------------------------------------------------------------------------------------
//001F7220
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_cacheRewardedVideoFailed(JNIEnv *env, jobject obj, jint paramjint) {
  //忽略
  LOGI("FTTJNI_cacheRewardedVideoFailed");
}
//-------------------------------------------------------------------------------------------------
//001F6C28
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_facebookPostSucceeded(JNIEnv *env, jobject obj) {
  //忽略
  LOGI("FTTJNI_facebookPostSucceeded");
}
//-------------------------------------------------------------------------------------------------
//001F6C24
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_failedToConnectToFacebook(JNIEnv *env, jobject obj, jstring paramjstring, jint paramjint) {
  //忽略
  LOGI("FTTJNI_failedToConnectToFacebook");
}
//-------------------------------------------------------------------------------------------------
//001F6C78
extern "C" JNIEXPORT jboolean Java_com_firsttouchgames_ftt_FTTJNI_getAreConnectedToFacebook(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_getAreConnectedToFacebook");
  jboolean bret = false;
  //tFTTJNI_4B8550.tMutex_24.Lock();
  //int dret = facebook_connect_47AEBC;
  //tFTTJNI_4B8550.tMutex_24.Unlock();
  return bret;
}
//-------------------------------------------------------------------------------------------------
//001F6C48
extern "C" JNIEXPORT jboolean Java_com_firsttouchgames_ftt_FTTJNI_getAreConnectedToGoogle(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_getAreConnectedToGoogle");
  jboolean bret = false;
  // tFTTJNI_4B8550.tMutex_24.Lock();
  // int dret = dword_47B0C8;
  // tFTTJNI_4B8550.tMutex_24.Unlock();
  return bret;
}
//-------------------------------------------------------------------------------------------------
//001F6D1C AssetManager
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_getAssetManager(JNIEnv *env, jobject obj, jobject paramAssetManager) {
  LOGI("FTTJNI_getAssetManager Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  CFTTFileSystem_Android::AndroidSetAssetManager(AAssetManager_fromJava(env, paramAssetManager));
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_getAssetManager End");
}
//-------------------------------------------------------------------------------------------------
//001F71F8
extern "C" JNIEXPORT jint Java_com_firsttouchgames_ftt_FTTJNI_getEnergySeconds(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_getEnergySeconds Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  int dret = CStoryProfile::SecondsToFullEnergy(1, 2);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_getEnergySeconds End");
  return dret;
}
//-------------------------------------------------------------------------------------------------
//001F6BFC
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_getFriendsComplete(JNIEnv *env, jobject obj, jint paramjint) {
  //CFTTAndroidFacebook
  //跳过此函数
  LOGI("FTTJNI_getFriendsComplete");
}
//-------------------------------------------------------------------------------------------------
//001F6AC8
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_getJNIEnv(JNIEnv *env, jobject obj, jobject paramContext) {
  LOGI("FTTJNI_getJNIEnv Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  jobject globalClass = env->NewGlobalRef(paramContext);

  AndroidApp_SetupJNI(env, globalClass);
  AndroidApp_RegisterPackageName("com/firsttouchgames/story/");
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_getJNIEnv End");
}
//-------------------------------------------------------------------------------------------------
//001F6CA8
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_googleNeedsStoragePermission(JNIEnv *env, jobject obj, jint paramjint) {
  //忽略
  LOGI("FTTJNI_googleNeedsStoragePermission");
}
//-------------------------------------------------------------------------------------------------
//001F6CD0
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_haveLoadedGoogleSavedGame(JNIEnv *env, jobject obj, jboolean paramjboolean, jstring paramjstring) {
  //忽略
  LOGI("FTTJNI_haveLoadedGoogleSavedGame");
}
//-------------------------------------------------------------------------------------------------
//001F6CCC
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_haveReceivedFacebookFriendScores(JNIEnv *env, jobject obj, jint paramjint) {
  //忽略
  LOGI("FTTJNI_haveReceivedFacebookFriendScores");
}
//-------------------------------------------------------------------------------------------------
//001F70B8
extern "C" JNIEXPORT jboolean Java_com_firsttouchgames_ftt_FTTJNI_initializeVulkanEarly(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_initializeVulkanEarly Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  FTTGraphicsEnableStencilBuffer(true);
  bool bret = FTTGraphicsAndroid_InitializeVulkanEarly();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_initializeVulkanEarly End");
  return bret;
}
//-------------------------------------------------------------------------------------------------
//001F6EFC
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_onCreate(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_onCreate Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  if (CFTTAndroidAppCInterface::m_OnCreate)
    CFTTAndroidAppCInterface::m_OnCreate(nullptr);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_onCreate End");
}
//-------------------------------------------------------------------------------------------------
//001F6F2C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_onStart(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_onStart Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  if (CFTTAndroidAppCInterface::m_OnStart)
    CFTTAndroidAppCInterface::m_OnStart(nullptr);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_onStart End");
}
//-------------------------------------------------------------------------------------------------
//001F70E4
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_onVulkanSurfaceAcquired(JNIEnv *env, jobject obj, jobject paramSurface) {
  LOGI("FTTJNI_onVulkanSurfaceAcquired Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  FTTGraphicsAndroid_OnVulkanSurfaceAcquired(ANativeWindow_fromSurface(env, paramSurface));
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_onVulkanSurfaceAcquired End");
}
//-------------------------------------------------------------------------------------------------
//001F7114
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_onVulkanSurfaceLost(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_onVulkanSurfaceLost Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  FTTGraphicsAndroid_OnVulkanSurfaceLost();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_onVulkanSurfaceLost End");
}
//-------------------------------------------------------------------------------------------------
//001F7138
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_rewardUser(JNIEnv *env, jobject obj, jint paramjint1, jint paramjint2, jboolean paramjboolean, jstring paramjstring) {
  LOGI("FTTJNI_rewardUser Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  //忽略激励视频相关功能
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_rewardUser End");
}
//-------------------------------------------------------------------------------------------------
//001F6B08
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_setDeviceModel(JNIEnv *env, jobject obj, jstring paramjstring) {
  LOGI("FTTJNI_setDeviceModel Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  const char *pdir = env->GetStringUTFChars(paramjstring, nullptr);
  env->ReleaseStringUTFChars(paramjstring, pdir);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_setDeviceModel End");
}
//-------------------------------------------------------------------------------------------------
//001F6DB0
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_setExpansionPath(JNIEnv *env, jobject obj, jstring paramjstring) {
  LOGI("FTTJNI_setExpansionPath Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  const char *pdir = env->GetStringUTFChars(paramjstring, nullptr);
  CFTTFileSystem_Android::AndroidSetExpansionPath(pdir);
  env->ReleaseStringUTFChars(paramjstring, pdir);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_setExpansionPath End");
}
//-------------------------------------------------------------------------------------------------
//001F6DF4
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_setExpansionProgress(JNIEnv *env, jobject obj, jint paramjint) {
  LOGI("FTTJNI_setExpansionProgress Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  dword_34891C = paramjint;
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_setExpansionProgress End");
}
//-------------------------------------------------------------------------------------------------
//001F6E20
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_setExpansionRequired(JNIEnv *env, jobject obj, jboolean paramjboolean) {
  LOGI("FTTJNI_setExpansionRequired Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  bool_348918 = paramjboolean ? true : false;
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_setExpansionRequired End");
}
//-------------------------------------------------------------------------------------------------
//001F6D6C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_setExternalFilesDir(JNIEnv *env, jobject obj, jstring paramjstring) {
  LOGI("FTTJNI_setExternalFilesDir Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  const char *pdir = env->GetStringUTFChars(paramjstring, nullptr);
  CFTTFileSystem_Android::AndroidSetExternalFilesDir(pdir);
  env->ReleaseStringUTFChars(paramjstring, pdir);
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_setExternalFilesDir End");
}
//-------------------------------------------------------------------------------------------------
//001F6D4C
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_setIsAmazon(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_setIsAmazon Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_setIsAmazon End");
}
//-------------------------------------------------------------------------------------------------
//001F6AA4
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_setupCallbacks(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_setupCallbacks Entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  AppSetupCallbacks();
  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_setupCallbacks End");
}
//-------------------------------------------------------------------------------------------------
//001F6A38 //^_^
void SetUp_IAP_JNI() {
  IAP_Init(
      "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj6MCBls+rJWOxN+3/PKoPE7WLl8Kx4Wq1WDU7qR/GM94WwK65psYkalpBcwtc2Evn"
      "fs1HZstkAr0XM9J/+8T6nW1z3R/ZLz0mh7nexZXaPKgbgoUWDfWILSKF9pZTDcG2Hp4iXYEG0rLJmfB7D7W//BPP5+mcJmjXhWV68BGRs9XjP"
      "+x0iiHOsaTXBhB6E9cDRfva/6W0IidUPM8t1YRhp2wjyDXC+nYW9M0i/Tm7m5bAMglgiySOyYvGWmfnQvyjb1WV/sDmvxubvRhq7XOB5rog/0"
      "hiYx3dojaIwQyZ9poPkaRsWnw5g1KZp6oIk/dVapLeT6PMhjJ8OnQQTm4mQIDAQAB",
      64);
}
//-------------------------------------------------------------------------------------------------
//001F6A60 //^_^
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_step(JNIEnv *env, jobject obj) {
  LOGI("FTTJNI_step entry");
  tFTTJNI_4B8550.tMutex_24.Lock();
  if (bSoccerInit_4B8540) {
    LOGI("FTTJNI_step bSoccerInit_4B8540 = true");
    IAP_Update();
    Soccer_MainLoop();
  } else {
    LOGI("FTTJNI_step bSoccerInit_4B8540 = false");
    AppStart();

    LOGI("FTTJNI_step SetUp_IAP_JNI");
    SetUp_IAP_JNI();

    bSoccerInit_4B8540 = true;

    LOGI("FTTJNI_step call Soccer_Init");
    Soccer_Init();
    LOGI("FTTJNI_step call Soccer_Init end");
  }

  tFTTJNI_4B8550.tMutex_24.Unlock();
  LOGI("FTTJNI_step exit");
}
//-------------------------------------------------------------------------------------------------
//001F6EB0
extern "C" JNIEXPORT void Java_com_firsttouchgames_ftt_FTTJNI_worldOriUpdated(JNIEnv *env,
                                                                              jobject obj,
                                                                              jfloat arg_float1,
                                                                              jfloat arg_float2,
                                                                              jfloat arg_float3,
                                                                              jfloat arg_float4,
                                                                              jfloat arg_float5,
                                                                              jfloat arg_float6,
                                                                              jfloat arg_float7,
                                                                              jfloat arg_float8,
                                                                              jfloat arg_float9) {
  LOGI("FTTJNI_worldOriUpdated");
  FTTInput_worldOriUpdatedAndroid(arg_float1,
                                  arg_float2,
                                  arg_float3,
                                  arg_float4,
                                  arg_float5,
                                  arg_float6,
                                  arg_float7,
                                  arg_float8,
                                  arg_float9);
}
//-------------------------------------------------------------------------------------------------