src/osd/winui/directories.c
| r7939 | r7940 | |
| 163 | 163 | return; |
| 164 | 164 | t_pOldText = pInfo[nType].m_tDirectory; |
| 165 | 165 | if (t_pOldText) |
| 166 | | global_free(t_pOldText); |
| 166 | osd_free(t_pOldText); |
| 167 | 167 | pInfo[nType].m_tDirectory = t_s; |
| 168 | 168 | } |
| 169 | 169 | } |
| r7939 | r7940 | |
| 293 | 293 | if( !t_s ) |
| 294 | 294 | return FALSE; |
| 295 | 295 | (void)ComboBox_InsertString(GetDlgItem(hDlg, IDC_DIR_COMBO), 0, win_tstring_strdup(t_s)); |
| 296 | | global_free(t_s); |
| 296 | osd_free(t_s); |
| 297 | 297 | t_s = NULL; |
| 298 | 298 | } |
| 299 | 299 | |
| r7939 | r7940 | |
| 337 | 337 | { |
| 338 | 338 | DirInfo_SetDir(g_pDirInfo, i, -1, t_s); |
| 339 | 339 | } |
| 340 | | global_free(t_s); |
| 340 | osd_free(t_s); |
| 341 | 341 | t_s = NULL; |
| 342 | 342 | } |
| 343 | 343 | |
| r7939 | r7940 | |
| 346 | 346 | |
| 347 | 347 | error: |
| 348 | 348 | if( t_s ) |
| 349 | | global_free(t_s); |
| 349 | osd_free(t_s); |
| 350 | 350 | Directories_OnDestroy(hDlg); |
| 351 | 351 | EndDialog(hDlg, -1); |
| 352 | 352 | return FALSE; |
| r7939 | r7940 | |
| 368 | 368 | if (g_pDirInfo[i].m_Path) |
| 369 | 369 | free(g_pDirInfo[i].m_Path); |
| 370 | 370 | if (g_pDirInfo[i].m_tDirectory) |
| 371 | | global_free(g_pDirInfo[i].m_tDirectory); |
| 371 | osd_free(g_pDirInfo[i].m_tDirectory); |
| 372 | 372 | } |
| 373 | 373 | free(g_pDirInfo); |
| 374 | 374 | g_pDirInfo = NULL; |
| r7939 | r7940 | |
| 401 | 401 | } |
| 402 | 402 | utf8_buf = utf8_from_tstring(buf); |
| 403 | 403 | SetTheseDirs(utf8_buf); |
| 404 | | global_free(utf8_buf); |
| 404 | osd_free(utf8_buf); |
| 405 | 405 | |
| 406 | 406 | nResult |= nFlagResult; |
| 407 | 407 | } |
| r7939 | r7940 | |
| 426 | 426 | s = FixSlash(DirInfo_Dir(g_pDirInfo, i)); |
| 427 | 427 | utf8_s = utf8_from_tstring(s); |
| 428 | 428 | g_directoryInfo[i].pfnSetTheseDirs(utf8_s); |
| 429 | | global_free(utf8_s); |
| 429 | osd_free(utf8_s); |
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | EndDialog(hDlg, nResult); |
src/osd/winui/dijoystick.c
| r7939 | r7940 | |
| 448 | 448 | hr = IDirectInputDevice2_SetProperty(joystick->did, DIPROP_RANGE, &diprg.diph); |
| 449 | 449 | if (FAILED(hr)) /* if this fails, don't use this axis */ |
| 450 | 450 | { |
| 451 | | global_free(joystick->axes[joystick->num_axes].name); |
| 451 | free(joystick->axes[joystick->num_axes].name); |
| 452 | 452 | joystick->axes[joystick->num_axes].name = NULL; |
| 453 | 453 | return DIENUM_CONTINUE; |
| 454 | 454 | } |
| r7939 | r7940 | |
| 649 | 649 | for (i = 0; i < joystick->num_axes; i++) |
| 650 | 650 | { |
| 651 | 651 | if (joystick->axes[i].name) |
| 652 | | global_free(joystick->axes[i].name); |
| 652 | free(joystick->axes[i].name); |
| 653 | 653 | joystick->axes[i].name = NULL; |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | if (joystick->name != NULL) |
| 657 | 657 | { |
| 658 | | global_free(joystick->name); |
| 658 | free(joystick->name); |
| 659 | 659 | joystick->name = NULL; |
| 660 | 660 | } |
| 661 | 661 | } |
src/osd/winui/mui_opts.c
| r7939 | r7940 | |
| 2179 | 2179 | if( !t_ptr ) |
| 2180 | 2180 | return; |
| 2181 | 2181 | _tcscpy(f->lfFaceName, t_ptr); |
| 2182 | | global_free(t_ptr); |
| 2182 | osd_free(t_ptr); |
| 2183 | 2183 | } |
| 2184 | 2184 | } |
| 2185 | 2185 | |
| r7939 | r7940 | |
| 2206 | 2206 | f->lfPitchAndFamily, |
| 2207 | 2207 | utf8_FaceName); |
| 2208 | 2208 | |
| 2209 | | global_free(utf8_FaceName); |
| 2209 | osd_free(utf8_FaceName); |
| 2210 | 2210 | } |
| 2211 | 2211 | |
| 2212 | 2212 | static void TabFlagsEncodeString(int data, char *str) |
| r7939 | r7940 | |
| 2907 | 2907 | astring_free(match); |
| 2908 | 2908 | utf8_filename = utf8_from_tstring(findFileData.cFileName); |
| 2909 | 2909 | match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, utf8_filename ); |
| 2910 | | free(utf8_filename); |
| 2910 | osd_free(utf8_filename); |
| 2911 | 2911 | osd_rmfile(astring_c(match)); |
| 2912 | 2912 | astring_free(match); |
| 2913 | 2913 | |
| r7939 | r7940 | |
| 2915 | 2915 | { |
| 2916 | 2916 | utf8_filename = utf8_from_tstring(findFileData.cFileName); |
| 2917 | 2917 | match = astring_assemble_3(astring_alloc(), astring_c(pathname), PATH_SEPARATOR, utf8_filename ); |
| 2918 | | free(utf8_filename); |
| 2918 | osd_free(utf8_filename); |
| 2919 | 2919 | osd_rmfile(astring_c(match)); |
| 2920 | 2920 | astring_free(match); |
| 2921 | 2921 | } |
src/osd/winui/mui_util.c
| r7939 | r7940 | |
| 203 | 203 | hErr = ShellExecute(hWnd, NULL, tName, NULL, NULL, SW_SHOWNORMAL); |
| 204 | 204 | if ((FPTR)hErr > 32) |
| 205 | 205 | { |
| 206 | | global_free(tName); |
| 206 | osd_free(tName); |
| 207 | 207 | return; |
| 208 | 208 | } |
| 209 | 209 | |
| r7939 | r7940 | |
| 239 | 239 | |
| 240 | 240 | MessageBox(NULL, msg, tName, MB_OK); |
| 241 | 241 | |
| 242 | | global_free(tName); |
| 242 | osd_free(tName); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | char* MyStrStrI(const char* pFirst, const char* pSrch) |
| r7939 | r7940 | |
| 596 | 596 | |
| 597 | 597 | icon = ExtractIcon(inst, t_exefilename, iconindex); |
| 598 | 598 | |
| 599 | | global_free(t_exefilename); |
| 599 | osd_free(t_exefilename); |
| 600 | 600 | |
| 601 | 601 | return icon; |
| 602 | 602 | } |
| r7939 | r7940 | |
| 612 | 612 | TCHAR *cpy = NULL; |
| 613 | 613 | if (str != NULL) |
| 614 | 614 | { |
| 615 | | cpy = (TCHAR*)malloc((_tcslen(str) + 1) * sizeof(TCHAR)); |
| 615 | cpy = (TCHAR*)osd_malloc((_tcslen(str) + 1) * sizeof(TCHAR)); |
| 616 | 616 | if (cpy != NULL) |
| 617 | 617 | _tcscpy(cpy, str); |
| 618 | 618 | } |
| r7939 | r7940 | |
| 635 | 635 | result = CreateFile(t_filename, desiredmode, sharemode, securityattributes, creationdisposition, |
| 636 | 636 | flagsandattributes, templatehandle); |
| 637 | 637 | |
| 638 | | global_free(t_filename); |
| 638 | osd_free(t_filename); |
| 639 | 639 | |
| 640 | 640 | return result; |
| 641 | 641 | } |
| r7939 | r7940 | |
| 661 | 661 | if( bufferlength > 0 ) { |
| 662 | 662 | utf8_buffer = utf8_from_tstring(t_buffer); |
| 663 | 663 | if( !utf8_buffer ) { |
| 664 | | global_free(t_buffer); |
| 664 | osd_free(t_buffer); |
| 665 | 665 | return result; |
| 666 | 666 | } |
| 667 | 667 | } |
| r7939 | r7940 | |
| 669 | 669 | strncpy(buffer, utf8_buffer, bufferlength); |
| 670 | 670 | |
| 671 | 671 | if( utf8_buffer ) |
| 672 | | global_free(utf8_buffer); |
| 672 | osd_free(utf8_buffer); |
| 673 | 673 | |
| 674 | 674 | if( t_buffer ) |
| 675 | | global_free(t_buffer); |
| 675 | free(t_buffer); |
| 676 | 676 | |
| 677 | 677 | return result; |
| 678 | 678 | } |
| r7939 | r7940 | |
| 690 | 690 | |
| 691 | 691 | result = FindFirstFile(t_filename, findfiledata); |
| 692 | 692 | |
| 693 | | global_free(t_filename); |
| 693 | osd_free(t_filename); |
| 694 | 694 | |
| 695 | 695 | return result; |
| 696 | 696 | } |
src/osd/winui/winui.c
| r7939 | r7940 | |
| 1017 | 1017 | |
| 1018 | 1018 | /* free arguments */ |
| 1019 | 1019 | for (i = 0; i < __argc; i++) |
| 1020 | | global_free(utf8_argv[i]); |
| 1020 | osd_free(utf8_argv[i]); |
| 1021 | 1021 | free(utf8_argv); |
| 1022 | 1022 | |
| 1023 | 1023 | exit(rc); |
| r7939 | r7940 | |
| 1805 | 1805 | return FALSE; |
| 1806 | 1806 | |
| 1807 | 1807 | _tcscpy(last_directory,t_inpdir); |
| 1808 | | global_free(t_inpdir); |
| 1808 | osd_free(t_inpdir); |
| 1809 | 1809 | hMain = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_MAIN), 0, NULL); |
| 1810 | 1810 | if (hMain == NULL) |
| 1811 | 1811 | { |
| r7939 | r7940 | |
| 3018 | 3018 | if( !t_gameinfostatus ) |
| 3019 | 3019 | return; |
| 3020 | 3020 | _tcscpy(String, t_gameinfostatus); |
| 3021 | | global_free(t_gameinfostatus); |
| 3021 | osd_free(t_gameinfostatus); |
| 3022 | 3022 | } |
| 3023 | 3023 | } |
| 3024 | 3024 | else |
| r7939 | r7940 | |
| 3271 | 3271 | |
| 3272 | 3272 | UpdateScreenShot(); |
| 3273 | 3273 | |
| 3274 | | global_free(t_description); |
| 3274 | osd_free(t_description); |
| 3275 | 3275 | } |
| 3276 | 3276 | |
| 3277 | 3277 | static void PaintBackgroundImage(HWND hWnd, HRGN hRgn, int x, int y) |
| r7939 | r7940 | |
| 3418 | 3418 | |
| 3419 | 3419 | result = TryRenameCustomFolder(folder, utf8_szText); |
| 3420 | 3420 | |
| 3421 | | global_free(utf8_szText); |
| 3421 | osd_free(utf8_szText); |
| 3422 | 3422 | |
| 3423 | 3423 | return result; |
| 3424 | 3424 | } |
| r7939 | r7940 | |
| 3787 | 3787 | return; |
| 3788 | 3788 | CreateProcess(NULL, t_exec_command, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); |
| 3789 | 3789 | |
| 3790 | | global_free(t_exec_command); |
| 3790 | osd_free(t_exec_command); |
| 3791 | 3791 | |
| 3792 | 3792 | // We will not wait for the process to finish cause it might be a background task |
| 3793 | 3793 | // The process won't get closed when MAME32 closes either. |
| r7939 | r7940 | |
| 4595 | 4595 | ResetBackground(utf8_szFile); |
| 4596 | 4596 | LoadBackgroundBitmap(); |
| 4597 | 4597 | InvalidateRect(hMain, NULL, TRUE); |
| 4598 | | global_free(t_bgdir); |
| 4599 | | global_free(utf8_szFile); |
| 4598 | osd_free(t_bgdir); |
| 4599 | osd_free(utf8_szFile); |
| 4600 | 4600 | return TRUE; |
| 4601 | 4601 | } |
| 4602 | | global_free(t_bgdir); |
| 4602 | osd_free(t_bgdir); |
| 4603 | 4603 | } |
| 4604 | 4604 | break; |
| 4605 | 4605 | |
| r7939 | r7940 | |
| 4919 | 4919 | return s; |
| 4920 | 4920 | |
| 4921 | 4921 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s); |
| 4922 | | global_free(t_s); |
| 4922 | osd_free(t_s); |
| 4923 | 4923 | |
| 4924 | 4924 | s = pszBuffer; |
| 4925 | 4925 | } |
| r7939 | r7940 | |
| 4946 | 4946 | a = GlobalAddAtom(t_description); |
| 4947 | 4947 | SendMessage(HWND_BROADCAST, g_mame32_message, a, a); |
| 4948 | 4948 | GlobalDeleteAtom(a); |
| 4949 | | global_free(t_description); |
| 4949 | osd_free(t_description); |
| 4950 | 4950 | } |
| 4951 | 4951 | |
| 4952 | 4952 | EnableSelection(nItem); |
| r7939 | r7940 | |
| 5023 | 5023 | |
| 5024 | 5024 | // Allow selection to change the default saved game |
| 5025 | 5025 | bListReady = TRUE; |
| 5026 | | global_free(t_bgdir); |
| 5026 | osd_free(t_bgdir); |
| 5027 | 5027 | } |
| 5028 | 5028 | |
| 5029 | 5029 | static void AddDriverIcon(int nItem,int default_icon_index) |
| r7939 | r7940 | |
| 5443 | 5443 | if (t_filename != NULL) |
| 5444 | 5444 | { |
| 5445 | 5445 | _sntprintf(t_filename_buffer, ARRAY_LENGTH(t_filename_buffer), TEXT("%s"), t_filename); |
| 5446 | | global_free(t_filename); |
| 5446 | osd_free(t_filename); |
| 5447 | 5447 | } |
| 5448 | 5448 | |
| 5449 | 5449 | of.lStructSize = sizeof(of); |
| r7939 | r7940 | |
| 5567 | 5567 | } |
| 5568 | 5568 | |
| 5569 | 5569 | if( t_artdir ) |
| 5570 | | global_free(t_artdir); |
| 5570 | osd_free(t_artdir); |
| 5571 | 5571 | if( t_statedir ) |
| 5572 | | global_free(t_statedir); |
| 5572 | osd_free(t_statedir); |
| 5573 | 5573 | if( t_snapdir ) |
| 5574 | | global_free(t_snapdir); |
| 5574 | osd_free(t_snapdir); |
| 5575 | 5575 | |
| 5576 | 5576 | utf8_filename = utf8_from_tstring(t_filename_buffer); |
| 5577 | 5577 | if (utf8_filename != NULL) |
| 5578 | 5578 | { |
| 5579 | 5579 | snprintf(filename, MAX_PATH, "%s", utf8_filename); |
| 5580 | | global_free(utf8_filename); |
| 5580 | osd_free(utf8_filename); |
| 5581 | 5581 | } |
| 5582 | 5582 | |
| 5583 | 5583 | return success; |
| r7939 | r7940 | |
| 5659 | 5659 | if( !utf8_LangFile ) |
| 5660 | 5660 | return FALSE; |
| 5661 | 5661 | SetLanguage(utf8_LangFile); |
| 5662 | | global_free(utf8_LangFile); |
| 5662 | osd_free(utf8_LangFile); |
| 5663 | 5663 | |
| 5664 | 5664 | case IDCANCEL: |
| 5665 | 5665 | EndDialog(hDlg, 0); |
| r7939 | r7940 | |
| 5692 | 5692 | if( !t_message ) |
| 5693 | 5693 | return; |
| 5694 | 5694 | SendMessage(hStatusBar, SB_SETTEXT, (WPARAM) part_index, (LPARAM)(LPCTSTR) win_tstring_strdup(t_message)); |
| 5695 | | global_free(t_message); |
| 5695 | osd_free(t_message); |
| 5696 | 5696 | } |
| 5697 | 5697 | |
| 5698 | 5698 | void SetStatusBarTextF(int part_index, const char *fmt, ...) |
| r7939 | r7940 | |
| 6321 | 6321 | |
| 6322 | 6322 | EnableMenuItem(hMenu, ID_CONTEXT_SELECT_RANDOM, MF_ENABLED); |
| 6323 | 6323 | |
| 6324 | | global_free(t_description); |
| 6324 | osd_free(t_description); |
| 6325 | 6325 | } |
| 6326 | 6326 | else |
| 6327 | 6327 | { |
| r7939 | r7940 | |
| 6439 | 6439 | else |
| 6440 | 6440 | InsertMenuItem(hMenu,i,FALSE,&mii); |
| 6441 | 6441 | |
| 6442 | | global_free(t_title); |
| 6442 | osd_free(t_title); |
| 6443 | 6443 | } |
| 6444 | 6444 | |
| 6445 | 6445 | } |
src/osd/winui/properties.c
| r7939 | r7940 | |
| 605 | 605 | win_message_box_utf8(0, temp, "Error", IDOK); |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | | global_free(t_description); |
| 608 | osd_free(t_description); |
| 609 | 609 | free(pspage); |
| 610 | 610 | } |
| 611 | 611 | |
| r7939 | r7940 | |
| 1969 | 1969 | TCHAR *screen_option_value; |
| 1970 | 1970 | int selected_screen; |
| 1971 | 1971 | int screen_option_index; |
| 1972 | | const char *op_val; |
| 1972 | char *op_val; |
| 1973 | 1973 | |
| 1974 | 1974 | selected_screen = GetSelectedScreen(dialog); |
| 1975 | 1975 | screen_option_index = ComboBox_GetCurSel(control); |
| r7939 | r7940 | |
| 1977 | 1977 | snprintf(screen_option_name, ARRAY_LENGTH(screen_option_name), "screen%d", selected_screen); |
| 1978 | 1978 | op_val = utf8_from_tstring(screen_option_value); |
| 1979 | 1979 | options_set_string(opts, screen_option_name, op_val, OPTION_PRIORITY_CMDLINE); |
| 1980 | osd_free(op_val); |
| 1980 | 1981 | return FALSE; |
| 1981 | 1982 | } |
| 1982 | 1983 | |
| r7939 | r7940 | |
| 2015 | 2016 | return FALSE; |
| 2016 | 2017 | if (_tcscmp(t_option, dd.DeviceName) == 0) |
| 2017 | 2018 | nSelection = i+1; |
| 2018 | | global_free(t_option); |
| 2019 | osd_free(t_option); |
| 2019 | 2020 | } |
| 2020 | 2021 | } |
| 2021 | 2022 | (void)ComboBox_SetCurSel(control, nSelection); |
| r7939 | r7940 | |
| 2079 | 2080 | { |
| 2080 | 2081 | TCHAR *input_option_value; |
| 2081 | 2082 | int input_option_index; |
| 2082 | | const char *op_val; |
| 2083 | char *op_val; |
| 2083 | 2084 | |
| 2084 | 2085 | input_option_index = ComboBox_GetCurSel(control); |
| 2085 | 2086 | input_option_value = (TCHAR*) ComboBox_GetItemData(control, input_option_index); |
| 2086 | 2087 | op_val = utf8_from_tstring(input_option_value); |
| 2087 | 2088 | options_set_string(opts, OPTION_CTRLR, op_val, OPTION_PRIORITY_CMDLINE); |
| 2089 | osd_free(op_val); |
| 2088 | 2090 | return FALSE; |
| 2089 | 2091 | } |
| 2090 | 2092 | |
| r7939 | r7940 | |
| 2126 | 2128 | if( !t_ctrldir ) |
| 2127 | 2129 | { |
| 2128 | 2130 | if( t_buf ) |
| 2129 | | global_free(t_buf); |
| 2131 | osd_free(t_buf); |
| 2130 | 2132 | return FALSE; |
| 2131 | 2133 | } |
| 2132 | 2134 | |
| 2133 | 2135 | _stprintf (path, TEXT("%s\\*.*"), t_ctrldir); |
| 2134 | 2136 | |
| 2135 | | global_free(t_ctrldir); |
| 2137 | osd_free(t_ctrldir); |
| 2136 | 2138 | |
| 2137 | 2139 | hFind = FindFirstFile(path, &FindFileData); |
| 2138 | 2140 | |
| r7939 | r7940 | |
| 2172 | 2174 | (void)ComboBox_SetCurSel(control, selected); |
| 2173 | 2175 | |
| 2174 | 2176 | if( t_buf ) |
| 2175 | | global_free(t_buf); |
| 2177 | osd_free(t_buf); |
| 2176 | 2178 | |
| 2177 | 2179 | return FALSE; |
| 2178 | 2180 | } |
| r7939 | r7940 | |
| 2296 | 2298 | } |
| 2297 | 2299 | } |
| 2298 | 2300 | } |
| 2299 | | global_free(t_screen); |
| 2301 | osd_free(t_screen); |
| 2300 | 2302 | |
| 2301 | 2303 | (void)ComboBox_SetCurSel(sizes_control, sizes_selection); |
| 2302 | 2304 | (void)ComboBox_SetCurSel(refresh_control, refresh_selection); |
| r7939 | r7940 | |
| 2940 | 2942 | return; |
| 2941 | 2943 | (void)ComboBox_InsertString(hCtrl, i, win_tstring_strdup(t_s)); |
| 2942 | 2944 | (void)ComboBox_SetItemData( hCtrl, i++, biosname); |
| 2943 | | global_free(t_s); |
| 2945 | osd_free(t_s); |
| 2944 | 2946 | } |
| 2945 | 2947 | } |
| 2946 | 2948 | } |
| r7939 | r7940 | |
| 2969 | 2971 | return; |
| 2970 | 2972 | (void)ComboBox_InsertString(hCtrl, i, win_tstring_strdup(t_s)); |
| 2971 | 2973 | (void)ComboBox_SetItemData( hCtrl, i++, biosname); |
| 2972 | | global_free(t_s); |
| 2974 | osd_free(t_s); |
| 2973 | 2975 | } |
| 2974 | 2976 | } |
| 2975 | 2977 | } |
src/mess/osd/winui/messui.c
| r7939 | r7940 | |
| 718 | 718 | t_filter[i] = (t_buffer[i] != '|') ? t_buffer[i] : '\0'; |
| 719 | 719 | t_filter[i++] = '\0'; |
| 720 | 720 | t_filter[i++] = '\0'; |
| 721 | | global_free(t_buffer); |
| 721 | osd_free(t_buffer); |
| 722 | 722 | |
| 723 | 723 | of.lStructSize = sizeof(of); |
| 724 | 724 | of.hwndOwner = GetMainWindow(); |
| r7939 | r7940 | |
| 847 | 847 | return; |
| 848 | 848 | // TODO - this should go against InternalSetSelectedSoftware() |
| 849 | 849 | SoftwarePicker_AddFile(GetDlgItem(GetMainWindow(), IDC_SWLIST), utf8_filename); |
| 850 | | global_free(utf8_filename); |
| 850 | osd_free(utf8_filename); |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | machine_config_free(config); |
| r7939 | r7940 | |
| 899 | 899 | /* We only want the first path; throw out the rest */ |
| 900 | 900 | i = astring_chr(&as, 0, ';'); |
| 901 | 901 | if (i > 0) astring_substr(&as, 0, i); |
| 902 | | global_free(t_s); |
| 902 | osd_free(t_s); |
| 903 | 903 | t_s = tstring_from_utf8(astring_c(&as)); |
| 904 | 904 | |
| 905 | 905 | /* Make sure a folder was specified in the tab, and that it exists */ |
| r7939 | r7940 | |
| 911 | 911 | /* We only want the first path; throw out the rest */ |
| 912 | 912 | i = astring_chr(&as, 0, ';'); |
| 913 | 913 | if (i > 0) astring_substr(&as, 0, i); |
| 914 | | global_free(t_s); |
| 914 | osd_free(t_s); |
| 915 | 915 | t_s = tstring_from_utf8(astring_c(&as)); |
| 916 | 916 | |
| 917 | 917 | /* Make sure a folder was specified in the tab, and that it exists */ |
| r7939 | r7940 | |
| 921 | 921 | |
| 922 | 922 | osd_get_full_path(&dst,"."); |
| 923 | 923 | /* Default to emu directory */ |
| 924 | | global_free(t_s); |
| 924 | osd_free(t_s); |
| 925 | 925 | t_s = tstring_from_utf8(dst); |
| 926 | 926 | |
| 927 | 927 | /* If software folder exists, use it instead */ |
| 928 | 928 | zippath_combine(&as, dst, "software"); |
| 929 | 929 | if (osd_opendir(astring_c(&as))) |
| 930 | 930 | { |
| 931 | | global_free(t_s); |
| 931 | osd_free(t_s); |
| 932 | 932 | t_s = tstring_from_utf8(astring_c(&as)); |
| 933 | 933 | } |
| 934 | | global_free(dst); |
| 934 | osd_free(dst); |
| 935 | 935 | } |
| 936 | 936 | } |
| 937 | 937 | } |
| r7939 | r7940 | |
| 940 | 940 | bResult = CommonFileImageDialog(t_s, GetOpenFileName, pszFilename, config, imagetypes); |
| 941 | 941 | CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes)); |
| 942 | 942 | |
| 943 | | global_free(t_s); |
| 943 | osd_free(t_s); |
| 944 | 944 | |
| 945 | 945 | return bResult; |
| 946 | 946 | } |
| r7939 | r7940 | |
| 982 | 982 | /* We only want the first path; throw out the rest */ |
| 983 | 983 | i = astring_chr(&as, 0, ';'); |
| 984 | 984 | if (i > 0) astring_substr(&as, 0, i); |
| 985 | | global_free(t_s); |
| 985 | osd_free(t_s); |
| 986 | 986 | t_s = tstring_from_utf8(astring_c(&as)); |
| 987 | 987 | |
| 988 | 988 | /* Make sure a folder was specified in the tab, and that it exists */ |
| r7939 | r7940 | |
| 992 | 992 | |
| 993 | 993 | osd_get_full_path(&dst,"."); |
| 994 | 994 | /* Default to emu directory */ |
| 995 | | global_free(t_s); |
| 995 | osd_free(t_s); |
| 996 | 996 | t_s = tstring_from_utf8(dst); |
| 997 | 997 | |
| 998 | 998 | /* If software folder exists, use it instead */ |
| 999 | 999 | zippath_combine(&as, dst, "software"); |
| 1000 | 1000 | if (osd_opendir(astring_c(&as))) |
| 1001 | 1001 | { |
| 1002 | | global_free(t_s); |
| 1002 | osd_free(t_s); |
| 1003 | 1003 | t_s = tstring_from_utf8(astring_c(&as)); |
| 1004 | 1004 | } |
| 1005 | | global_free(dst); |
| 1005 | osd_free(dst); |
| 1006 | 1006 | } |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| r7939 | r7940 | |
| 1010 | 1010 | bResult = CommonFileImageDialog(t_s, GetSaveFileName, pszFilename, config, imagetypes); |
| 1011 | 1011 | CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes)); |
| 1012 | 1012 | |
| 1013 | | global_free(t_s); |
| 1013 | osd_free(t_s); |
| 1014 | 1014 | |
| 1015 | 1015 | return bResult; |
| 1016 | 1016 | } |
| r7939 | r7940 | |
| 1025 | 1025 | return; |
| 1026 | 1026 | MessSpecifyImage(drvindex, dev, utf8_filename); |
| 1027 | 1027 | MessRefreshPicker(); |
| 1028 | | global_free(utf8_filename); |
| 1028 | osd_free(utf8_filename); |
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | |
| r7939 | r7940 | |
| 1042 | 1042 | return t_buffer; |
| 1043 | 1043 | |
| 1044 | 1044 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_s); |
| 1045 | | global_free(t_s); |
| 1045 | osd_free(t_s); |
| 1046 | 1046 | t_buffer = pszBuffer; |
| 1047 | 1047 | |
| 1048 | 1048 | return t_buffer; |
src/mess/osd/winui/softwarepicker.c
| r7939 | r7940 | |
| 617 | 617 | return FALSE; |
| 618 | 618 | |
| 619 | 619 | if (!strcmp(utf8_FileName, ".") || !strcmp(utf8_FileName, "..")) { |
| 620 | | global_free(utf8_FileName); |
| 620 | osd_free(utf8_FileName); |
| 621 | 621 | return TRUE; |
| 622 | 622 | } |
| 623 | 623 | |
| r7939 | r7940 | |
| 631 | 631 | else |
| 632 | 632 | rc = SoftwarePicker_InternalAddFile(hwndPicker, pszFilename, FALSE); |
| 633 | 633 | |
| 634 | | global_free(utf8_FileName); |
| 634 | osd_free(utf8_FileName); |
| 635 | 635 | return rc; |
| 636 | 636 | } |
| 637 | 637 | |
| r7939 | r7940 | |
| 752 | 752 | return s; |
| 753 | 753 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); |
| 754 | 754 | s = pszBuffer; |
| 755 | | global_free(t_buf); |
| 755 | osd_free(t_buf); |
| 756 | 756 | break; |
| 757 | 757 | |
| 758 | 758 | case MESS_COLUMN_GOODNAME: |
| r7939 | r7940 | |
| 783 | 783 | return s; |
| 784 | 784 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); |
| 785 | 785 | s = pszBuffer; |
| 786 | | global_free(t_buf); |
| 786 | osd_free(t_buf); |
| 787 | 787 | } |
| 788 | 788 | } |
| 789 | 789 | break; |
| r7939 | r7940 | |
| 804 | 804 | return s; |
| 805 | 805 | _sntprintf(pszBuffer, nBufferLength, TEXT("%s"), t_buf); |
| 806 | 806 | s = pszBuffer; |
| 807 | | global_free(t_buf); |
| 807 | osd_free(t_buf); |
| 808 | 808 | } |
| 809 | 809 | break; |
| 810 | 810 | } |
src/mess/osd/winui/propertiesms.c
| r7939 | r7940 | |
| 318 | 318 | { |
| 319 | 319 | driver_index = PropertiesCurrentGame(dialog); |
| 320 | 320 | SetExtraSoftwarePaths(driver_index, utf8_dir_list); |
| 321 | | global_free(utf8_dir_list); |
| 321 | osd_free(utf8_dir_list); |
| 322 | 322 | } |
| 323 | 323 | return TRUE; |
| 324 | 324 | } |
| r7939 | r7940 | |
| 381 | 381 | // finish up |
| 382 | 382 | AppendList(control, TEXT(DIRLIST_NEWENTRYTEXT), current_item); |
| 383 | 383 | ListView_SetItemState(control, 0, LVIS_SELECTED, LVIS_SELECTED); |
| 384 | | global_free(t_dir_list); |
| 384 | osd_free(t_dir_list); |
| 385 | 385 | return TRUE; |
| 386 | 386 | } |
| 387 | 387 | |
| r7939 | r7940 | |
| 435 | 435 | (void)ComboBox_InsertString(control, i, win_tstring_strdup(t_ramstring)); |
| 436 | 436 | (void)ComboBox_SetItemData(control, i, ram); |
| 437 | 437 | |
| 438 | | global_free(t_ramstring); |
| 438 | osd_free(t_ramstring); |
| 439 | 439 | } |
| 440 | 440 | if (config->extra_options != NULL) |
| 441 | 441 | { |
| r7939 | r7940 | |
| 465 | 465 | (void)ComboBox_InsertString(control, i, win_tstring_strdup(t_ramstring)); |
| 466 | 466 | (void)ComboBox_SetItemData(control, i, ram); |
| 467 | 467 | |
| 468 | | global_free(t_ramstring); |
| 468 | osd_free(t_ramstring); |
| 469 | 469 | |
| 470 | 470 | // is this the current option? record the index if so |
| 471 | 471 | if (ram == current_ram) |