aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-02-12 14:30:21 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-02-12 14:30:21 +0900
commitbe500d48fbc381273dfdc600898f68df725aa954 (patch)
tree0fe735270b534793e6df887231678f1187a3fe24 /win32
parente0b2b671de44f6a5ca6e2c9b37af2797e6d10e0d (diff)
win32: add pause/restart
Diffstat (limited to 'win32')
-rw-r--r--win32/main.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/win32/main.c b/win32/main.c
index 7cf8494..c926f5b 100644
--- a/win32/main.c
+++ b/win32/main.c
@@ -49,6 +49,7 @@ static struct {
void *ppz8_buf;
bool paused;
HWND driverinfo;
+ const wchar_t *lastopenpath;
} g;
@@ -302,6 +303,12 @@ static void openfile(HWND hwnd, const wchar_t *path) {
g.sound->pause(g.sound, 0);
g.paused = false;
CloseHandle(file);
+ wchar_t *pathcpy = HeapAlloc(g.heap, 0, (lstrlen(path)+1)*sizeof(wchar_t));
+ if (pathcpy) {
+ lstrcpy(pathcpy, path);
+ }
+ if (g.lastopenpath) HeapFree(g.heap, 0, (void *)g.lastopenpath);
+ g.lastopenpath = pathcpy;
return;
err_fmp:
HeapFree(g.heap, 0, fmp);
@@ -520,6 +527,20 @@ static void on_key(HWND hwnd, UINT vk, BOOL down, int repeat, UINT scan) {
if (GetKeyState(VK_CONTROL) & 0x8000U) {
fmdsp_palette_set(&g.fmdsp, vk - VK_F1);
return;
+ } else {
+ switch (vk) {
+ case VK_F6:
+ if (g.lastopenpath) {
+ openfile(hwnd, g.lastopenpath);
+ }
+ break;
+ case VK_F7:
+ if (g.sound) {
+ g.paused = !g.paused;
+ g.sound->pause(g.sound, g.paused);
+ }
+ break;
+ }
}
}
FORWARD_WM_KEYDOWN(hwnd, vk, repeat, scan, DefWindowProc);