From 03e31c441e990142702f7fafdb612d435e2b8cf2 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 19 Jun 2022 00:11:18 -0500 Subject: [PATCH] prepare for ins preview in system file picker --- CMakeLists.txt | 4 +- extern/nfd-modified/src/include/nfd.h | 9 ---- .../src/{nfd_cocoa.m => nfd_cocoa.mm} | 6 +++ .../src/{nfd_common.c => nfd_common.cpp} | 0 extern/nfd-modified/src/nfd_common.h | 8 --- .../src/{nfd_gtk.c => nfd_gtk.cpp} | 0 extern/nfd-modified/src/nfd_win.cpp | 1 + .../src/{nfd_zenity.c => nfd_zenity.cpp} | 0 papers/newIns.md | 49 +++++++++++++++++++ 9 files changed, 58 insertions(+), 19 deletions(-) rename extern/nfd-modified/src/{nfd_cocoa.m => nfd_cocoa.mm} (97%) rename extern/nfd-modified/src/{nfd_common.c => nfd_common.cpp} (100%) rename extern/nfd-modified/src/{nfd_gtk.c => nfd_gtk.cpp} (100%) rename extern/nfd-modified/src/{nfd_zenity.c => nfd_zenity.cpp} (100%) create mode 100644 papers/newIns.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c3c9040..c7c076a27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,7 +521,7 @@ src/gui/gui.cpp ) if (WIN32 OR APPLE) - list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_common.c) + list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_common.cpp) endif() if (WIN32) @@ -530,7 +530,7 @@ endif() if (APPLE) list(APPEND GUI_SOURCES src/gui/macstuff.m) - list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_cocoa.m) + list(APPEND GUI_SOURCES extern/nfd-modified/src/nfd_cocoa.mm) endif() if (NOT WIN32 AND NOT APPLE) diff --git a/extern/nfd-modified/src/include/nfd.h b/extern/nfd-modified/src/include/nfd.h index 74c92743f..c88e4c857 100644 --- a/extern/nfd-modified/src/include/nfd.h +++ b/extern/nfd-modified/src/include/nfd.h @@ -10,10 +10,6 @@ #ifndef _NFD_H #define _NFD_H -#ifdef __cplusplus -extern "C" { -#endif - #include /* denotes UTF-8 char */ @@ -66,9 +62,4 @@ nfdchar_t *NFD_PathSet_GetPath( const nfdpathset_t *pathSet, size_t index ); /* Free the pathSet */ void NFD_PathSet_Free( nfdpathset_t *pathSet ); - -#ifdef __cplusplus -} -#endif - #endif diff --git a/extern/nfd-modified/src/nfd_cocoa.m b/extern/nfd-modified/src/nfd_cocoa.mm similarity index 97% rename from extern/nfd-modified/src/nfd_cocoa.m rename to extern/nfd-modified/src/nfd_cocoa.mm index 776152d41..45beab902 100644 --- a/extern/nfd-modified/src/nfd_cocoa.m +++ b/extern/nfd-modified/src/nfd_cocoa.mm @@ -8,6 +8,12 @@ #include "nfd.h" #include "nfd_common.h" +// this language is a mess! +// who thought it was a good idea to combine Objective-C and C++ together +// when you could just have used C++ and call it a day!!! +// +// might as well make Objective-Ruswift++... + static NSArray *BuildAllowedFileTypes( const char *filterList ) { // Commas and semicolons are the same thing on this platform diff --git a/extern/nfd-modified/src/nfd_common.c b/extern/nfd-modified/src/nfd_common.cpp similarity index 100% rename from extern/nfd-modified/src/nfd_common.c rename to extern/nfd-modified/src/nfd_common.cpp diff --git a/extern/nfd-modified/src/nfd_common.h b/extern/nfd-modified/src/nfd_common.h index 1a9ab1625..a1dd74b51 100644 --- a/extern/nfd-modified/src/nfd_common.h +++ b/extern/nfd-modified/src/nfd_common.h @@ -14,10 +14,6 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - #define NFD_MAX_STRLEN 256 #define _NFD_UNUSED(x) ((void)x) @@ -30,10 +26,6 @@ void NFDi_SetError( const char *msg ); int NFDi_SafeStrncpy( char *dst, const char *src, size_t maxCopy ); int32_t NFDi_UTF8_Strlen( const nfdchar_t *str ); int NFDi_IsFilterSegmentChar( char ch ); - -#ifdef __cplusplus -} -#endif #endif diff --git a/extern/nfd-modified/src/nfd_gtk.c b/extern/nfd-modified/src/nfd_gtk.cpp similarity index 100% rename from extern/nfd-modified/src/nfd_gtk.c rename to extern/nfd-modified/src/nfd_gtk.cpp diff --git a/extern/nfd-modified/src/nfd_win.cpp b/extern/nfd-modified/src/nfd_win.cpp index 949da2b53..9ef6446b0 100644 --- a/extern/nfd-modified/src/nfd_win.cpp +++ b/extern/nfd-modified/src/nfd_win.cpp @@ -423,6 +423,7 @@ nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList, } // Show the dialog. + // TODO: pass the Furnace window here result = fileOpenDialog->Show(NULL); if ( SUCCEEDED(result) ) { diff --git a/extern/nfd-modified/src/nfd_zenity.c b/extern/nfd-modified/src/nfd_zenity.cpp similarity index 100% rename from extern/nfd-modified/src/nfd_zenity.c rename to extern/nfd-modified/src/nfd_zenity.cpp diff --git a/papers/newIns.md b/papers/newIns.md new file mode 100644 index 000000000..fcc5f966f --- /dev/null +++ b/papers/newIns.md @@ -0,0 +1,49 @@ +# possible new Furnace instrument format + +the main issue with Furnace instrument files is that they are too big, even if the instrument is nothing more than the FM setup... + +the aim of this new format is to greatly reduce the size of a resulting instrument. + +``` +size | description +-----|------------------------------------ + 6 | "FURINS" format magic + 2 | format version + 1 | instrument type + ??? | feature bits + 4 | instrument length (if wave/sample bits are on) +``` + +the "feature bits" field is a variable length bitfield. bit 7 in a byte indicates "read one more byte". + +the feature bits are: + +- 0: has wavetables +- 1: has samples +- 2: has name +- 3: FM data +- 4: FM data size (1: 2-op, 0: 4-op) +- 5: FM data includes OPL/OPZ data + - if off, only read an op until ssgEnv. + - if on, read everything else. +- 6: Game Boy data +- 7: (continue in next byte) +- 8: C64 data +- 9: Amiga data +- 10: standard data (macros) +- 11: operator macros +- 12: release points +- 13: op release points +- 14: extended op macros +- 15: (continue in next byte) +- 16: OPL drums mode data +- 17: Amiga sample map data +- 18: Namco 163 data +- 19: extra macros +- 20: FDS data +- 21: OPZ data +- 22: wavetable synth data +- 23: (continue in next byte) +- 24: additional macro modes +- 25: extra C64 data +- 26: MultiPCM data