Skip to content

Legacy Manual Script (Android 4.4.4 to 10.x / PyDroid 3)

This is a legacy, manual method utilizing a Python script run via the PyDroid 3 application to patch the metadata on the fly.

Important

  • This is an older, fallback method. Please try Method 2 (KRFN-launcher) first.
  • Only use this method if the launcher does not work on your device.
  • This method does not work on emulators. For emulators, please refer to the dedicated emulator guide.

Prerequisites

  • A physical Android device running Android 4.4.4 up to 10.x.
  • PyDroid 3: Python 3 IDE for Android (Available on Google Play Store).
  • Game Client APK: Version 3.6.0.
    • Note: Version 3.7.0 is not supported; you must use version 3.6.0.

Setup Steps

  1. Install Applications: Download and install both PyDroid 3 and the Game Client (v3.6.0) on your device.

Warning

The script below contains placeholder values for the target hostnames and binary offsets. You must replace these placeholder values (b"YOUR_ALT_HOST", 0x00000, etc.) with the actual values. For details on how to obtain these values, please refer to endpoints.md.

  1. Copy and Run Script: Open the PyDroid 3 application, copy the Python script below, paste it into the editor, and run the script:
# Kivyモジュールをロード(この行は削除しないでください)
#import kivy
from jnius import autoclass
import time

Package = "com.aniplex.kirarafantasia"
Class = "com.google.firebase.MessagingUnityPlayerActivity"
path = f"/sdcard/Android/data/{Package}/files/il2cpp/Metadata/global-metadata.dat"

RUN_TIMEOUT = 30
METADATA_DELETE_TIMEOUT = 15

start_time = time.time()
meta_deleted_time = None

def main():
    global meta_deleted_time
    # アプリを起動する
    open_app(Package, Class)
    while True:
        try:
            # メタデータファイルをバイナリモードで開き、アドレスを直接書き換える
            with open(path, "rb+", buffering=0) as fs:
                # APIサーバーのアドレス書き換え
                # 元: krr-prd.star-api.com
                # 先: [Refer to endpoints.md]
                overwrite(
                    fs,
                    b"krr-prd.star",
                    b"YOUR_ALT_HOST", # ユーザーコミュニティで取得した値を設定してください / Set the value obtained from the community
                    0x00000 # ユーザーコミュニティで取得したオフセットを設定してください / Set the offset obtained from the community
                )
                # アセットサーバーのアドレス書き換え
                # 元: asset-krr-prd.star-api.com/{0}
                # 先: [Refer to endpoints.md]
                overwrite(
                    fs,
                    b"krr-prd.star-api.com/{0}",
                    b"YOUR_ASSET_HOST", # ユーザーコミュニティで取得した値を設定してください / Set the value obtained from the community
                    0x00000 # ユーザーコミュニティで取得したオフセットを設定してください / Set the offset obtained from the community
                )
        except FileNotFoundError:
            if meta_deleted_time is None:
                meta_deleted_time = time.time()
        if check_timeout():
            return

def check_timeout():
    now = time.time()
    if now - start_time >= RUN_TIMEOUT:
        return True
    if meta_deleted_time is not None:
        if now - meta_deleted_time >= METADATA_DELETE_TIMEOUT:
            return True
    return False

def overwrite(fs, from_bin, to_bin, addr):
    bin_len = len(to_bin)

    fs.seek(addr)
    bin = fs.read(bin_len)
    if len(bin) < bin_len:
        return
    if bin != to_bin:
        if bin == from_bin:
            fs.seek(addr)
            fs.write(to_bin)
        else:
            e = "エラー: アプリのバージョンが正しくない可能性があります"
            print(e)
            raise Exception(e)

def open_app(Package, Class):
    Intent = autoclass("android.content.Intent")
    intent = Intent()

    intent.setAction(Intent.ACTION_MAIN)
    intent.addCategory(Intent.CATEGORY_LAUNCHER)
    intent.setClassName(Package, Class)
    kiv = autoclass("org.kivy.android.PythonActivity").mActivity
    kiv.startActivity(intent)

main()
end = "プログラムが終了しました"
print(end)
print("\n" * 20)
# このダミーのエラーは無視して大丈夫です
e = "このエラーは無視してください"
print(e)
raise Exception(e)
  1. Launch and Connect: Once the script is executed, the KRFN app will automatically launch.
    • Note: Depending on your network/region, downloading or loading assets might take some time as asset servers can be slow.

Troubleshooting

  • Why does the script crash at the end with an error? The script raises a dummy exception (raise Exception("Ignore this error")) to gracefully stop execution within PyDroid 3's terminal runtime after launching the app. You can safely ignore this error.
  • Connection fails: Ensure you are using the correct client version (3.6.0) and that you granted PyDroid 3 the necessary storage access permissions.