firmware: make lc_open_from_mem() optional

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit e6e56ceb51c385530194bc25a93ecf4c33ada433
Author: Aidan MacDonald <[email protected]>
Date:   Sun Jan 4 14:21:43 2026 +0000

    firmware: make lc_open_from_mem() optional
    
    Define HAVE_LC_OPEN_FROM_MEM if the target implements
    lc_open_from_mem(). Make HAVE_CODEC_BUFFERING depend
    on this feature.
    
    Change-Id: If5f70db58963dcdc33848b860c028841ac380ab2

diff --git a/firmware/export/config.h b/firmware/export/config.h
index 65bf9c164f..f9a2ca26ea 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -689,8 +689,12 @@ Lyre prototype 1 */
 # endif
 #endif
 
+#if CONFIG_BINFMT == BINFMT_ROCK
+# define HAVE_LC_OPEN_FROM_MEM
+#endif
+
 /* Codec buffering requires the ability to load code from RAM */
-#if CONFIG_PLATFORM & PLATFORM_NATIVE
+#if defined(HAVE_LC_OPEN_FROM_MEM)
 # define HAVE_CODEC_BUFFERING
 #endif
 
diff --git a/firmware/export/lc-dlopen.h b/firmware/export/lc-dlopen.h
index c92ffce4ce..ef3b88d2a0 100644
--- a/firmware/export/lc-dlopen.h
+++ b/firmware/export/lc-dlopen.h
@@ -27,15 +27,4 @@ void *lc_open(const char *filename, unsigned char *buf, size_t buf_size);
 void *lc_get_header(void *handle);
 void  lc_close(void *handle);
 
-#ifdef APPLICATION
-/* App doesn't simulate code loading from a buffer */
-static inline void * lc_open_from_mem(void *addr, size_t blob_size)
-{
-    return NULL;
-    (void)addr; (void)blob_size;
-}
-#else
-void *lc_open_from_mem(void* addr, size_t blob_size);
-#endif
-
 #endif /* __LC_DLOPEN_H__ */
diff --git a/firmware/export/lc-rock.h b/firmware/export/lc-rock.h
index bd4101cb03..43fd815f3a 100644
--- a/firmware/export/lc-rock.h
+++ b/firmware/export/lc-rock.h
@@ -25,6 +25,7 @@
 
 void *lc_open(const char *filename, unsigned char *buf, size_t buf_size);
 
+#if defined(HAVE_LC_OPEN_FROM_MEM)
 /* header is always at the beginning of the blob, and handle actually points
  * to the start of the blob (the header is there) */
 static inline void *lc_open_from_mem(void* addr, size_t blob_size)
@@ -34,6 +35,7 @@ static inline void *lc_open_from_mem(void* addr, size_t blob_size)
     commit_discard_idcache();
     return addr;
 }
+#endif /* HAVE_LC_OPEN_FROM_MEM */
 
 static inline void *lc_get_header(void *handle)
 {
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.