Merge pull request #987 from cxd4/settings
[Settings] Get it building on non-Windows platforms.
This commit is contained in:
commit
a43449ea0e
|
@ -0,0 +1,29 @@
|
|||
src=./../../Settings
|
||||
obj=./Settings
|
||||
|
||||
mkdir -p $obj
|
||||
|
||||
FLAGS_x86="\
|
||||
-S \
|
||||
-fPIC \
|
||||
-I$src/.. \
|
||||
-masm=intel \
|
||||
-march=native \
|
||||
-Os"
|
||||
|
||||
C_FLAGS=$FLAGS_x86
|
||||
|
||||
CC=g++
|
||||
AS=as
|
||||
|
||||
echo Compiling settings library sources for Project64...
|
||||
$CC -o $obj/Settings.asm $src/Settings.cpp $C_FLAGS
|
||||
|
||||
echo Assembling settings library sources...
|
||||
$AS -o $obj/Settings.o $obj/Settings.asm
|
||||
|
||||
OBJ_LIST="\
|
||||
$obj/Settings.o"
|
||||
|
||||
echo Linking static library objects for Settings...
|
||||
ar rcs $obj/libsettings.a $OBJ_LIST
|
|
@ -1,5 +1,8 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Common/stdtypes.h>
|
||||
#include <Common/Platform.h>
|
||||
#include "Settings.h"
|
||||
|
||||
enum SettingLocation {
|
||||
|
@ -24,7 +27,7 @@ enum SettingDataType {
|
|||
};
|
||||
|
||||
typedef struct {
|
||||
DWORD dwSize;
|
||||
uint32_t dwSize;
|
||||
int DefaultStartRange;
|
||||
int SettingStartRange;
|
||||
int MaximumSettings;
|
||||
|
@ -35,9 +38,9 @@ typedef struct {
|
|||
const char * (*GetSettingSz) ( void * handle, int ID, char * Buffer, int BufferLen );
|
||||
void (*SetSetting) ( void * handle, int ID, unsigned int Value );
|
||||
void (*SetSettingSz) ( void * handle, int ID, const char * Value );
|
||||
void (*RegisterSetting) ( void * handle, int ID, int DefaultID, SettingDataType Type,
|
||||
SettingLocation Location, const char * Category, const char * DefaultStr, DWORD Value );
|
||||
void (*UseUnregisteredSetting) (int ID);
|
||||
void (*RegisterSetting) (void * handle, int ID, int DefaultID, SettingDataType Type,
|
||||
SettingLocation Location, const char * Category, const char * DefaultStr, uint32_t Value);
|
||||
void (*UseUnregisteredSetting) (int ID);
|
||||
} PLUGIN_SETTINGS;
|
||||
|
||||
typedef struct {
|
||||
|
@ -55,24 +58,24 @@ static bool g_PluginInitilized = false;
|
|||
static char g_PluginSettingName[300];
|
||||
|
||||
extern "C" {
|
||||
__declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info);
|
||||
__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info);
|
||||
__declspec(dllexport) void SetSettingInfo3 (PLUGIN_SETTINGS3 * info);
|
||||
EXPORT void SetSettingInfo (PLUGIN_SETTINGS * info);
|
||||
EXPORT void SetSettingInfo2 (PLUGIN_SETTINGS2 * info);
|
||||
EXPORT void SetSettingInfo3 (PLUGIN_SETTINGS3 * info);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info)
|
||||
EXPORT void SetSettingInfo (PLUGIN_SETTINGS * info)
|
||||
{
|
||||
g_PluginSettings = *info;
|
||||
g_PluginInitilized = true;
|
||||
info->UseUnregisteredSetting = UseUnregisteredSetting;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info)
|
||||
EXPORT void SetSettingInfo2 (PLUGIN_SETTINGS2 * info)
|
||||
{
|
||||
g_PluginSettings2 = *info;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void SetSettingInfo3 (PLUGIN_SETTINGS3 * info)
|
||||
EXPORT void SetSettingInfo3 (PLUGIN_SETTINGS3 * info)
|
||||
{
|
||||
g_PluginSettings3 = *info;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
// Get Plugin Settings, take a setting id
|
||||
unsigned int GetSetting ( short SettingID );
|
||||
const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen );
|
||||
|
|
Loading…
Reference in New Issue