MCPcopy Create free account
hub / github.com/cemu-project/Cemu / _RPLLoader_ExtractModuleNameFromPath

Function _RPLLoader_ExtractModuleNameFromPath

src/Cafe/OS/RPL/rpl.cpp:1381–1410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1379}
1380
1381void _RPLLoader_ExtractModuleNameFromPath(char* output, std::string_view input)
1382{
1383 // scan to last '/'
1384 cemu_assert(!input.empty());
1385 size_t startIndex = input.size() - 1;
1386 while (startIndex > 0)
1387 {
1388 if (input[startIndex] == '/')
1389 {
1390 startIndex++;
1391 break;
1392 }
1393 startIndex--;
1394 }
1395 // cut off after '.'
1396 size_t endIndex = startIndex;
1397 while (endIndex < input.size())
1398 {
1399 if (input[endIndex] == '.')
1400 break;
1401 endIndex++;
1402 }
1403 size_t nameLen = endIndex - startIndex;
1404 cemu_assert(nameLen != 0);
1405 nameLen = std::min<size_t>(nameLen, RPL_MODULE_NAME_LENGTH-1);
1406 memcpy(output, input.data() + startIndex, nameLen);
1407 output[nameLen] = '\0';
1408 // convert to lower case
1409 std::for_each(output, output + nameLen, [](char& c) {c = _ansiToLower(c);});
1410}
1411
1412void RPLLoader_InitState()
1413{

Callers 6

RPLLoader_LoadFromMemoryFunction · 0.85
RPLLoader_AddDependencyFunction · 0.85
RPLLoader_HasDependencyFunction · 0.85

Calls 5

cemu_assertFunction · 0.85
_ansiToLowerFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected