LoginSignup
0
0
この記事誰得? 私しか得しないニッチな技術で記事投稿!
Qiita Engineer Festa20242024年7月17日まで開催中!

DeSmuMEで組み込まれているLua用API 非公式リファレンス ~movieライブラリ~

Posted at

この記事はニンテンドー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 = 無効 

example.lua
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

example.lua
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()
ムービーを再生中かブール値で返します。

引数
戻り値
example.lua
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 ムービー再生終了

example.lua
function fn()
local m

m = movie.mode()

gui.text(0,10,""..m)

end
gui.register(fn)

movie.length()
ムービーの長さを取得する

引数

無し nil

戻り値

整数
ムービーのフレーム数が戻ってきます

example.lua
function fn()
local m

m = movie.length()

gui.text(0,10,""..m)

end
gui.register(fn)

movie.name()
ムービーファイルの名前をパスごと取得します。

引数

無し nil

戻り値

文字列 ムービーファイルの名前をパスごと取得します。

例:C:TASmovie/Any.dsm

example.lua
function fn()
local m

m = movie.name()

gui.text(0,10,""..m)

end
gui.register(fn)

movie.rerecordcount()
ムービーの追記回数を取得します。

引数

無し nil

戻り値

整数

example.lua
function fn()
local m

m = movie.rerecordcount()

gui.text(0,10,""..m)

end
gui.register(fn)

movie.setrerecordcount()
追記回数をセットします。

引数

数値

ソースコードを見るに引数が定義されていないのですが、数値を受け取ることを前提として関数が処理されているように見えます

戻り値

無し nil

example.lua
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

example.lua
function fn()

movie.rerecordcounting(true)

end
gui.register(fn)

movie.readonly()
ムービーが追記不可かどうかをブール値で返します。

引数

無し nil

戻り値

boolean
True or False

True:Read-Onlyモード
False:Read&Writeモード

example.lua
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

example.lua
function fn()

movie.setreadonly(true)

end
gui.register(fn)

movie.framecount()
ムービーファイルの現状フレームカウントを取得する

引数

無し nil

戻り値

範囲:int
-2,147,483,648~2,147,483,647の0を含む整数が戻ってきます。

example.lua
function fn()
local m

m = movie.framecount()

gui.text(0,10,""..m)

end
gui.register(fn)

emu.framecount()の代替名用として用意されています。


movie.play()
任意のムービーファイルを読み込み再生する

引数

string
絶対パスもしくは相対パスを入力

C言語の性質上\は重ねる必要があります。重ねなかった場合はdesmumeがクラッシュします

戻り値

無し nil

example.lua
movie.play("C:\\TASmovie\\test.dsm")

movie.replay()
開いているムービーファイルを最初から再生する

引数

無し nil

戻り値

無し nil

example.lua
movie.replay()

movie.close()
開いているムービーファイルを閉じる

引数

無し nil

戻り値

無し nil

example.lua
movie.close()

代替名一覧
以下の関数でコードを書いても右側の関数として認識されます。
movie.open()movie.play()
movie.close()movie.close()
movie.getname()movie.name()
movie.playback()movie.play()
movie.getreadonly()movie.readonly()

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0