Fixed disc search/skip/step behavior to match Singe 1.18.
This commit is contained in:
parent
27c897e8e1
commit
94071d5ec1
1 changed files with 38 additions and 68 deletions
|
@ -512,34 +512,8 @@ int apiDiscPause(lua_State *L) {
|
|||
|
||||
|
||||
int apiDiscPauseAtFrame(lua_State *L) {
|
||||
int n = lua_gettop(L);
|
||||
int frame = 0;
|
||||
bool result = false;
|
||||
double d = 0;
|
||||
|
||||
//***TODO*** WTF is this? Isn't this just DiskSearch?
|
||||
|
||||
if (!_discStopped) {
|
||||
if (n == 1) {
|
||||
if (lua_isnumber(L, 1)) {
|
||||
d = lua_tonumber(L, 1); frame = (int)d;
|
||||
videoSeek(_videoHandle, frame);
|
||||
videoPause(_videoHandle);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
luaTrace(L, "discPauseAtFrame", "Failed! Disc is stopped.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
luaTrace(L, "discPauseAtFrame", "%d", frame);
|
||||
} else {
|
||||
luaTrace(L, "discPauseAtFrame", "Failed!");
|
||||
}
|
||||
|
||||
return 0;
|
||||
// More RDG oddness. This appears to be identical to discSearch.
|
||||
return apiDiscSearch(L);
|
||||
}
|
||||
|
||||
|
||||
|
@ -558,19 +532,17 @@ int apiDiscSearch(lua_State *L) {
|
|||
bool result = false;
|
||||
double d = 0;
|
||||
|
||||
if (!_discStopped) {
|
||||
// No matter the disc state, seek to the frame, display it, and pause.
|
||||
|
||||
if (n == 1) {
|
||||
if (lua_isnumber(L, 1)) {
|
||||
d = lua_tonumber(L, 1); frame = (int)d;
|
||||
videoSeek(_videoHandle, frame);
|
||||
videoPause(_videoHandle);
|
||||
_discStopped = false;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
luaTrace(L, "discSearch", "Failed! Disc is stopped.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
luaTrace(L, "discSearch", "%d", frame);
|
||||
|
@ -604,12 +576,13 @@ int apiDiscSkipBackward(lua_State *L) {
|
|||
bool result = false;
|
||||
double d = 0;
|
||||
|
||||
// If disc is not stopped, seek backwards to given frame. Do not change play/pause state.
|
||||
|
||||
if (!_discStopped) {
|
||||
if (n == 1) {
|
||||
if (lua_isnumber(L, 1)) {
|
||||
d = lua_tonumber(L, 1); frame = videoGetFrame(_videoHandle) - (int)d;
|
||||
videoSeek(_videoHandle, frame);
|
||||
videoPlay(_videoHandle);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -642,12 +615,13 @@ int apiDiscSkipForward(lua_State *L) {
|
|||
bool result = false;
|
||||
double d = 0;
|
||||
|
||||
// If disc is not stopped, seek ahead to given frame. Do not change play/pause state.
|
||||
|
||||
if (!_discStopped) {
|
||||
if (n == 1) {
|
||||
if (lua_isnumber(L, 1)) {
|
||||
d = lua_tonumber(L, 1); frame = videoGetFrame(_videoHandle) + (int)d;
|
||||
videoSeek(_videoHandle, frame);
|
||||
videoPlay(_videoHandle);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -672,19 +646,17 @@ int apiDiscSkipToFrame(lua_State *L) {
|
|||
bool result = false;
|
||||
double d = 0;
|
||||
|
||||
if (!_discStopped) {
|
||||
// No matter disc state, seek to given frame and play.
|
||||
|
||||
if (n == 1) {
|
||||
if (lua_isnumber(L, 1)) {
|
||||
d = lua_tonumber(L, 1); frame = (int)d;
|
||||
videoSeek(_videoHandle, frame);
|
||||
videoPlay(_videoHandle);
|
||||
_discStopped = false;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
luaTrace(L, "discSkipToFrame", "Failed! Disc is stopped.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
luaTrace(L, "discSkipToFrame", "%d", frame);
|
||||
|
@ -699,14 +671,13 @@ int apiDiscStepBackward(lua_State *L) {
|
|||
|
||||
(void)L;
|
||||
|
||||
if (!_discStopped) {
|
||||
// No matter disc state, go back a frame. If playing, pause.
|
||||
|
||||
frame = videoGetFrame(_videoHandle) - 1;
|
||||
videoSeek(_videoHandle, frame);
|
||||
videoPause(_videoHandle);
|
||||
luaTrace(L, "discStepBackward", "%d", frame);
|
||||
} else {
|
||||
luaTrace(L, "discStepBackward", "Failed! Disc is stopped.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -716,14 +687,13 @@ int apiDiscStepForward(lua_State *L) {
|
|||
|
||||
(void)L;
|
||||
|
||||
if (!_discStopped) {
|
||||
// No matter disc state, go forward a frame. If playing, pause.
|
||||
|
||||
frame = videoGetFrame(_videoHandle) + 1;
|
||||
videoSeek(_videoHandle, frame);
|
||||
videoPause(_videoHandle);
|
||||
luaTrace(L, "discStepForward", "%d", frame);
|
||||
} else {
|
||||
luaTrace(L, "discStepForward", "Failed! Disc is stopped.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue