45 #ifdef CONFIG_DROPFILE_CALLBACK
49 switch (
QUESTION_WINDOW(
"Cancel|Mount as D81|Run/inject as PRG",
"What to do with the dropped file?")) {
61 static void ui_cb_attach_default_d81 (
const struct menu_st *m,
int *query )
67 static void ui_cb_attach_d81 (
const struct menu_st *m,
int *query )
72 char fnbuf[PATH_MAX + 1];
73 static char dir[PATH_MAX + 1] =
"";
78 creat ?
"Create new D81 to attach" :
"Select D81 to attach",
85 const int fnlen = strlen(fnbuf);
86 static const char d81_ext[] =
".d81";
87 char fnbuf2[fnlen + strlen(d81_ext) + 1];
88 strcpy(fnbuf2, fnbuf);
89 if (strcasecmp(fnbuf2 + fnlen - strlen(d81_ext), d81_ext)) {
90 strcpy(fnbuf2 + fnlen, d81_ext);
104 DEBUGPRINT(
"UI: file selection for D81 mount was cancelled." NL);
108 static void ui_cb_detach_d81 (
const struct menu_st *m,
int *query )
114 static void ui_run_prg_by_browsing (
void )
116 char fnbuf[PATH_MAX + 1];
117 static char dir[PATH_MAX + 1] =
"";
120 "Select PRG to directly load and run",
128 DEBUGPRINT(
"UI: file selection for PRG injection was cancelled." NL);
131 #ifdef CBM_BASIC_TEXT_SUPPORT
132 static void ui_save_basic_as_text (
void )
137 int size = xemu_basic_to_text_malloc(&buffer, 1000000, start, 0x2001, end, 0, 0);
145 printf(
"%s", buffer);
146 FILE *f = fopen(
"/tmp/prgout.txt",
"wb");
148 fwrite(buffer,
size, 1, f);
151 size = SDL_SetClipboardText((
const char *)buffer);
154 ERROR_WINDOW(
"Cannot set clipboard: %s", SDL_GetError());
158 static void ui_format_sdcard (
void )
161 "Formatting your SD-card image file will cause ALL your data,\n"
162 "system files (etc!) to be lost, forever!\n"
163 "Are you sure to continue this self-destruction sequence? :)"
168 INFO_WINDOW(
"Your SD-card file has been partitioned/formatted\nMEGA65 emulation is about to RESET now!");
173 static char dir_rom[PATH_MAX + 1] =
"";
175 static void ui_update_sdcard (
void )
177 char fnbuf[PATH_MAX + 1];
180 snprintf(fnbuf,
sizeof fnbuf,
"%sMEGA65.ROM",
sdl_pref_dir);
183 ask_rom =
QUESTION_WINDOW(
"Yes|No",
"Use the previously installed ROM?");
192 "Select your ROM image",
197 WARNING_WINDOW(
"Cannot update: you haven't selected a ROM image");
202 if (
xemu_load_file(fnbuf, NULL, 0x20000, 0x20000,
"Cannot start updating, bad C65/M65 ROM image has been selected!") != 0x20000)
209 INFO_WINDOW(
"SD-card system files update was aborted by the user.");
215 "Are you sure you want to use Open-ROMs on your SD-card?\n\n"
216 "You've selected a ROM for update which belongs to the\n"
217 "Open-ROMs projects. Please note, that Open-ROMs are not\n"
218 "yet ready for usage by an average user! For general usage\n"
219 "currently, closed-ROMs are recommended! Open-ROMs\n"
220 "currently can be interesting for mostly developers and\n"
221 "for curious minds.",
228 "The selected ROM image is an Xemu-internal ROM image.\n"
229 "This cannot be used to update your emulated SD-card."
236 char fnbuf_target[PATH_MAX];
240 DEBUGPRINT(
"Backing up ROM image %s to %s" NL, fnbuf, fnbuf_target);
245 "Cannot save the selected ROM file for the updater"
255 "Cannot save the extracted CHAR ROM file for the updater"
259 if (!sdcontent_handle(
sdcard_get_size(), NULL, SDCONTENT_DO_FILES | SDCONTENT_OVERWRITE_FILES)) {
261 "System files on your SD-card image seems to be updated successfully.\n"
262 "Next time you may need this function, you can use MEGA65.ROM which is a backup copy of your selected ROM.\n\n"
279 static void reset_via_hyppo (
void )
283 ERROR_WINDOW(
"Currently in hypervisor mode.\nNot possible to trigger a trap now");
287 static void reset_into_custom_rom (
void )
289 char fnbuf[PATH_MAX + 1];
303 WARNING_WINDOW(
"You refused reset, loaded ROM can be only activated at the next reset.");
307 static void reset_into_utility_menu (
void )
309 ERROR_WINDOW(
"Currently there are some problems using this function,\nIt's a known problem. You'll get empty screen after utility selection.\nOnce it's resolved this message will be removed from Xemu");
318 static void reset_into_c64_mode (
void )
332 static void reset_generic (
void )
340 static void reset_into_xemu_stubrom (
void )
348 static void reset_into_xemu_initrom (
void )
356 static void reset_into_c65_mode_noboot (
void )
367 static void ui_cb_use_default_rom (
const struct menu_st *m,
int *query )
381 #ifdef HAS_UARTMON_SUPPORT
382 static void ui_cb_start_umon (
const struct menu_st *m,
int *query )
384 int is_active = uartmon_is_active();
387 INFO_WINDOW(
"UART monitor is already active.\nCurrently stopping it is not supported.");
390 if (!uartmon_init(UMON_DEFAULT_PORT))
391 INFO_WINDOW(
"UART monitor has been starton on " UMON_DEFAULT_PORT);
395 static void ui_cb_matrix_mode (
const struct menu_st *m,
int *query )
401 static void ui_cb_hdos_virt (
const struct menu_st *m,
int *query )
408 static char last_used_dump_directory[PATH_MAX + 1] =
"";
410 static void ui_dump_memory (
void )
412 char fnbuf[PATH_MAX + 1];
415 "Dump main memory content into file",
416 last_used_dump_directory,
424 static void ui_dump_colram (
void )
426 char fnbuf[PATH_MAX + 1];
429 "Dump colour memory content into file",
430 last_used_dump_directory,
438 static void ui_dump_hyperram (
void )
440 char fnbuf[PATH_MAX + 1];
443 "Dump hyperRAM content into file",
444 last_used_dump_directory,
452 static void ui_emu_info (
void )
458 const char *hdos_root;
461 "DMA chip current revision: %d (F018 rev-%s)\n"
462 "ROM version detected: %d %s (%s,%s)\n"
463 "ROM SHA1: %s (%s)\n"
464 "Last RESET type: %s\n"
465 "Hyppo version: %s (%s)\n"
466 "HDOS virtualization: %s, root = %s\n"
467 "Disk8 = %s\nDisk9 = %s\n"
468 "C64 'CPU' I/O port (low 3 bits): DDR=%d OUT=%d\n"
469 "Current PC: $%04X (linear: $%07X)\n"
470 "Current VIC and I/O mode: %s %s, hot registers are %s\n"
472 "Xemu host CPU usage so far: %s\n"
477 rom_now_hash_str, strcmp(
rom_hash_str, rom_now_hash_str) ?
"MANGLED" :
"intact",
480 hdos_virt ?
"ON" :
"OFF", hdos_root,
490 static void ui_put_screen_text_into_paste_buffer (
void )
496 main_ram + ((vic_registers[0x31] & 0x80) ? (vic_registers[0x18] & 0xE0) << 6 : (vic_registers[0x18] & 0xF0) << 6),
497 (vic_registers[0x31] & 0x80) ? 80 : 40,
499 (vic_registers[0x18] & 2)
504 if (SDL_SetClipboardText(result))
505 ERROR_WINDOW(
"Cannot insert text into the OS paste buffer: %s", SDL_GetError());
507 OSD(-1, -1,
"Copied to OS paste buffer.");
509 INFO_WINDOW(
"Screen is empty, nothing to capture.");
512 static void ui_put_paste_buffer_into_screen_text (
void )
514 char *t = SDL_GetClipboardText();
518 while (*t2 && (*t2 ==
'\t' || *t2 ==
'\r' || *t2 ==
'\n' || *t2 ==
' '))
523 main_ram + ((vic_registers[0x31] & 0x80) ? (vic_registers[0x18] & 0xE0) << 6 : (vic_registers[0x18] & 0xF0) << 6),
524 (vic_registers[0x31] & 0x80) ? 80 : 40,
527 (vic_registers[0x18] & 2)
534 ERROR_WINDOW(
"Clipboard query error, or clipboard was empty");
537 static void ui_cb_mono_downmix (
const struct menu_st *m,
int *query )
543 static void ui_cb_audio_volume (
const struct menu_st *m,
int *query )
549 static void ui_cb_video_standard (
const struct menu_st *m,
int *query )
559 static void ui_cb_video_standard_disallow_change (
const struct menu_st *m,
int *query )
565 static void ui_cb_fullborders (
const struct menu_st *m,
int *query )
572 static void ui_cb_sids_enabled (
const struct menu_st *m,
int *query )
579 static void ui_cb_render_scale_quality (
const struct menu_st *m,
int *query )
583 SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY, req_str, SDL_HINT_OVERRIDE);
589 static void ui_cb_displayenable (
const struct menu_st *m,
int *query )
600 static const struct menu_st menu_video_standard[] = {
609 static const struct menu_st menu_window_size[] = {
624 static const struct menu_st menu_render_scale_quality[] = {
633 static const struct menu_st menu_display[] = {
642 #ifdef XEMU_FILES_SCREENSHOT_SUPPORT
649 static const struct menu_st menu_reset[] = {
663 static const struct menu_st menu_inputdevices[] = {
676 static const struct menu_st menu_debug[] = {
677 #ifdef HAS_UARTMON_SUPPORT
678 {
"Start umon on " UMON_DEFAULT_PORT,
704 #ifdef HAVE_XEMU_EXEC_API
712 #ifdef HAVE_XEMU_EXEC_API
713 static const struct menu_st menu_help[] = {
715 {
"Check update / useful MEGA65 links",
722 static const struct menu_st menu_sdcard[] = {
727 static const struct menu_st menu_drv8[] = {
738 static const struct menu_st menu_drv9[] = {
752 static const struct menu_st menu_disks[] = {
758 static const struct menu_st menu_audio_stereo[] = {
783 static const struct menu_st menu_audio_volume[] = {
806 static const struct menu_st menu_audio_sids[] = {
817 static const struct menu_st menu_audio[] = {
828 static const struct menu_st menu_config[] = {
832 {
"Save config as default",
XEMUGUI_MENUID_CALLABLE, xemugui_cb_cfgfile, (
void*)XEMUGUICFGFILEOP_SAVE_DEFAULT },
834 {
"Save config as custom file",
XEMUGUI_MENUID_CALLABLE, xemugui_cb_cfgfile, (
void*)XEMUGUICFGFILEOP_SAVE_CUSTOM },
837 static const struct menu_st menu_main[] = {
845 #ifdef HAVE_XEMU_EXEC_API
849 #ifdef CBM_BASIC_TEXT_SUPPORT