1
/* Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
2
Copyright (C)2016-2019 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
19
#include "xemu/emutools.h"
21
#include "xemu/emutools_gui.h"
22
#include "xemu/emutools_files.h"
23
#include "xemu/d81access.h"
24
#include "commodore_65.h"
27
//#if defined(CONFIG_DROPFILE_CALLBACK) || defined(XEMU_GUI)
30
static int attach_d81 ( const char *fn )
33
if (mount_external_d81(fn, 0)) {
34
ERROR_WINDOW("Mount failed for some reason.");
37
DEBUGPRINT("UI: file seems to be mounted successfully as D81: %s" NL, fn);
41
ERROR_WINDOW("Cannot mount external D81, since Mega65 was not instructed to mount any FD access yet.");
48
static int attach_d81 ( const char *fn )
51
return d81access_attach_fsobj(fn, D81ACCESS_IMG | D81ACCESS_PRG | D81ACCESS_DIR | D81ACCESS_AUTOCLOSE);
56
// end of #if defined(CONFIG_DROPFILE_CALLBACK) || defined(XEMU_GUI_C)
60
#ifdef CONFIG_DROPFILE_CALLBACK
61
void emu_dropfile_callback ( const char *fn )
63
DEBUGGUI("UI: drop event, file: %s" NL, fn);
64
if (ARE_YOU_SURE("Shall I try to mount the dropped file as D81 for you?"))
71
static void ui_attach_d81_by_browsing ( void )
73
char fnbuf[PATH_MAX + 1];
74
static char dir[PATH_MAX + 1] = "";
75
if (!xemugui_file_selector(
76
XEMUGUI_FSEL_OPEN | XEMUGUI_FSEL_FLAG_STORE_DIR,
77
"Select D81 to attach",
84
DEBUGPRINT("UI: file selection for D81 mount was cancalled." NL);
90
static void ui_native_os_file_browser ( void )
92
xemuexec_open_native_file_browser(sdl_pref_dir);
97
static const struct menu_st menu_display[] = {
98
{ "Fullscreen", XEMUGUI_MENUID_CALLABLE, xemugui_cb_windowsize, (void*)0 },
99
{ "Window - 100%", XEMUGUI_MENUID_CALLABLE, xemugui_cb_windowsize, (void*)1 },
100
{ "Window - 200%", XEMUGUI_MENUID_CALLABLE, xemugui_cb_windowsize, (void*)2 },
105
static const struct menu_st menu_main[] = {
106
{ "Display", XEMUGUI_MENUID_SUBMENU, menu_display, NULL },
107
{ "Reset C65", XEMUGUI_MENUID_CALLABLE, xemugui_cb_call_user_data, c65_reset },
108
{ "Attach D81", XEMUGUI_MENUID_CALLABLE, xemugui_cb_call_user_data, ui_attach_d81_by_browsing },
109
// { "Browse system folder", XEMUGUI_MENUID_CALLABLE, xemugui_cb_call_user_data, ui_native_os_file_browser },
111
{ "System console", XEMUGUI_MENUID_CALLABLE | XEMUGUI_MENUFLAG_QUERYBACK, xemugui_cb_sysconsole, NULL },
113
{ "Quit", XEMUGUI_MENUID_CALLABLE, xemugui_cb_call_quit_if_sure, NULL },
118
void ui_enter ( void )
120
DEBUGGUI("UI: handler has been called." NL);
121
if (xemugui_popup(menu_main)) {
122
DEBUGPRINT("UI: oops, POPUP does not worked :(" NL);