mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Update uwp_main.cpp (#14239)
Added launch protocol arg 'forceExit' so a frontend can tell an already-running RetroArch UWP instance to quit.
This commit is contained in:
parent
6c38efb0ee
commit
b999eaa4c9
@ -405,17 +405,17 @@ void App::Uninitialize()
|
|||||||
|
|
||||||
void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
|
void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
|
||||||
{
|
{
|
||||||
|
int argc = NULL;
|
||||||
|
std::vector<char*> argv;
|
||||||
|
std::vector<std::string> argvTmp; //using std::string as temp buf instead of char* array to avoid manual char allocations
|
||||||
|
ParseProtocolArgs(args, &argc, &argv, &argvTmp);
|
||||||
|
|
||||||
//start only if not already initialized. If there is a game in progress, just return
|
//start only if not already initialized. If there is a game in progress, just return
|
||||||
if (m_initialized == true)
|
if (m_initialized == true)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int argc = NULL;
|
|
||||||
std::vector<char*> argv;
|
|
||||||
std::vector<std::string> argvTmp; //using std::string as temp buf instead of char* array to avoid manual char allocations
|
|
||||||
ParseProtocolArgs(args, &argc, &argv, &argvTmp);
|
|
||||||
|
|
||||||
int ret = rarch_main(argc, argv.data(), NULL);
|
int ret = rarch_main(argc, argv.data(), NULL);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
@ -705,7 +705,12 @@ void App::ParseProtocolArgs(Windows::ApplicationModel::Activation::IActivatedEve
|
|||||||
IWwwFormUrlDecoderEntry^ arg = query->GetAt(i);
|
IWwwFormUrlDecoderEntry^ arg = query->GetAt(i);
|
||||||
|
|
||||||
//parse RetroArch command line string
|
//parse RetroArch command line string
|
||||||
if (arg->Name == "cmd")
|
if (arg->Name == "forceExit")
|
||||||
|
{
|
||||||
|
//this allows a frotend to quit RetroArch, which in turn allows it to launch a different game.
|
||||||
|
CoreApplication::Exit();
|
||||||
|
}
|
||||||
|
else if (arg->Name == "cmd" && m_initalized == false)
|
||||||
{
|
{
|
||||||
std::wstring wsValue(arg->Value->ToString()->Data());
|
std::wstring wsValue(arg->Value->ToString()->Data());
|
||||||
std::string strValue(wsValue.begin(), wsValue.end());
|
std::string strValue(wsValue.begin(), wsValue.end());
|
||||||
@ -725,14 +730,17 @@ void App::ParseProtocolArgs(Windows::ApplicationModel::Activation::IActivatedEve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(*argc) = argvTmp->size();
|
if (m_initialized == false)
|
||||||
//convert to char* array compatible with argv
|
|
||||||
for (int i = 0; i < argvTmp->size(); i++)
|
|
||||||
{
|
{
|
||||||
argv->push_back((char*)(argvTmp->at(i)).c_str());
|
(*argc) = argvTmp->size();
|
||||||
|
//convert to char* array compatible with argv
|
||||||
|
for (int i = 0; i < argvTmp->size(); i++)
|
||||||
|
{
|
||||||
|
argv->push_back((char*)(argvTmp->at(i)).c_str());
|
||||||
|
}
|
||||||
|
argv->push_back(nullptr);
|
||||||
}
|
}
|
||||||
argv->push_back(nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement UWP equivalents of various win32_* functions */
|
/* Implement UWP equivalents of various win32_* functions */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user