Add narrow target hooks for early startup handling and plugin lookup.
Unix needs these integration points for Qt startup commands and local
plugin discovery without embedding Unix paths in common code.
#include "uae/api.h"
#include "uae/dlopen.h"
#include "uae/log.h"
+#include "target_dlopen.h"
#ifdef _WIN32
#include "windows.h"
_tcscat(path, LT_MODULE_EXT);
UAE_DLHANDLE handle = WIN32_LoadLibrary(path);
#else
- TCHAR path[MAX_DPATH];
- _tcscpy(path, name);
+ TCHAR path[MAX_DPATH] = { 0 };
+ UAE_DLHANDLE handle;
+ if (!target_dlopen_plugin(name, path, MAX_DPATH, &handle)) {
+ _tcscpy(path, name);
#ifdef _WIN64
- _tcscat(path, _T("_x64"));
+ _tcscat(path, _T("_x64"));
#endif
- _tcscat(path, LT_MODULE_EXT);
- UAE_DLHANDLE handle = uae_dlopen(path);
+ _tcscat(path, LT_MODULE_EXT);
+ handle = uae_dlopen(path);
+ }
#endif
if (handle) {
write_log(_T("DLOPEN: Loaded plugin %s\n"), path);
--- /dev/null
+#ifndef UAE_TARGET_DLOPEN_H
+#define UAE_TARGET_DLOPEN_H
+
+static inline bool target_dlopen_plugin(const TCHAR *, TCHAR *, size_t,
+ UAE_DLHANDLE *)
+{
+ return false;
+}
+
+#endif /* UAE_TARGET_DLOPEN_H */
--- /dev/null
+#ifndef UAE_TARGET_MAIN_H
+#define UAE_TARGET_MAIN_H
+
+static inline void target_main_set_args(int, TCHAR **)
+{
+}
+
+static inline int target_main_handle_early(int, TCHAR **)
+{
+ return -1;
+}
+
+#endif /* UAE_TARGET_MAIN_H */
#include "inputdevice.h"
#include "keybuf.h"
#include "gui.h"
+#include "target_main.h"
#include "zfile.h"
#include "autoconf.h"
#include "native2amiga.h"
#ifndef NO_MAIN_IN_MAIN_C
int main (int argc, TCHAR **argv)
{
+ target_main_set_args(argc, argv);
+ const int early_exit = target_main_handle_early(argc, argv);
+ if (early_exit >= 0)
+ return early_exit;
real_main (argc, argv);
return 0;
}