RMG-Core: add CoreSetInitialVideoSize()

This commit is contained in:
Rosalie Wanders
2026-01-13 15:20:49 +01:00
parent 0597a71a03
commit 402870048b
5 changed files with 28 additions and 0 deletions
+11
View File
@@ -511,6 +511,17 @@ CORE_EXPORT bool CorePluginsOpenROMConfig(CorePluginType type, void* parent, std
return open_plugin_config(type, parent, true, file);
}
CORE_EXPORT void CoreSetInitialVideoSize(int width, int height)
{
m64p::PluginApi& plugin = get_plugin(CorePluginType::Gfx);
if (!plugin.IsHooked() || plugin.SetInitialVideoSize == nullptr)
{
return;
}
plugin.SetInitialVideoSize(width, height);
}
CORE_EXPORT bool CoreAttachPlugins(void)
{
std::string error;
+3
View File
@@ -62,6 +62,9 @@ bool CorePluginsHasROMConfig(CorePluginType type);
// used plugin of given type
bool CorePluginsOpenROMConfig(CorePluginType type, void* parent = nullptr, std::filesystem::path file = "");
// sets initial video size for the video plugin
void CoreSetInitialVideoSize(int width, int height);
// attaches all used plugins
bool CoreAttachPlugins(void);
+2
View File
@@ -29,6 +29,7 @@ bool PluginApi::Hook(m64p_dynlib_handle handle)
HOOK_FUNC(handle, Plugin, Shutdown);
HOOK_FUNC_OPT(handle, Plugin, Config);
HOOK_FUNC_OPT(handle, Plugin, ConfigWithRomConfig);
HOOK_FUNC_OPT(handle, , SetInitialVideoSize);
HOOK_FUNC(handle, Plugin, GetVersion);
this->handle = handle;
@@ -42,6 +43,7 @@ bool PluginApi::Unhook(void)
UNHOOK_FUNC(Plugin, Shutdown);
UNHOOK_FUNC(Plugin, Config);
UNHOOK_FUNC(Plugin, ConfigWithRomConfig);
UNHOOK_FUNC(Plugin, SetInitialVideoSize);
UNHOOK_FUNC(Plugin, GetVersion);
this->handle = nullptr;
+1
View File
@@ -37,6 +37,7 @@ class PluginApi
ptr_PluginShutdown Shutdown;
ptr_PluginConfig Config;
ptr_PluginConfigWithRomConfig ConfigWithRomConfig;
ptr_SetInitialVideoSize SetInitialVideoSize;
ptr_PluginGetVersion GetVersion;
private:
+11
View File
@@ -39,6 +39,17 @@ typedef m64p_error (*ptr_PluginConfigWithRomConfig)(void*, int, CoreRomHeader*,
EXPORT m64p_error CALL PluginConfigWithRomConfig(void*, int, CoreRomHeader*, CoreRomSettings*);
#endif
/* SetInitialVideoSize(int width, int height)
*
* This optional function allows a front-end to set the initial video
* size for a video plugin.
*
*/
typedef void (*ptr_SetInitialVideoSize)(int width, int height);
#if defined(M64P_PLUGIN_PROTOTYPES) || defined(M64P_CORE_PROTOTYPES)
EXPORT void CALL SetInitialVideoSize(int width, int height);
#endif
#endif // __cplusplus
#ifdef __cplusplus