Mercurial > repos > blastem
annotate menu.c @ 1556:075df0844baa
Randomize soft reset timing and fix silly bug that was accidentally clearing IO state on soft reset
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 30 Mar 2018 22:01:05 -0700 |
parents | 3629366616da |
children | c362f2c7766a |
rev | line source |
---|---|
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #include <stdint.h> |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 #include <stdlib.h> |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 #include <string.h> |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #include <stdio.h> |
934
05b0a0d4fa40
Add strerror output to menu dir open failure message
Michael Pavone <pavone@retrodev.com>
parents:
933
diff
changeset
|
5 #include <errno.h> |
1103
22e87b739ad6
WIP split of ROM loading/argument parsing from Genesis emulation code. Compiles and doesn't crash, but nothing works. Still a few too many globals as well.
Michael Pavone <pavone@retrodev.com>
parents:
1059
diff
changeset
|
6 #include "genesis.h" |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 #include "menu.h" |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 #include "backend.h" |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 #include "util.h" |
961
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
10 #include "gst.h" |
1473
152a60c6787e
Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
1438
diff
changeset
|
11 #include "paths.h" |
1478
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
12 #include "saves.h" |
1485
369da70ee2c2
Filter file list in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1484
diff
changeset
|
13 #include "config.h" |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 |
1423
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
15 static menu_context *get_menu(genesis_context *gen) |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 { |
1423
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
17 menu_context *menu = gen->extra; |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
18 if (!menu) { |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
19 gen->extra = menu = calloc(1, sizeof(menu_context)); |
1473
152a60c6787e
Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
1438
diff
changeset
|
20 get_initial_browse_path(&menu->curpath); |
1423
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
21 } |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
22 return menu; |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
23 } |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
24 |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
25 uint16_t menu_read_w(uint32_t address, void * vcontext) |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
26 { |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
27 if ((address >> 1) == 14) { |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
28 m68k_context *context = vcontext; |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
29 menu_context *menu = get_menu(context->system); |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
30 uint16_t value = menu->external_game_load; |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
31 if (value) { |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
32 printf("Read: %X\n", value); |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
33 } |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
34 menu->external_game_load = 0; |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
35 return value; |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
36 } else { |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
37 //This should return the status of the last request with 0 |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
38 //meaning either the request is complete or no request is pending |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
39 //in the current implementation, the operations happen instantly |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
40 //in emulated time so we can always return 0 |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
41 return 0; |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
42 } |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 } |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 |
873
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
45 void copy_string_from_guest(m68k_context *m68k, uint32_t guest_addr, char *buf, size_t maxchars) |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
46 { |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
47 char *cur; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
48 char *src = NULL; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
49 for (cur = buf; cur < buf+maxchars; cur+=2, guest_addr+=2, src+=2) |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
50 { |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
51 if (!src || !(guest_addr & 0xFFFF)) { |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
52 //we may have walked off the end of a memory block, get a fresh native pointer |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
53 src = get_native_pointer(guest_addr, (void **)m68k->mem_pointers, &m68k->options->gen); |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
54 if (!src) { |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
55 break; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
56 } |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
57 } |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
58 *cur = src[1]; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
59 cur[1] = *src; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
60 if (!*src || !src[1]) { |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
61 break; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
62 } |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
63 } |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
64 //make sure we terminate the string even if we did not hit a null terminator in the source |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
65 buf[maxchars-1] = 0; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
66 } |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
67 |
957 | 68 void copy_to_guest(m68k_context *m68k, uint32_t guest_addr, char *src, size_t tocopy) |
69 { | |
70 char *dst = NULL; | |
71 for (char *cur = src; cur < src+tocopy; cur+=2, guest_addr+=2, dst+=2) | |
72 { | |
73 if (!dst || !(guest_addr & 0xFFFF)) { | |
74 //we may have walked off the end of a memory block, get a fresh native pointer | |
75 dst = get_native_pointer(guest_addr, (void **)m68k->mem_pointers, &m68k->options->gen); | |
76 if (!dst) { | |
77 break; | |
78 } | |
79 } | |
958
83532f944e3b
Get slot list displaying in "Save State" and "Load State" menu items
Michael Pavone <pavone@retrodev.com>
parents:
957
diff
changeset
|
80 dst[1] = *cur; |
83532f944e3b
Get slot list displaying in "Save State" and "Load State" menu items
Michael Pavone <pavone@retrodev.com>
parents:
957
diff
changeset
|
81 *dst = cur[1]; |
957 | 82 } |
83 } | |
84 | |
85 #define SAVE_INFO_BUFFER_SIZE (11*40) | |
86 | |
1059
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
87 uint32_t copy_dir_entry_to_guest(uint32_t dst, m68k_context *m68k, char *name, uint8_t is_dir) |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
88 { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
89 uint8_t *dest = get_native_pointer(dst, (void **)m68k->mem_pointers, &m68k->options->gen); |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
90 if (!dest) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
91 return 0; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
92 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
93 *(dest++) = is_dir; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
94 *(dest++) = 1; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
95 dst += 2; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
96 uint8_t term = 0; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
97 for (char *cpos = name; *cpos; cpos++) |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
98 { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
99 dest[1] = *cpos; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
100 dest[0] = cpos[1]; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
101 if (cpos[1]) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
102 cpos++; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
103 } else { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
104 term = 1; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
105 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
106 dst += 2; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
107 if (!(dst & 0xFFFF)) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
108 //we may have walked off the end of a memory block, get a fresh native pointer |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
109 dest = get_native_pointer(dst, (void **)m68k->mem_pointers, &m68k->options->gen); |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
110 if (!dest) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
111 break; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
112 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
113 } else { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
114 dest += 2; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
115 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
116 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
117 if (!term) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
118 *(dest++) = 0; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
119 *dest = 0; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
120 dst += 2; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
121 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
122 return dst; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
123 } |
1525
3629366616da
Fix unguarged windows.h include
Michael Pavone <pavone@retrodev.com>
parents:
1524
diff
changeset
|
124 #ifdef _WIN32 |
1524
b96f9fae757f
Fix Windows build, added Windows default_font_path implementation
Michael Pavone <pavone@retrodev.com>
parents:
1485
diff
changeset
|
125 #include <windows.h> |
1525
3629366616da
Fix unguarged windows.h include
Michael Pavone <pavone@retrodev.com>
parents:
1524
diff
changeset
|
126 #endif |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
127 void * menu_write_w(uint32_t address, void * context, uint16_t value) |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
128 { |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
129 m68k_context *m68k = context; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
130 genesis_context *gen = m68k->system; |
1423
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
131 menu_context *menu = get_menu(gen); |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
132 if (menu->state) { |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
133 uint32_t dst = menu->latch << 16 | value; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
134 switch (address >> 2) |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
135 { |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
136 case 0: { |
1524
b96f9fae757f
Fix Windows build, added Windows default_font_path implementation
Michael Pavone <pavone@retrodev.com>
parents:
1485
diff
changeset
|
137 #if _WIN32 |
1059
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
138 //handle virtual "drives" directory |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
139 if (menu->curpath[0] == PATH_SEP[0]) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
140 char drivestrings[4096]; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
141 if (sizeof(drivestrings) >= GetLogicalDriveStrings(sizeof(drivestrings), drivestrings)) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
142 for (char *cur = drivestrings; *cur; cur += strlen(cur) + 1) |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
143 { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
144 dst = copy_dir_entry_to_guest(dst, m68k, cur, 1); |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
145 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
146 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
147 //terminate list |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
148 uint8_t *dest = get_native_pointer(dst, (void **)m68k->mem_pointers, &m68k->options->gen); |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
149 if (dest) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
150 *dest = dest[1] = 0; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
151 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
152 break; |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
153 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
154 #endif |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
155 size_t num_entries; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
156 dir_entry *entries = get_dir_list(menu->curpath, &num_entries); |
868
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
157 if (entries) { |
1484
d82af64c94d2
Sort directory listing in Nuklear UI file browser
Michael Pavone <pavone@retrodev.com>
parents:
1481
diff
changeset
|
158 sort_dir_list(entries, num_entries); |
933
f7da9b4df0e7
Log errors opening directories in the menu code
Michael Pavone <pavone@retrodev.com>
parents:
884
diff
changeset
|
159 } else { |
934
05b0a0d4fa40
Add strerror output to menu dir open failure message
Michael Pavone <pavone@retrodev.com>
parents:
933
diff
changeset
|
160 warning("Failed to open directory %s: %s\n", menu->curpath, strerror(errno)); |
1034
2c8d76280e43
Slightly better handling of directory read errors
Michael Pavone <pavone@retrodev.com>
parents:
1024
diff
changeset
|
161 entries = malloc(sizeof(dir_entry)); |
2c8d76280e43
Slightly better handling of directory read errors
Michael Pavone <pavone@retrodev.com>
parents:
1024
diff
changeset
|
162 entries->name = strdup(".."); |
2c8d76280e43
Slightly better handling of directory read errors
Michael Pavone <pavone@retrodev.com>
parents:
1024
diff
changeset
|
163 entries->is_dir = 1; |
2c8d76280e43
Slightly better handling of directory read errors
Michael Pavone <pavone@retrodev.com>
parents:
1024
diff
changeset
|
164 num_entries = 1; |
868
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
165 } |
1059
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
166 #ifdef _WIN32 |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
167 if (menu->curpath[1] == ':' && !menu->curpath[2]) { |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
168 //Add fake .. entry to allow navigation to virtual "drives" directory |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
169 dst = copy_dir_entry_to_guest(dst, m68k, "..", 1); |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
170 } |
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
171 #endif |
1485
369da70ee2c2
Filter file list in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1484
diff
changeset
|
172 uint32_t num_exts; |
369da70ee2c2
Filter file list in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1484
diff
changeset
|
173 char **ext_list = get_extension_list(config, &num_exts); |
1059
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
174 for (size_t i = 0; dst && i < num_entries; i++) |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
175 { |
1417
e6efe6b2aee9
Add a file extension filter to the menu
Michael Pavone <pavone@retrodev.com>
parents:
1326
diff
changeset
|
176 if (num_exts && !entries[i].is_dir) { |
1485
369da70ee2c2
Filter file list in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1484
diff
changeset
|
177 if (!path_matches_extensions(entries[i].name, ext_list, num_exts)) { |
1417
e6efe6b2aee9
Add a file extension filter to the menu
Michael Pavone <pavone@retrodev.com>
parents:
1326
diff
changeset
|
178 continue; |
e6efe6b2aee9
Add a file extension filter to the menu
Michael Pavone <pavone@retrodev.com>
parents:
1326
diff
changeset
|
179 } |
e6efe6b2aee9
Add a file extension filter to the menu
Michael Pavone <pavone@retrodev.com>
parents:
1326
diff
changeset
|
180 } |
1059
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
181 dst = copy_dir_entry_to_guest(dst, m68k, entries[i].name, entries[i].is_dir); |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
182 } |
1417
e6efe6b2aee9
Add a file extension filter to the menu
Michael Pavone <pavone@retrodev.com>
parents:
1326
diff
changeset
|
183 free(ext_list); |
868
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
184 //terminate list |
1059
8da967779710
Added some hacky code to support a virtual root directory for selecting drives on Windows
Michael Pavone <pavone@retrodev.com>
parents:
1034
diff
changeset
|
185 uint8_t *dest = get_native_pointer(dst, (void **)m68k->mem_pointers, &m68k->options->gen); |
868
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
186 if (dest) { |
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
187 *dest = dest[1] = 0; |
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
188 } |
1034
2c8d76280e43
Slightly better handling of directory read errors
Michael Pavone <pavone@retrodev.com>
parents:
1024
diff
changeset
|
189 free_dir_list(entries, num_entries); |
868
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
190 break; |
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
191 } |
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
192 case 1: { |
1bab7e01ae98
Allow directory navigation in menu. Sort directory entries
Michael Pavone <pavone@retrodev.com>
parents:
866
diff
changeset
|
193 char buf[4096]; |
873
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
194 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); |
1481
77a401044935
Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1478
diff
changeset
|
195 buf[sizeof(buf)-1] = 0; |
77a401044935
Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1478
diff
changeset
|
196 char *tmp = menu->curpath; |
77a401044935
Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1478
diff
changeset
|
197 menu->curpath = path_append(tmp, buf); |
77a401044935
Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents:
1478
diff
changeset
|
198 free(tmp); |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
199 break; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
200 } |
1438
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
201 case 2: |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
202 case 8: { |
873
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
203 char buf[4096]; |
91bf4d905eba
Retrieve ROM filename from menu port write
Michael Pavone <pavone@retrodev.com>
parents:
872
diff
changeset
|
204 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); |
1008
51885857c019
Removed assumptions that path separators are Unix style outside of Unix-only verions of functions
Michael Pavone <pavone@retrodev.com>
parents:
972
diff
changeset
|
205 char const *pieces[] = {menu->curpath, PATH_SEP, buf}; |
1438
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
206 char *selected = alloc_concat_m(3, pieces); |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
207 if ((address >> 2) == 2) { |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
208 gen->header.next_rom = selected; |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
209 m68k->should_return = 1; |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
210 } else { |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
211 lockon_media(selected); |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
212 free(selected); |
e2bd03ed3190
Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents:
1434
diff
changeset
|
213 } |
872
7022ba865cfd
Initial work for allowing loading a ROM from menu
Michael Pavone <pavone@retrodev.com>
parents:
870
diff
changeset
|
214 break; |
957 | 215 } |
949
5e4fb650de58
Make Exit option in menu work
Michael Pavone <pavone@retrodev.com>
parents:
934
diff
changeset
|
216 case 3: { |
954
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
217 switch (dst) |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
218 { |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
219 case 1: |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
220 m68k->should_return = 1; |
1111
2eb54e24914e
Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
1103
diff
changeset
|
221 gen->header.should_exit = 1; |
954
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
222 break; |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
223 case 2: |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
224 m68k->should_return = 1; |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
225 break; |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
226 } |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
227 |
949
5e4fb650de58
Make Exit option in menu work
Michael Pavone <pavone@retrodev.com>
parents:
934
diff
changeset
|
228 break; |
5e4fb650de58
Make Exit option in menu work
Michael Pavone <pavone@retrodev.com>
parents:
934
diff
changeset
|
229 } |
957 | 230 case 4: { |
231 char *buffer = malloc(SAVE_INFO_BUFFER_SIZE); | |
232 char *cur = buffer; | |
1111
2eb54e24914e
Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
1103
diff
changeset
|
233 if (gen->header.next_context && gen->header.next_context->save_dir) { |
957 | 234 char *end = buffer + SAVE_INFO_BUFFER_SIZE; |
1478
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
235 uint32_t num_slots; |
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
236 save_slot_info *slots = get_slot_info(gen->header.next_context, &num_slots); |
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
237 for (uint32_t i = 0; i < num_slots; i++) |
957 | 238 { |
1478
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
239 size_t desc_len = strlen(slots[i].desc) + 1;//+1 for string terminator |
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
240 char *after = cur + desc_len + 1;//+1 for list terminator |
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
241 if (after > cur) { |
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
242 desc_len -= after - cur; |
957 | 243 } |
1478
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
244 memcpy(cur, slots[i].desc, desc_len); |
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
245 cur = after; |
957 | 246 } |
1478
da1dce39e846
Refactored save slot related logic to reduce duplication and allow reuse in new UI. Get state loading/saving mostly working in new UI
Michael Pavone <pavone@retrodev.com>
parents:
1473
diff
changeset
|
247 *cur = 0;//terminate list |
957 | 248 } else { |
249 *(cur++) = 0; | |
250 *(cur++) = 0; | |
251 } | |
252 copy_to_guest(m68k, dst, buffer, cur-buffer); | |
253 break; | |
1423
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
254 } |
961
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
255 case 5: |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
256 //save state |
1111
2eb54e24914e
Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
1103
diff
changeset
|
257 if (gen->header.next_context) { |
2eb54e24914e
Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
1103
diff
changeset
|
258 gen->header.next_context->save_state = dst + 1; |
961
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
259 } |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
260 m68k->should_return = 1; |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
261 break; |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
262 case 6: |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
263 //load state |
1111
2eb54e24914e
Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
1103
diff
changeset
|
264 if (gen->header.next_context && gen->header.next_context->save_dir) { |
1433
c886c54d8cf1
Added save states to SMS emulation
Michael Pavone <pavone@retrodev.com>
parents:
1428
diff
changeset
|
265 if (!gen->header.next_context->load_state(gen->header.next_context, dst)) { |
c886c54d8cf1
Added save states to SMS emulation
Michael Pavone <pavone@retrodev.com>
parents:
1428
diff
changeset
|
266 break; |
961
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
267 } |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
268 } |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
269 m68k->should_return = 1; |
750995b587a0
Save State menu option is now fully functional. Load state sort of works, but is mostly broken.
Michael Pavone <pavone@retrodev.com>
parents:
958
diff
changeset
|
270 break; |
1423
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
271 case 7: |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
272 //read only port |
9a3e003bdcb3
Make drag and drop play nice with the menu
Michael Pavone <pavone@retrodev.com>
parents:
1418
diff
changeset
|
273 break; |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
274 default: |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
275 fprintf(stderr, "WARNING: write to undefined menu port %X\n", address); |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
276 } |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
277 menu->state = 0; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
278 } else { |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
279 menu->latch = value; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
280 menu->state = 1; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
281 } |
954
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
282 if (m68k->should_return) { |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
283 m68k->target_cycle = m68k->current_cycle; |
cbc5b39e5518
Implement "Resume" button in pause menu
Michael Pavone <pavone@retrodev.com>
parents:
949
diff
changeset
|
284 } |
866
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
285 |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
286 return context; |
69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
287 } |