MCPcopy Create free account
hub / github.com/WilliamLCobb/iNDS / ConstructScriptSaveDataPath

Function ConstructScriptSaveDataPath

desmume/src/lua-engine.cpp:585–600  ·  view source on GitHub ↗

fills output with the path also returns a pointer to the first character in the filename (non-directory) part of the path

Source from the content-addressed store, hash-verified

583// fills output with the path
584// also returns a pointer to the first character in the filename (non-directory) part of the path
585static char* ConstructScriptSaveDataPath(char* output, int bufferSize, LuaContextInfo& info)
586{
587// Get_State_File_Name(output); TODO
588 char* slash1 = strrchr(output, '\\');
589 char* slash2 = strrchr(output, '/');
590 if(slash1) slash1[1] = '\0';
591 if(slash2) slash2[1] = '\0';
592 char* rv = output + strlen(output);
593 strncat(output, "u.", bufferSize-(strlen(output)+1));
594 if(!info.dataSaveLoadKeySet)
595 strncat(output, FilenameFromPath(info.lastFilename.c_str()), bufferSize-(strlen(output)+1));
596 else
597 snprintf(output+strlen(output), bufferSize-(strlen(output)+1), "%X", info.dataSaveKey);
598 strncat(output, ".luasav", bufferSize-(strlen(output)+1));
599 return rv;
600}
601
602// emu.persistglobalvariables({
603// variable1 = defaultvalue1,

Callers 2

lua-engine.cppFile · 0.85
CallExitFunctionFunction · 0.85

Calls 2

FilenameFromPathFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected