この記事はニンテンドーDS向けエミュレータの一つである「DeSmuME」(以降Desmume)のLua用APIの非公式日本語リファレンスです。今回はmovieライブラリについてのリファレンスです。
このリファレンスは非公式の日本語リファレンスです。そもそも英語のリファレンスも公式のリファレンスもありません。
さらに詳細の仕様を確認したい場合はDesmumeのソースコードを参照することを推奨します。
→https://github.com/TASEmulators/desmume/blob/master/desmume/src/lua-engine.cpp
movie.active()
ムービーモードが有効化否かをブール値で返します。
引数
無し nil
戻り値
boolean
型
True or Falseで戻ってきます。
True = 有効 TASing
False = 無効
function fn()
local m
m = movie.active()
if m then
gui.text(0,10,string.format("Active"))
else
gui.text(0,10,string.format("Inactive"))
end
end
gui.register(fn)
movie.isrecording()
ムービーを追記中かをブール値で返します。
引数
無し nil
戻り値
boolean
型
True or Falseで戻ってきます。
True = Recording Read+Write
False = Playing Read-Only
function fn()
local m
m = movie.recording()
if m then
gui.text(0,10,string.format("Recording"))
else
gui.text(0,10,string.format("Playing"))
end
end
gui.register(fn)
movie.playing()
ムービーを再生中かブール値で返します。
引数
戻り値
function fn()
local m
m = movie.playing()
if m then
gui.text(0,10,string.format("Playing"))
else
gui.text(0,10,string.format("Recording"))
end
end
gui.register(fn)
movie.mode()
現在のムービーモードを取得する
引数
無し nil
戻り値
文字列
playback
ムービー再生中
record
ムービー追記中
inactive
ムービーを読み込んでいない
finished
ムービー再生終了
function fn()
local m
m = movie.mode()
gui.text(0,10,""..m)
end
gui.register(fn)
movie.length()
ムービーの長さを取得する
引数
無し nil
戻り値
整数
ムービーのフレーム数が戻ってきます
function fn()
local m
m = movie.length()
gui.text(0,10,""..m)
end
gui.register(fn)
movie.name()
ムービーファイルの名前をパスごと取得します。
引数
無し nil
戻り値
文字列 ムービーファイルの名前をパスごと取得します。
例:C:TASmovie/Any.dsm
function fn()
local m
m = movie.name()
gui.text(0,10,""..m)
end
gui.register(fn)
movie.rerecordcount()
ムービーの追記回数を取得します。
引数
無し nil
戻り値
整数
function fn()
local m
m = movie.rerecordcount()
gui.text(0,10,""..m)
end
gui.register(fn)
movie.setrerecordcount()
追記回数をセットします。
引数
数値
ソースコードを見るに引数が定義されていないのですが、数値を受け取ることを前提として関数が処理されているように見えます
戻り値
無し nil
function fn()
local m
movie.setrerecordcount(10)
m = movie.rerecordcount()
gui.text(0,10,""..m)
end
gui.register(fn)
movie.rerecordcounting()
Luaスクリプトでの追記を追記回数に含めるかどうかを設定します。
引数
boolean
型
True or False
デフォルト: False
True:Luaスクリプトによる追記は追記回数に含めない
False:Luaスクリプトによる追記は追記回数に含める
戻り値
無し nil
function fn()
movie.rerecordcounting(true)
end
gui.register(fn)
movie.readonly()
ムービーが追記不可かどうかをブール値で返します。
引数
無し nil
戻り値
boolean
型
True or False
True:Read-Onlyモード
False:Read&Writeモード
function fn()
local m
m = movie.readonly()
if m then
gui.text(0,10,string.format("Read-Only"))
else
gui.text(0,10,string.format("Read+Write"))
end
end
gui.register(fn)
movie.setreadonly()
ムービーの読み取りモードを設定する
引数
boolean
型
True or False
True:Read-Onlyモード
False:Read&Writeモード
戻り値
無し nil
function fn()
movie.setreadonly(true)
end
gui.register(fn)
movie.framecount()
ムービーファイルの現状フレームカウントを取得する
引数
無し nil
戻り値
範囲:int
型
-2,147,483,648~2,147,483,647の0を含む整数が戻ってきます。
function fn()
local m
m = movie.framecount()
gui.text(0,10,""..m)
end
gui.register(fn)
emu.framecount()
の代替名用として用意されています。
movie.play()
任意のムービーファイルを読み込み再生する
引数
string
型
絶対パスもしくは相対パスを入力
C言語の性質上\は重ねる必要があります。重ねなかった場合はdesmumeがクラッシュします
戻り値
無し nil
movie.play("C:\\TASmovie\\test.dsm")
movie.replay()
開いているムービーファイルを最初から再生する
引数
無し nil
戻り値
無し nil
movie.replay()
movie.close()
開いているムービーファイルを閉じる
引数
無し nil
戻り値
無し nil
movie.close()
代替名一覧
以下の関数でコードを書いても右側の関数として認識されます。
movie.open()
→movie.play()
movie.close()
→movie.close()
movie.getname()
→movie.name()
movie.playback()
→movie.play()
movie.getreadonly()
→movie.readonly()