Mercurial > repos > blastem
view nuklear_ui/filechooser_win.c @ 2468:0ca78837e4d2
Implement ext instruction in new 68K core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 24 Feb 2024 22:54:36 -0800 |
parents | 94cf5cc89227 |
children |
line wrap: on
line source
#include <windows.h> #include <stdint.h> uint8_t native_filechooser_available(void) { return 1; } char* native_filechooser_pick(const char *title, const char *start_directory) { char file_name[MAX_PATH] = ""; OPENFILENAMEA ofn = { .lStructSize = sizeof(ofn), .hwndOwner = NULL, //TODO: should probably get the HWND of the main window .lpstrFilter = "All Files\0*.*\0" "All Supported Types\0*.zip;*.bin;*.bin.gz;*.gen;*.gen.gz;*.md;*.md.gz;*.sms;*.sms.gz;*.gg;*.gg.gz;*.sg;*.sg.gz;*.cue;*.toc;*.flac;*.vgm;*.vgz;*.vgm.gz\0" "Genesis/MD\0.zip;*.bin;*.bin.gz;*.gen;*.gen*.gz;*.md;*.md.gz\0" "Sega/Mega CD\0*.cue;*.toc\0" "Sega 8-bit\0*.sms;*.sms.gz;*.gg;*.gg.gz;*.sg;*.sg.gz\0" "Audio/VGM\0*.flac;*.vgm;*.vgz;*.vgm.gz\0", .nFilterIndex = 2, .lpstrFile = file_name, .nMaxFile = sizeof(file_name), .lpstrInitialDir = start_directory, .lpstrTitle = title, .Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_LONGNAMES, }; char *ret = NULL; if (GetOpenFileNameA(&ofn)) { ret = strdup(file_name); } return ret; }