コンテンツにスキップ

高度な機能の使い方

Androidの設定

Herculesの追加機能を使用するには、Android Gradleモジュールでprefab機能が有効になっている必要があります。

Android Studioプロジェクトの設定

  • Android Gradle Plugin 4.1未満使用時

    • gradle.propertiesファイルに以下のように追加します。

      android.enablePrefab=true
      
  • Android Gradle プラグイン 4.1 以上を使用する場合

    • build.gradle ファイルにある android ブロックに以下のように追加します。

      android {
          ...
          buildFeatures {
                  prefab true
          }
      }
      
  • モジュールレベルの build.gradle ファイルに、dependencies セクションに以下のライブラリを追加します:

    dependencies {
        implementation "com.com2us.android.hive:hive-hercules"
        implementation "com.com2us.android.gamesec:hercules:20250527" // Herculesの追加機能を使用するため
    

CMake / ndk-build 設定 (C/C++ 使用のため)

  • NDK r21 以上を使用する場合

    // CMakeを使用する場合
    find_package(Hercules REQUIRED CONFIG)  
    
    target_link_libraries(
        ...
        Hercules::Hercules
    )
    
    // Android.mkを使用する場合
    LOCAL_SHARED_LIBRARIES := Hercules
    
    include $(BUILD_SHARED_LIBRARY)
    
    ifneq ($(call ndk-major-at-least,21),true)
        $(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
    endif
    $(call import-module, prefab/Hercules)
    
  • NDK r21以下を使用する場合

    • Hercules.hファイルをプロジェクトに別途追加し、.soファイルのパスを指定して直接リンクします。

      // CMakeを使用する場合
      target_link_libraries(
          ...
          ${CMAKE_CURRENT_SOURCE_DIR}/../build/intermediates/merged_native_libs/${CMAKE_BUILD_TYPE}/out/lib/${ANDROID_ABI}/libHercules.so
      )
      
      // Android.mkを使用する場合
      include $(CLEAR_VARS)
      LOCAL_MODULE := Hercules
      LOCAL_SRC_FILES := ../build/intermediates/merged_native_libs/release/out/lib/$(TARGET_ARCH_ABI)/libHercules.so
      include $(PREBUILT_SHARED_LIBRARY)
      LOCAL_SHARED_LIBRARIES := Hercules
      

iOSの設定

設定方法

  • CocoaPodsを通じてプロジェクトにインストールされたHerculesフレームワークのパス以下で.hを見つけてプロジェクトにimportします。
    シミュレーターまたはデバイスターゲットパスに含まれているヘッダーの中から何でも選んで使用しても問題ありません。
    パスは次の通りです。
    `${PROJECT_ROOT_DIR}/Pods/Hercules/Hive_SDK_iOS_External_${HIVE_SDK_VERSION}/Hercules.xcframework/${SIMULATOR_OR_PHONEOS}/Hercules.framework/Headers/Hercules.h`
    

Unityを設定する

プロジェクト設定を行う

  • Add USE_HERCULES to Unity's preprocessor flags.

    • Player Settings → Other Settings → Script Compilation → Scripting Define Symbols

  • Checks to allow 'unsafe' code.

    • Player Settings → Other Settings → Script Compilation → Allow 'unsafe' code

Unrealの設定

Hive SDK Unreal Pluginが含むヘラクレスモジュールはヘラクレスの追加機能をサポートしていません。
Unreal環境でヘラクレスの追加機能を使用するには、以下を参照してください。