mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Added in first Scripting API
This commit is contained in:
parent
c0440df288
commit
fec99844cb
@ -512,6 +512,11 @@ add_library(core
|
|||||||
PowerPC/SignatureDB/MEGASignatureDB.h
|
PowerPC/SignatureDB/MEGASignatureDB.h
|
||||||
PowerPC/SignatureDB/SignatureDB.cpp
|
PowerPC/SignatureDB/SignatureDB.cpp
|
||||||
PowerPC/SignatureDB/SignatureDB.h
|
PowerPC/SignatureDB/SignatureDB.h
|
||||||
|
Scripting/CoreScriptInterface/InternalAPIs/FileUtility_APIs.h
|
||||||
|
Scripting/HelperClasses/InternalAPIDefinitions/FileUtility_API_Implementations.cpp
|
||||||
|
Scripting/HelperClasses/InternalAPIDefinitions/FileUtility_API_Implementations.h
|
||||||
|
Scripting/ScriptUtilities.cpp
|
||||||
|
Scripting/ScriptUtilities.h
|
||||||
State.cpp
|
State.cpp
|
||||||
State.h
|
State.h
|
||||||
SyncIdentifier.h
|
SyncIdentifier.h
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Scripting
|
||||||
|
{
|
||||||
|
|
||||||
|
// FileUtility_APIs contains the APIs for getting the user directory path and the system directory
|
||||||
|
// path for Dolphin.
|
||||||
|
typedef struct FileUtility_APIs
|
||||||
|
{
|
||||||
|
// Returns the user directory path for Dolphin.
|
||||||
|
const char* (*GetUserDirectoryPath)();
|
||||||
|
|
||||||
|
// Returns the system directory path for Dolphin.
|
||||||
|
const char* (*GetSystemDirectoryPath)();
|
||||||
|
|
||||||
|
} FileUtility_APIs;
|
||||||
|
|
||||||
|
} // namespace Scripting
|
@ -0,0 +1,31 @@
|
|||||||
|
#include "Core/Scripting/HelperClasses/InternalAPIDefinitions/FileUtility_API_Implementations.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "Common/FileUtil.h"
|
||||||
|
|
||||||
|
namespace Scripting::FileUtilityAPIsImpl
|
||||||
|
{
|
||||||
|
FileUtility_APIs fileUtility_APIs = {};
|
||||||
|
|
||||||
|
std::string user_directory_path;
|
||||||
|
std::string system_directory_path;
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
fileUtility_APIs.GetUserDirectoryPath = GetUserDirectoryPath_impl;
|
||||||
|
fileUtility_APIs.GetSystemDirectoryPath = GetSystemDirectoryPath_impl;
|
||||||
|
user_directory_path = File::GetUserPath(D_LOAD_IDX);
|
||||||
|
system_directory_path = File::GetSysDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* GetUserDirectoryPath_impl()
|
||||||
|
{
|
||||||
|
return user_directory_path.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* GetSystemDirectoryPath_impl()
|
||||||
|
{
|
||||||
|
return system_directory_path.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Scripting::FileUtilityAPIsImpl
|
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Core/Scripting/CoreScriptInterface/InternalAPIs/FileUtility_APIs.h"
|
||||||
|
|
||||||
|
// This file contains the implementations for the APIs in FileUtility_APIs
|
||||||
|
namespace Scripting::FileUtilityAPIsImpl
|
||||||
|
{
|
||||||
|
extern FileUtility_APIs fileUtility_APIs;
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
const char* GetUserDirectoryPath_impl();
|
||||||
|
const char* GetSystemDirectoryPath_impl();
|
||||||
|
|
||||||
|
} // namespace Scripting::FileUtilityAPIsImpl
|
19
Source/Core/Core/Scripting/ScriptUtilities.cpp
Normal file
19
Source/Core/Core/Scripting/ScriptUtilities.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "Core/Scripting/ScriptUtilities.h"
|
||||||
|
|
||||||
|
#include "Core/Scripting/HelperClasses/InternalAPIDefinitions/FileUtility_API_Implementations.h"
|
||||||
|
|
||||||
|
namespace Scripting
|
||||||
|
{
|
||||||
|
|
||||||
|
static bool is_scripting_core_initialized = false;
|
||||||
|
|
||||||
|
void InitScriptingCore()
|
||||||
|
{
|
||||||
|
if (!is_scripting_core_initialized)
|
||||||
|
{
|
||||||
|
FileUtilityAPIsImpl::Init();
|
||||||
|
is_scripting_core_initialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Scripting
|
8
Source/Core/Core/Scripting/ScriptUtilities.h
Normal file
8
Source/Core/Core/Scripting/ScriptUtilities.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Scripting
|
||||||
|
{
|
||||||
|
|
||||||
|
void InitScriptingCore();
|
||||||
|
|
||||||
|
} // namespace Scripting
|
@ -436,6 +436,9 @@
|
|||||||
<ClInclude Include="Core\PowerPC\SignatureDB\DSYSignatureDB.h" />
|
<ClInclude Include="Core\PowerPC\SignatureDB\DSYSignatureDB.h" />
|
||||||
<ClInclude Include="Core\PowerPC\SignatureDB\MEGASignatureDB.h" />
|
<ClInclude Include="Core\PowerPC\SignatureDB\MEGASignatureDB.h" />
|
||||||
<ClInclude Include="Core\PowerPC\SignatureDB\SignatureDB.h" />
|
<ClInclude Include="Core\PowerPC\SignatureDB\SignatureDB.h" />
|
||||||
|
<ClInclude Include="Core\Scripting\CoreScriptInterface\InternalAPIs\FileUtility_APIs.h" />
|
||||||
|
<ClInclude Include="Core\Scripting\HelperClasses\InternalAPIDefinitions\FileUtility_API_Implementations.h" />
|
||||||
|
<ClInclude Include="Core\Scripting\ScriptUtilities.h" />
|
||||||
<ClInclude Include="Core\State.h" />
|
<ClInclude Include="Core\State.h" />
|
||||||
<ClInclude Include="Core\SyncIdentifier.h" />
|
<ClInclude Include="Core\SyncIdentifier.h" />
|
||||||
<ClInclude Include="Core\SysConf.h" />
|
<ClInclude Include="Core\SysConf.h" />
|
||||||
@ -1079,6 +1082,8 @@
|
|||||||
<ClCompile Include="Core\PowerPC\SignatureDB\DSYSignatureDB.cpp" />
|
<ClCompile Include="Core\PowerPC\SignatureDB\DSYSignatureDB.cpp" />
|
||||||
<ClCompile Include="Core\PowerPC\SignatureDB\MEGASignatureDB.cpp" />
|
<ClCompile Include="Core\PowerPC\SignatureDB\MEGASignatureDB.cpp" />
|
||||||
<ClCompile Include="Core\PowerPC\SignatureDB\SignatureDB.cpp" />
|
<ClCompile Include="Core\PowerPC\SignatureDB\SignatureDB.cpp" />
|
||||||
|
<ClCompile Include="Core\Scripting\HelperClasses\InternalAPIDefinitions\FileUtility_API_Implementations.cpp" />
|
||||||
|
<ClCompile Include="Core\Scripting\ScriptUtilities.cpp" />
|
||||||
<ClCompile Include="Core\State.cpp" />
|
<ClCompile Include="Core\State.cpp" />
|
||||||
<ClCompile Include="Core\SysConf.cpp" />
|
<ClCompile Include="Core\SysConf.cpp" />
|
||||||
<ClCompile Include="Core\System.cpp" />
|
<ClCompile Include="Core\System.cpp" />
|
||||||
|
Loading…
Reference in New Issue
Block a user