From 4a55b8d74132daa7b9c2b09c337532e5b0683cbf Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Mon, 3 Apr 2017 22:26:21 +0900 Subject: win32: add about dialog --- win32/main.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 120 insertions(+), 28 deletions(-) (limited to 'win32/main.c') diff --git a/win32/main.c b/win32/main.c index 8dc6bb8..76cd883 100644 --- a/win32/main.c +++ b/win32/main.c @@ -19,6 +19,7 @@ #include "toneview.h" #include "oscillo/oscillo.h" #include "oscilloview.h" +#include "about.h" enum { ID_OPENFILE = 0x10, @@ -26,6 +27,7 @@ enum { ID_2X, ID_TONEVIEW, ID_OSCILLOVIEW, + ID_ABOUT, }; #define FMPLAYER_CLASSNAME L"myon_fmplayer_ym2608_win32" @@ -62,7 +64,8 @@ static struct { HWND mainwnd; WNDPROC btn_defproc; HWND driverinfo; - HWND button_2x; + HWND button_2x, button_toneview, button_oscilloview, button_about; + bool toneview_on, oscilloview_on, about_on; const wchar_t *lastopenpath; bool fmdsp_2x; struct oscillodata oscillodata_audiothread[LIBOPNA_OSCILLO_TRACK_COUNT]; @@ -140,6 +143,7 @@ static bool loadfontrom(void) { CloseHandle(file); fmdsp_font_from_font_rom(&g.font, g.fontrom); g.font_loaded = true; + about_set_fontrom_loaded(true); return true; err_file: CloseHandle(file); @@ -178,6 +182,7 @@ static void loadrom(void) { || readbytes != OPNA_ROM_SIZE) goto err_buf; CloseHandle(file); g.drum_rom = buf; + about_set_adpcmrom_loaded(true); return; err_buf: HeapFree(g.heap, 0, buf); @@ -229,6 +234,7 @@ static void openfile(HWND hwnd, const wchar_t *path) { g.sound = sound_init(hwnd, SRATE, SECTLEN, sound_cb, &g.opna_timer); SetWindowText(g.driverinfo, g.sound->apiname); + about_setsoundapiname(g.sound->apiname); } fmdsp_vram_init(&g.fmdsp, &g.work, g.vram); if (!g.sound) goto err; @@ -327,11 +333,38 @@ static void on_dropfiles(HWND hwnd, HDROP hdrop) { } #endif // ENABLE_WM_DROPFILES -static void mask_set(unsigned mask, bool shift) { - if (shift) { - opna_set_mask(&g.opna, ~mask); +static void mask_set(int p, bool shift, bool control) { + if (!control) { + if (p >= 11) return; + static const unsigned masktbl[11] = { + LIBOPNA_CHAN_FM_1, + LIBOPNA_CHAN_FM_2, + LIBOPNA_CHAN_FM_3, + LIBOPNA_CHAN_FM_4, + LIBOPNA_CHAN_FM_5, + LIBOPNA_CHAN_FM_6, + LIBOPNA_CHAN_SSG_1, + LIBOPNA_CHAN_SSG_2, + LIBOPNA_CHAN_SSG_3, + LIBOPNA_CHAN_DRUM_ALL, + LIBOPNA_CHAN_ADPCM, + }; + unsigned mask = masktbl[p]; + if (shift) { + opna_set_mask(&g.opna, ~mask); + ppz8_set_mask(&g.ppz8, -1); + } else { + opna_set_mask(&g.opna, opna_get_mask(&g.opna) ^ mask); + } } else { - opna_set_mask(&g.opna, opna_get_mask(&g.opna) ^ mask); + if (p >= 8) return; + unsigned mask = 1u<