mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2025-01-11 19:39:09 +01:00
-added a new plugin argument, {name_no_ext}, it will get replaced by
the filename, just without its extension (issue 186)
This commit is contained in:
parent
acc37518f7
commit
9c27995a50
@ -823,6 +823,7 @@ void CMenu::_launch(const dir_discHdr *hdr)
|
||||
u8 plugin_dol_len = strlen(plugin_dol_name);
|
||||
char title[101];
|
||||
memset(&title, 0, sizeof(title));
|
||||
u32 title_len_no_ext = 0;
|
||||
const char *path = NULL;
|
||||
if(strchr(launchHdr.path, ':') != NULL)
|
||||
{
|
||||
@ -833,6 +834,8 @@ void CMenu::_launch(const dir_discHdr *hdr)
|
||||
return;
|
||||
}
|
||||
strncpy(title, strrchr(launchHdr.path, '/') + 1, 100);
|
||||
if(strchr(launchHdr.path, '.') != NULL)
|
||||
title_len_no_ext = strlen(title) - strlen(strrchr(title, '.'));
|
||||
*strrchr(launchHdr.path, '/') = '\0';
|
||||
path = strchr(launchHdr.path, '/') + 1;
|
||||
}
|
||||
@ -845,7 +848,7 @@ void CMenu::_launch(const dir_discHdr *hdr)
|
||||
const char *device = (currentPartition == 0 ? "sd" : (DeviceHandle.GetFSType(currentPartition) == PART_FS_NTFS ? "ntfs" : "usb"));
|
||||
const char *loader = fmt("%s:/%s/WiiFlowLoader.dol", device, strchr(m_pluginsDir.c_str(), '/') + 1);
|
||||
|
||||
vector<string> arguments = m_plugin.CreateArgs(device, path, title, loader, launchHdr.settings[0]);
|
||||
vector<string> arguments = m_plugin.CreateArgs(device, path, title, loader, title_len_no_ext, launchHdr.settings[0]);
|
||||
const char *plugin_file = plugin_dol_name; /* try full path */
|
||||
if(strchr(plugin_file, ':') == NULL || !fsop_FileExist(plugin_file)) /* try universal plugin folder */
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ vector<dir_discHdr> Plugin::ParseScummvmINI(Config &ini, const char *Device, u32
|
||||
}
|
||||
|
||||
vector<string> Plugin::CreateArgs(const char *device, const char *path,
|
||||
const char *title, const char *loader, u32 magic)
|
||||
const char *title, const char *loader, u32 title_len_no_ext, u32 magic)
|
||||
{
|
||||
vector<string> args;
|
||||
Plugin_Pos = GetPluginPosition(magic);
|
||||
@ -244,6 +244,8 @@ vector<string> Plugin::CreateArgs(const char *device, const char *path,
|
||||
Argument.replace(Argument.find(PLUGIN_NAME), strlen(PLUGIN_NAME), title);
|
||||
if(Argument.find(PLUGIN_LDR) != string::npos)
|
||||
Argument.replace(Argument.find(PLUGIN_LDR), strlen(PLUGIN_LDR), loader);
|
||||
if(Argument.find(PLUGIN_NOEXT) != string::npos)
|
||||
Argument.replace(Argument.find(PLUGIN_NOEXT), strlen(PLUGIN_NOEXT), title, title_len_no_ext);
|
||||
args.push_back(Argument);
|
||||
}
|
||||
return args;
|
||||
|
@ -35,6 +35,7 @@ using namespace std;
|
||||
#define PLUGIN_DEV "{device}"
|
||||
#define PLUGIN_PATH "{path}"
|
||||
#define PLUGIN_NAME "{name}"
|
||||
#define PLUGIN_NOEXT "{name_no_ext}"
|
||||
#define PLUGIN_LDR "{loader}"
|
||||
|
||||
struct PluginOptions
|
||||
@ -65,7 +66,7 @@ public:
|
||||
void SetEnablePlugin(Config &cfg, u8 pos, u8 ForceMode = 0);
|
||||
const vector<bool> &GetEnabledPlugins(Config &cfg);
|
||||
vector<string> CreateArgs(const char *device, const char *path,
|
||||
const char *title, const char *loader, u32 magic);
|
||||
const char *title, const char *loader, u32 title_len_no_ext, u32 magic);
|
||||
void init(const string& m_pluginsDir);
|
||||
void Cleanup();
|
||||
void EndAdd();
|
||||
|
Loading…
x
Reference in New Issue
Block a user