Libretro: Removed Lua dependency

This commit is contained in:
Sour 2018-01-05 15:37:49 -05:00
parent 7a93a3d9c8
commit 1ac82641b8
7 changed files with 50 additions and 62 deletions

View file

@ -1,7 +1,10 @@
#include "stdafx.h"
#include "ScriptHost.h"
#include "ScriptingContext.h"
#ifndef LIBRETRO
#include "LuaScriptingContext.h"
#endif
ScriptHost::ScriptHost(int scriptId)
{
@ -21,11 +24,15 @@ const char* ScriptHost::GetLog()
bool ScriptHost::LoadScript(string scriptName, string scriptContent, Debugger* debugger)
{
#ifndef LIBRETRO
_context.reset(new LuaScriptingContext());
if(!_context->LoadScript(scriptName, scriptContent, debugger)) {
return false;
}
return true;
#else
return false;
#endif
}
void ScriptHost::ProcessCpuOperation(uint16_t addr, uint8_t &value, MemoryOperationType type)

View file

@ -1,40 +1,7 @@
#pragma once
#if _WIN32 || _WIN64
#if _WIN64
#define ENVIRONMENT64
#else
#define ENVIRONMENT32
#endif
#endif
#if __GNUC__
#if __x86_64__ || __ppc64__
#define ENVIRONMENT64
#else
#define ENVIRONMENT32
#endif
#endif
#ifdef _DEBUG
#define MESEN_LIBRARY_DEBUG_SUFFIX "Debug"
#else
#define MESEN_LIBRARY_DEBUG_SUFFIX "Release"
#endif
#ifdef ENVIRONMENT32
#define MESEN_LIBRARY_SUFFIX "x86.lib"
#else
#define MESEN_LIBRARY_SUFFIX "x64.lib"
#endif
#if _WIN32 || _WIN64
#pragma comment(lib, "Core.lib")
#pragma comment(lib, "Utilities.lib")
#pragma comment(lib, "SevenZip.lib")
#pragma comment(lib, "Lua.lib")
#define DllExport __declspec(dllexport)
#else
#define __stdcall
#define DllExport __attribute__((visibility("default")))
#endif

View file

@ -67,9 +67,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProjectSection
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
@ -346,9 +343,7 @@ Global
{B609E0A0-5050-4871-91D6-E760633BCDD1}.Debug|x86.Build.0 = Debug|Win32
{B609E0A0-5050-4871-91D6-E760633BCDD1}.Libretro|Any CPU.ActiveCfg = Libretro|Win32
{B609E0A0-5050-4871-91D6-E760633BCDD1}.Libretro|x64.ActiveCfg = Libretro|x64
{B609E0A0-5050-4871-91D6-E760633BCDD1}.Libretro|x64.Build.0 = Libretro|x64
{B609E0A0-5050-4871-91D6-E760633BCDD1}.Libretro|x86.ActiveCfg = Libretro|Win32
{B609E0A0-5050-4871-91D6-E760633BCDD1}.Libretro|x86.Build.0 = Libretro|Win32
{B609E0A0-5050-4871-91D6-E760633BCDD1}.PGO Optimize|Any CPU.ActiveCfg = PGO Optimize|Win32
{B609E0A0-5050-4871-91D6-E760633BCDD1}.PGO Optimize|x64.ActiveCfg = PGO Optimize|x64
{B609E0A0-5050-4871-91D6-E760633BCDD1}.PGO Optimize|x64.Build.0 = PGO Optimize|x64
@ -366,9 +361,7 @@ Global
{B609E0A0-5050-4871-91D6-E760633BCDD1}.Release|x86.Build.0 = Release|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Debug|Any CPU.ActiveCfg = Debug|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Debug|x64.ActiveCfg = Debug|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Debug|x64.Build.0 = Debug|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Debug|x86.ActiveCfg = Debug|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Debug|x86.Build.0 = Debug|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Libretro|Any CPU.ActiveCfg = Libretro|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Libretro|x64.ActiveCfg = Libretro|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Libretro|x64.Build.0 = Libretro|x64
@ -377,20 +370,14 @@ Global
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Optimize|Any CPU.ActiveCfg = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Optimize|Any CPU.Build.0 = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Optimize|x64.ActiveCfg = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Optimize|x64.Build.0 = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Optimize|x86.ActiveCfg = Release|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Optimize|x86.Build.0 = Release|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Profile|Any CPU.ActiveCfg = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Profile|Any CPU.Build.0 = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Profile|x64.ActiveCfg = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Profile|x64.Build.0 = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Profile|x86.ActiveCfg = Release|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.PGO Profile|x86.Build.0 = Release|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Release|Any CPU.ActiveCfg = Release|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Release|x64.ActiveCfg = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Release|x64.Build.0 = Release|x64
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Release|x86.ActiveCfg = Release|Win32
{4432139E-528B-44DE-961C-B37CD5E92E0E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -398,4 +385,7 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {26BA923A-ECE6-4040-8BA4-C9B43DE004B4}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal

View file

@ -1,7 +1,7 @@
#include "stdafx.h"
#include "PlatformUtilities.h"
#ifdef _WIN32
#if !defined(LIBRETRO) && defined(_WIN32)
#include <Windows.h>
#endif
@ -9,14 +9,14 @@ void PlatformUtilities::DisableScreensaver()
{
//Prevent screensaver/etc from starting while using the emulator
//DirectInput devices apparently do not always count as user input
#ifdef _WIN32
#if !defined(LIBRETRO) && defined(_WIN32)
SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_CONTINUOUS);
#endif // WIN32
#endif
}
void PlatformUtilities::EnableScreensaver()
{
#ifdef _WIN32
#if !defined(LIBRETRO) && defined(_WIN32)
SetThreadExecutionState(ES_CONTINUOUS);
#endif // WIN32
#endif
}

View file

@ -5,6 +5,7 @@
class Socket
{
private:
#ifndef LIBRETRO
#ifdef _WIN32
bool _cleanupWSA = false;
#endif
@ -14,6 +15,7 @@ private:
char* _sendBuffer;
int _bufferPosition;
int32_t _UPnPPort = -1;
#endif
public:
Socket();

View file

@ -1,15 +1,12 @@
#include "stdafx.h"
#include "Timer.h"
#ifndef LIBRETRO
#include <thread>
#ifdef _WIN32
#include <Windows.h>
#else
#include <time.h>
#endif
#include "Timer.h"
#ifdef _WIN32
#include <Windows.h>
Timer::Timer()
{
@ -38,7 +35,8 @@ double Timer::GetElapsedMS()
return double(li.QuadPart - _start) / _frequency;
}
#else
#else
#include <time.h>
Timer::Timer()
{
@ -73,4 +71,27 @@ void Timer::WaitUntil(double targetMillisecond)
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>((int)(targetMillisecond - elapsedTime)));
}
}
}
}
#else
//This is not used by Libretro port, remove its dependencies
Timer::Timer()
{
}
void Timer::Reset()
{
}
double Timer::GetElapsedMS()
{
return 0.0;
}
void Timer::WaitUntil(double targetMillisecond)
{
}
#endif

View file

@ -4,11 +4,12 @@
class Timer
{
private:
#ifndef LIBRETRO
#ifdef WIN32
double _frequency = 0.0;
#endif
uint64_t _start;
#endif
public:
Timer();
void Reset();