src/osd/sdl/window.c
| r2874 | r2875 | |
| 31 | 31 | #include "osdcomm.h" |
| 32 | 32 | #include "osdepend.h" |
| 33 | 33 | #include "options.h" |
| 34 | #include "driver.h" |
| 34 | 35 | #include "ui.h" |
| 35 | 36 | |
| 36 | 37 | // OSD headers |
| r2874 | r2875 | |
| 1091 | 1092 | |
| 1092 | 1093 | static void set_starting_view(running_machine *machine, int index, sdl_window_info *window, const char *view) |
| 1093 | 1094 | { |
| 1094 | | int viewindex = -1; |
| 1095 | const char *defview = options_get_string(mame_options(), SDLOPTION_VIEW( )); |
| 1096 | int viewindex; |
| 1095 | 1097 | |
| 1096 | 1098 | ASSERT_MAIN_THREAD(); |
| 1097 | 1099 | |
| 1098 | | // NULL is the same as auto |
| 1099 | | if (view == NULL) |
| 1100 | | view = SDLOPTVAL_AUTO; |
| 1100 | // choose non-auto over auto |
| 1101 | if (strcmp(view, "auto") == 0 && strcmp(defview, "auto") != 0) |
| 1102 | view = defview; |
| 1101 | 1103 | |
| 1102 | | // auto view just selects the nth view |
| 1104 | // query the video system to help us pick a view |
| 1105 | viewindex = video_get_view_for_target(machine, window->target, view, index, video_config.numscreens); |
| 1103 | 1106 | |
| 1104 | | if (strcmp(view, SDLOPTVAL_AUTO) != 0) |
| 1105 | | { |
| 1106 | | // scan for a matching view name |
| 1107 | | for (viewindex = 0; ; viewindex++) |
| 1108 | | { |
| 1109 | | const char *name = render_target_get_view_name(window->target, viewindex); |
| 1110 | | |
| 1111 | | // stop scanning if we hit NULL |
| 1112 | | if (name == NULL) |
| 1113 | | { |
| 1114 | | viewindex = -1; |
| 1115 | | break; |
| 1116 | | } |
| 1117 | | if (mame_strnicmp(name, view, strlen(view)) == 0) |
| 1118 | | break; |
| 1119 | | } |
| 1120 | | } |
| 1121 | | |
| 1122 | | // if we don't have a match, default to the nth view |
| 1123 | | if (viewindex == -1) |
| 1124 | | { |
| 1125 | | int scrcount; |
| 1126 | | |
| 1127 | | // count the number of screens |
| 1128 | | scrcount = video_screen_count(machine->config); |
| 1129 | | |
| 1130 | | // if we have enough screens to be one per monitor, assign in order |
| 1131 | | if (video_config.numscreens >= scrcount) |
| 1132 | | { |
| 1133 | | // find the first view with this screen and this screen only |
| 1134 | | for (viewindex = 0; ; viewindex++) |
| 1135 | | { |
| 1136 | | UINT32 viewscreens = render_target_get_view_screens(window->target, viewindex); |
| 1137 | | if (viewscreens == (1 << index)) |
| 1138 | | break; |
| 1139 | | if (viewscreens == 0) |
| 1140 | | { |
| 1141 | | viewindex = -1; |
| 1142 | | break; |
| 1143 | | } |
| 1144 | | } |
| 1145 | | } |
| 1146 | | |
| 1147 | | // otherwise, find the first view that has all the screens |
| 1148 | | if (viewindex == -1) |
| 1149 | | { |
| 1150 | | for (viewindex = 0; ; viewindex++) |
| 1151 | | { |
| 1152 | | UINT32 viewscreens = render_target_get_view_screens(window->target, viewindex); |
| 1153 | | if (viewscreens == (1 << scrcount) - 1) |
| 1154 | | break; |
| 1155 | | if (viewscreens == 0) |
| 1156 | | break; |
| 1157 | | } |
| 1158 | | } |
| 1159 | | } |
| 1160 | | |
| 1161 | | // make sure it's a valid view |
| 1162 | | if (render_target_get_view_name(window->target, viewindex) == NULL) |
| 1163 | | viewindex = 0; |
| 1164 | | |
| 1165 | 1107 | // set the view |
| 1166 | 1108 | render_target_set_view(window->target, viewindex); |
| 1167 | 1109 | window->start_viewscreen=viewindex; |
src/mess/osd/sdl/sdlmess.c
| r2874 | r2875 | |
| 36 | 36 | { |
| 37 | 37 | file_error filerr = FILERR_NONE; |
| 38 | 38 | |
| 39 | | if (getcwd(buffer, buffer_len) == 0) |
| 39 | if (getcwd(buffer, buffer_len) == NULL) |
| 40 | 40 | { |
| 41 | 41 | filerr = FILERR_FAILURE; |
| 42 | 42 | } |
| r2874 | r2875 | |
| 51 | 51 | |
| 52 | 52 | return filerr; |
| 53 | 53 | } |
| 54 | |
| 54 | 55 | //============================================================ |
| 56 | // osd_get_full_path |
| 57 | //============================================================ |
| 58 | |
| 59 | file_error osd_get_full_path(char **dst, const char *path) |
| 60 | { |
| 61 | file_error err; |
| 62 | char path_buffer[512]; |
| 63 | |
| 64 | err = FILERR_NONE; |
| 65 | |
| 66 | if (getcwd(path_buffer, 511) == NULL) |
| 67 | { |
| 68 | printf("osd_get_full_path: failed!\n"); |
| 69 | err = FILERR_FAILURE; |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | *dst = (char *)malloc(strlen(path_buffer)+strlen(path)+3); |
| 74 | |
| 75 | sprintf(*dst, "%s%s%s", path_buffer, PATH_SEPARATOR, path); |
| 76 | printf("osd_get_full_path: cwd [%s] path [%s] out [%s]\n", path_buffer, path, *dst); |
| 77 | } |
| 78 | |
| 79 | return err; |
| 80 | } |
| 81 | |
| 82 | //============================================================ |
| 55 | 83 | // osd_setcurdir |
| 56 | 84 | //============================================================ |
| 57 | 85 | |