rebf-gaiden/Scripts/_.59.rb
2025-04-26 17:06:34 -05:00

47 lines
No EOL
2.2 KiB
Ruby

#==============================================================================
# ■ RGSS3 暗号化作品テストモード禁止 Ver1.00 by 星潟
#------------------------------------------------------------------------------
# 暗号化ファイルが作成されている状態でも特定の手順を踏む事で
# テストモードでゲームプレイを行える問題を解決します。
# エディタ上でのテストモードには影響ありません。
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● フレーム更新(基本)
#--------------------------------------------------------------------------
alias update_basic_exit update_basic
def update_basic
SceneManager.illegal_test_mode_prevent
update_basic_exit
end
end
class << SceneManager
attr_reader :protect_flag
#--------------------------------------------------------------------------
# ● 実行
#--------------------------------------------------------------------------
alias :run_exit :run
def run
protect_execute
run_exit
end
#--------------------------------------------------------------------------
# ● 暗号化ファイルの有無を確認し、保護の有無を設定する
#--------------------------------------------------------------------------
def protect_execute
@protect_flag = !Dir.glob('Game.rgss3a').empty?
end
#--------------------------------------------------------------------------
# ● 不正テストモードの場合、ゲームを強制終了させる
#--------------------------------------------------------------------------
def illegal_test_mode_prevent
exit if illegal_test?
end
#--------------------------------------------------------------------------
# ● 不正テストモード判定
#--------------------------------------------------------------------------
def illegal_test?
#保護が有効で、なおかつテストモードの場合は不正テストモードと判定
protect_flag == true && ($TEST or $DEBUG)
end
end