mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
nakee's work on dolphin events. Also get wxw out of logmanager. This commit wants your comments
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1875 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -38,7 +38,7 @@ and stopped.
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "DynamicLibrary.h"
|
||||
#include "../../../../Branches/MusicMod/Common/Src/Console.h"
|
||||
#include "../../../../Branches/MusicMod/Common/Src/Console.h"
|
||||
///////////////////////////////////
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ std::string GetLastErrorAsString()
|
||||
#ifdef _WIN32
|
||||
LPVOID lpMsgBuf = 0;
|
||||
DWORD error = GetLastError();
|
||||
FormatMessage(
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
error,
|
||||
@ -155,7 +155,7 @@ void* DynamicLibrary::Get(const char* funcname) const
|
||||
if (!retval)
|
||||
{
|
||||
LOG(MASTER_LOG, "Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
|
||||
//PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
|
||||
PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -237,7 +237,7 @@ bool Rename(const char *srcFilename, const char *destFilename)
|
||||
|
||||
bool Copy(const char *srcFilename, const char *destFilename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
return (CopyFile(srcFilename, destFilename, FALSE) == TRUE) ? true : false;
|
||||
#else
|
||||
|
||||
@ -259,7 +259,7 @@ bool Copy(const char *srcFilename, const char *destFilename)
|
||||
return false;
|
||||
}
|
||||
|
||||
while(! feof(input)) {
|
||||
while(! feof(input)) {
|
||||
if((rnum = fread(buffer, sizeof(char), BSIZE, input)) != BSIZE) {
|
||||
if(ferror(input) != 0){
|
||||
PanicAlert("can't read source file\n");
|
||||
@ -293,7 +293,7 @@ bool Copy(const char *srcFilename, const char *destFilename)
|
||||
std::string GetUserDirectory()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
|
||||
{
|
||||
//return std::string(path);
|
||||
@ -337,7 +337,7 @@ u64 GetSize(const char *filename)
|
||||
}
|
||||
int err = errno;
|
||||
PanicAlert("Error accessing %s: %s", filename, strerror(err));
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
|
||||
// Find the first file in the directory.
|
||||
DIR *dirp = opendir(_Directory.c_str());
|
||||
|
||||
|
||||
while (!readdir_r(dirp, &dirent, &result) && result) {
|
||||
FSTEntry entry;
|
||||
if (result->d_name[0]=='.') continue;
|
||||
@ -428,7 +428,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
parentEntry.children.push_back(entry);
|
||||
}
|
||||
closedir(dirp);
|
||||
|
||||
|
||||
return foundEntries;
|
||||
}
|
||||
#endif
|
||||
@ -494,29 +494,29 @@ error_jmp:
|
||||
return Result;
|
||||
#else
|
||||
// taken from http://www.dreamincode.net/code/snippet2700.htm
|
||||
DIR *pdir = NULL;
|
||||
DIR *pdir = NULL;
|
||||
pdir = opendir (_Directory.c_str());
|
||||
struct dirent *pent = NULL;
|
||||
|
||||
if (pdir == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (pdir == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char file[256];
|
||||
|
||||
int counter = 1;
|
||||
|
||||
while ((pent = readdir(pdir))) {
|
||||
while ((pent = readdir(pdir))) {
|
||||
if (counter > 2) {
|
||||
for (int i = 0; i < 256; i++) file[i] = '\0';
|
||||
strcat(file, _Directory.c_str());
|
||||
if (pent == NULL) {
|
||||
return false;
|
||||
}
|
||||
strcat(file, pent->d_name);
|
||||
if (pent == NULL) {
|
||||
return false;
|
||||
}
|
||||
strcat(file, pent->d_name);
|
||||
if (IsDirectory(file) == true) {
|
||||
DeleteDir(file);
|
||||
} else {
|
||||
} else {
|
||||
remove(file);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================================================
|
||||
// File description
|
||||
@ -24,79 +24,91 @@
|
||||
the config and debugging windows and works with all plugins. */
|
||||
// =============
|
||||
|
||||
|
||||
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
DynamicLibrary CPlugin::m_hInstLib;
|
||||
|
||||
void(__cdecl * CPlugin::m_GetDllInfo) (PLUGIN_INFO * _PluginInfo) = 0;
|
||||
void(__cdecl * CPlugin::m_DllConfig) (HWND _hParent) = 0;
|
||||
void(__cdecl * CPlugin::m_DllDebugger) (HWND _hParent, bool Show) = 0;
|
||||
void(__cdecl * CPlugin::m_SetDllGlobals) (PLUGIN_GLOBALS* _PluginGlobals) = 0;
|
||||
|
||||
void
|
||||
CPlugin::Release(void)
|
||||
{
|
||||
m_GetDllInfo = 0;
|
||||
m_DllConfig = 0;
|
||||
m_DllDebugger = 0;
|
||||
m_SetDllGlobals = 0;
|
||||
|
||||
m_hInstLib.Unload();
|
||||
CPlugin::~CPlugin() {
|
||||
m_hInstLib.Unload();
|
||||
}
|
||||
|
||||
bool
|
||||
CPlugin::Load(const char* _szName)
|
||||
{
|
||||
if (m_hInstLib.Load(_szName))
|
||||
{
|
||||
m_GetDllInfo = (void (__cdecl*)(PLUGIN_INFO*)) m_hInstLib.Get("GetDllInfo");
|
||||
m_DllConfig = (void (__cdecl*)(HWND)) m_hInstLib.Get("DllConfig");
|
||||
m_DllDebugger = (void (__cdecl*)(HWND, bool)) m_hInstLib.Get("DllDebugger");
|
||||
m_SetDllGlobals = (void (__cdecl*)(PLUGIN_GLOBALS*)) m_hInstLib.Get("SetDllGlobals");
|
||||
return(true);
|
||||
CPlugin::CPlugin(const char* _szName) : valid(false) {
|
||||
if (m_hInstLib.Load(_szName)) {
|
||||
|
||||
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
|
||||
(m_hInstLib.Get("GetDllInfo"));
|
||||
m_DllConfig = reinterpret_cast<TDllConfig>
|
||||
(m_hInstLib.Get("DllConfig"));
|
||||
m_DllDebugger = reinterpret_cast<TDllDebugger>
|
||||
(m_hInstLib.Get("DllDebugger"));
|
||||
m_SetDllGlobals = reinterpret_cast<TSetDllGlobals>
|
||||
(m_hInstLib.Get("SetDllGlobals"));
|
||||
m_Initialize = reinterpret_cast<TInitialize>
|
||||
(m_hInstLib.Get("Initialize"));
|
||||
m_Shutdown = reinterpret_cast<TShutdown>
|
||||
(m_hInstLib.Get("Shutdown"));
|
||||
m_DoState = reinterpret_cast<TDoState>
|
||||
(m_hInstLib.Get("DoState"));
|
||||
}
|
||||
|
||||
return(false);
|
||||
if (m_GetDllInfo != 0 &&
|
||||
m_DllConfig != 0 &&
|
||||
m_DllDebugger != 0 &&
|
||||
m_SetDllGlobals != 0 &&
|
||||
m_Initialize != 0 &&
|
||||
m_Shutdown != 0 &&
|
||||
m_DoState != 0)
|
||||
valid = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo)
|
||||
{
|
||||
if (m_GetDllInfo != 0)
|
||||
{
|
||||
m_GetDllInfo(&_pluginInfo);
|
||||
return(true);
|
||||
}
|
||||
|
||||
return(false);
|
||||
void *CPlugin::LoadSymbol(const char *sym) {
|
||||
return m_hInstLib.Get(sym);
|
||||
}
|
||||
|
||||
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) {
|
||||
if (m_GetDllInfo != 0) {
|
||||
m_GetDllInfo(&_pluginInfo);
|
||||
return(true);
|
||||
}
|
||||
|
||||
void CPlugin::Config(HWND _hwnd)
|
||||
{
|
||||
if (m_DllConfig != 0)
|
||||
{
|
||||
m_DllConfig(_hwnd);
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
void CPlugin::Debug(HWND _hwnd, bool Show)
|
||||
{
|
||||
if (m_DllDebugger != 0)
|
||||
{
|
||||
m_DllDebugger(_hwnd, Show);
|
||||
}
|
||||
|
||||
void CPlugin::Config(HWND _hwnd) {
|
||||
if (m_DllConfig != 0)
|
||||
m_DllConfig(_hwnd);
|
||||
|
||||
}
|
||||
|
||||
void CPlugin::SetGlobals(PLUGIN_GLOBALS& _pluginGlobals)
|
||||
{
|
||||
if (m_SetDllGlobals != 0)
|
||||
{
|
||||
m_SetDllGlobals(&_pluginGlobals);
|
||||
}
|
||||
void CPlugin::Debug(HWND _hwnd, bool Show) {
|
||||
if (m_DllDebugger != 0)
|
||||
m_DllDebugger(_hwnd, Show);
|
||||
|
||||
}
|
||||
|
||||
} // end of namespace Common
|
||||
void CPlugin::SetGlobals(PLUGIN_GLOBALS* _pluginGlobals) {
|
||||
if (m_SetDllGlobals != 0)
|
||||
m_SetDllGlobals(_pluginGlobals);
|
||||
|
||||
}
|
||||
|
||||
void CPlugin::DoState(unsigned char **ptr, int mode) {
|
||||
if (m_DoState != 0)
|
||||
m_DoState(ptr, mode);
|
||||
}
|
||||
|
||||
void CPlugin::Initialize(void *init) {
|
||||
if (m_Initialize != 0)
|
||||
m_Initialize(init);
|
||||
}
|
||||
|
||||
void CPlugin::Shutdown() {
|
||||
if (m_Shutdown != 0)
|
||||
m_Shutdown();
|
||||
}
|
||||
|
||||
} // end of namespace Common
|
@ -19,35 +19,52 @@
|
||||
#define _PLUGIN_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "../../../PluginSpecs/PluginSpecs.h"
|
||||
#include "PluginSpecs.h"
|
||||
#include "DynamicLibrary.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*);
|
||||
typedef void (__cdecl * TDllConfig)(HWND);
|
||||
typedef void (__cdecl * TDllDebugger)(HWND, bool);
|
||||
typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*);
|
||||
typedef void (__cdecl * TInitialize)(void *);
|
||||
typedef void (__cdecl * TShutdown)();
|
||||
typedef void (__cdecl * TDoState)(unsigned char**, int);
|
||||
|
||||
class CPlugin
|
||||
{
|
||||
public:
|
||||
|
||||
static void Release(void);
|
||||
static bool Load(const char* _szName);
|
||||
CPlugin(const char* _szName);
|
||||
~CPlugin();
|
||||
|
||||
static bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
||||
static void SetGlobals(PLUGIN_GLOBALS& _PluginGlobals);
|
||||
virtual bool IsValid() {return valid;};
|
||||
|
||||
static void Config(HWND _hwnd);
|
||||
static void About(HWND _hwnd);
|
||||
static void Debug(HWND _hwnd, bool Show);
|
||||
bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
||||
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
|
||||
void *LoadSymbol(const char *sym);
|
||||
|
||||
void Config(HWND _hwnd);
|
||||
void About(HWND _hwnd);
|
||||
void Debug(HWND _hwnd, bool Show);
|
||||
void DoState(unsigned char **ptr, int mode);
|
||||
void Initialize(void *init);
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
|
||||
static DynamicLibrary m_hInstLib;
|
||||
|
||||
static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo);
|
||||
static void (__cdecl * m_DllConfig)(HWND _hParent);
|
||||
static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show);
|
||||
static void (__cdecl * m_SetDllGlobals)(PLUGIN_GLOBALS* _PluginGlobals);
|
||||
DynamicLibrary m_hInstLib;
|
||||
bool valid;
|
||||
|
||||
// Functions
|
||||
TGetDllInfo m_GetDllInfo;
|
||||
TDllConfig m_DllConfig;
|
||||
TDllDebugger m_DllDebugger;
|
||||
TSetDllGlobals m_SetDllGlobals;
|
||||
TInitialize m_Initialize;
|
||||
TShutdown m_Shutdown;
|
||||
TDoState m_DoState;
|
||||
};
|
||||
} // end of namespace Common
|
||||
|
||||
|
36
Source/Core/Common/Src/PluginDSP.cpp
Normal file
36
Source/Core/Common/Src/PluginDSP.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include "PluginDSP.h"
|
||||
|
||||
namespace Common {
|
||||
PluginDSP::PluginDSP(const char *_Filename) : CPlugin(_Filename), validDSP(false) {
|
||||
|
||||
DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox>
|
||||
(LoadSymbol("DSP_ReadMailboxHigh"));
|
||||
DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox>
|
||||
(LoadSymbol("DSP_ReadMailboxLow"));
|
||||
DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox>
|
||||
(LoadSymbol("DSP_WriteMailboxHigh"));
|
||||
DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox>
|
||||
(LoadSymbol("DSP_WriteMailboxLow"));
|
||||
DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister>
|
||||
(LoadSymbol("DSP_ReadControlRegister"));
|
||||
DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister>
|
||||
(LoadSymbol("DSP_WriteControlRegister"));
|
||||
DSP_Update = reinterpret_cast<TDSP_Update>
|
||||
(LoadSymbol("DSP_Update"));
|
||||
DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer>
|
||||
(LoadSymbol("DSP_SendAIBuffer"));
|
||||
|
||||
if ((DSP_ReadMailboxHigh != 0) &&
|
||||
(DSP_ReadMailboxLow != 0) &&
|
||||
(DSP_WriteMailboxHigh != 0) &&
|
||||
(DSP_WriteMailboxLow != 0) &&
|
||||
(DSP_ReadControlRegister != 0) &&
|
||||
(DSP_WriteControlRegister != 0) &&
|
||||
(DSP_SendAIBuffer != 0) &&
|
||||
(DSP_Update != 0))
|
||||
validDSP = true;
|
||||
}
|
||||
|
||||
PluginDSP::~PluginDSP() {
|
||||
}
|
||||
}
|
37
Source/Core/Common/Src/PluginDSP.h
Normal file
37
Source/Core/Common/Src/PluginDSP.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef _PLUGINDSP_H
|
||||
#define _PLUGINDSP_H
|
||||
|
||||
#include "pluginspecs_dsp.h"
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace Common {
|
||||
typedef void (__cdecl* TDSP_WriteMailBox)(bool _CPUMailbox, unsigned short);
|
||||
typedef unsigned short (__cdecl* TDSP_ReadMailBox)(bool _CPUMailbox);
|
||||
typedef unsigned short (__cdecl* TDSP_ReadControlRegister)();
|
||||
typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
|
||||
typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate);
|
||||
typedef void (__cdecl* TDSP_Update)(int cycles);
|
||||
|
||||
class PluginDSP : public CPlugin
|
||||
{
|
||||
public:
|
||||
PluginDSP(const char *_Filename);
|
||||
~PluginDSP();
|
||||
virtual bool IsValid() {return validDSP;};
|
||||
|
||||
TDSP_ReadMailBox DSP_ReadMailboxHigh;
|
||||
TDSP_ReadMailBox DSP_ReadMailboxLow;
|
||||
TDSP_WriteMailBox DSP_WriteMailboxHigh;
|
||||
TDSP_WriteMailBox DSP_WriteMailboxLow;
|
||||
TDSP_ReadControlRegister DSP_ReadControlRegister;
|
||||
TDSP_WriteControlRegister DSP_WriteControlRegister;
|
||||
TDSP_SendAIBuffer DSP_SendAIBuffer;
|
||||
TDSP_Update DSP_Update;
|
||||
|
||||
private:
|
||||
bool validDSP;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
24
Source/Core/Common/Src/PluginPAD.cpp
Normal file
24
Source/Core/Common/Src/PluginPAD.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "PluginPAD.h"
|
||||
|
||||
namespace Common {
|
||||
PluginPAD::PluginPAD(const char *_Filename) : CPlugin(_Filename), validPAD(false) {
|
||||
|
||||
PAD_GetStatus = reinterpret_cast<TPAD_GetStatus>
|
||||
(LoadSymbol("PAD_GetStatus"));
|
||||
PAD_Input = reinterpret_cast<TPAD_Input>
|
||||
(LoadSymbol("PAD_Input"));
|
||||
PAD_Rumble = reinterpret_cast<TPAD_Rumble>
|
||||
(LoadSymbol("PAD_Rumble"));
|
||||
PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>
|
||||
(LoadSymbol("PAD_GetAttachedPads"));
|
||||
|
||||
if ((PAD_GetStatus != 0) &&
|
||||
(PAD_Input != 0) &&
|
||||
(PAD_Rumble != 0) &&
|
||||
(PAD_GetAttachedPads != 0))
|
||||
validPAD = true;
|
||||
}
|
||||
|
||||
PluginPAD::~PluginPAD() {
|
||||
}
|
||||
}
|
30
Source/Core/Common/Src/PluginPAD.h
Normal file
30
Source/Core/Common/Src/PluginPAD.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef _PLUGINPAD_H
|
||||
#define _PLUGINPAD_H
|
||||
|
||||
#include "pluginspecs_pad.h"
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace Common {
|
||||
typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*);
|
||||
typedef void (__cdecl* TPAD_Input)(u8, u8);
|
||||
typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int);
|
||||
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
||||
|
||||
class PluginPAD : public CPlugin {
|
||||
public:
|
||||
PluginPAD(const char *_Filename);
|
||||
~PluginPAD();
|
||||
virtual bool IsValid() {return validPAD;};
|
||||
|
||||
TPAD_GetStatus PAD_GetStatus;
|
||||
TPAD_Input PAD_Input;
|
||||
TPAD_Rumble PAD_Rumble;
|
||||
TPAD_GetAttachedPads PAD_GetAttachedPads;
|
||||
|
||||
private:
|
||||
bool validPAD;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
33
Source/Core/Common/Src/PluginVideo.cpp
Normal file
33
Source/Core/Common/Src/PluginVideo.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "PluginVideo.h"
|
||||
|
||||
namespace Common {
|
||||
PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo(false) {
|
||||
|
||||
Video_Prepare = reinterpret_cast<TVideo_Prepare>
|
||||
(LoadSymbol("Video_Prepare"));
|
||||
Video_SendFifoData = reinterpret_cast<TVideo_SendFifoData>
|
||||
(LoadSymbol("Video_SendFifoData"));
|
||||
Video_UpdateXFB = reinterpret_cast<TVideo_UpdateXFB>
|
||||
(LoadSymbol("Video_UpdateXFB"));
|
||||
Video_Screenshot = reinterpret_cast<TVideo_Screenshot>
|
||||
(LoadSymbol("Video_Screenshot"));
|
||||
Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop>
|
||||
(LoadSymbol("Video_EnterLoop"));
|
||||
Video_AddMessage = reinterpret_cast<TVideo_AddMessage>
|
||||
(LoadSymbol("Video_AddMessage"));
|
||||
Video_Stop = reinterpret_cast<TVideo_Stop>
|
||||
(LoadSymbol("Video_Stop"));
|
||||
|
||||
if ((Video_Prepare != 0) &&
|
||||
(Video_SendFifoData != 0) &&
|
||||
(Video_UpdateXFB != 0) &&
|
||||
(Video_EnterLoop != 0) &&
|
||||
(Video_Screenshot != 0) &&
|
||||
(Video_AddMessage != 0) &&
|
||||
(Video_Stop != 0))
|
||||
validVideo = true;
|
||||
}
|
||||
|
||||
PluginVideo::~PluginVideo() {
|
||||
}
|
||||
}
|
36
Source/Core/Common/Src/PluginVideo.h
Normal file
36
Source/Core/Common/Src/PluginVideo.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef _PLUGINVIDEO_H
|
||||
#define _PLUGINVIDEO_H
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace Common {
|
||||
typedef void (__cdecl* TVideo_Prepare)();
|
||||
typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32);
|
||||
typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32);
|
||||
typedef bool (__cdecl* TVideo_Screenshot)(const char* filename);
|
||||
typedef void (__cdecl* TVideo_EnterLoop)();
|
||||
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
|
||||
typedef void (__cdecl* TVideo_Stop)();
|
||||
|
||||
class PluginVideo : public CPlugin {
|
||||
public:
|
||||
PluginVideo(const char *_Filename);
|
||||
~PluginVideo();
|
||||
virtual bool IsValid() {return validVideo;};
|
||||
|
||||
TVideo_Prepare Video_Prepare;
|
||||
TVideo_SendFifoData Video_SendFifoData;
|
||||
TVideo_UpdateXFB Video_UpdateXFB;
|
||||
TVideo_Screenshot Video_Screenshot;
|
||||
TVideo_EnterLoop Video_EnterLoop;
|
||||
TVideo_AddMessage Video_AddMessage;
|
||||
TVideo_Stop Video_Stop;
|
||||
|
||||
private:
|
||||
bool validVideo;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
24
Source/Core/Common/Src/PluginWiimote.cpp
Normal file
24
Source/Core/Common/Src/PluginWiimote.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "PluginWiimote.h"
|
||||
|
||||
namespace Common {
|
||||
PluginWiimote::PluginWiimote(const char *_Filename) : CPlugin(_Filename), validWiimote(false) {
|
||||
|
||||
Wiimote_ControlChannel = reinterpret_cast<TWiimote_Output>
|
||||
(LoadSymbol("Wiimote_ControlChannel"));
|
||||
Wiimote_InterruptChannel = reinterpret_cast<TWiimote_Input>
|
||||
(LoadSymbol("Wiimote_InterruptChannel"));
|
||||
Wiimote_Update = reinterpret_cast<TWiimote_Update>
|
||||
(LoadSymbol("Wiimote_Update"));
|
||||
Wiimote_GetAttachedControllers = reinterpret_cast<TWiimote_GetAttachedControllers>
|
||||
(LoadSymbol("Wiimote_GetAttachedControllers"));
|
||||
|
||||
if ((Wiimote_ControlChannel != 0) &&
|
||||
(Wiimote_InterruptChannel != 0) &&
|
||||
(Wiimote_Update != 0) &&
|
||||
(Wiimote_GetAttachedControllers != 0))
|
||||
validWiimote = true;
|
||||
}
|
||||
|
||||
PluginWiimote::~PluginWiimote() {
|
||||
}
|
||||
}
|
32
Source/Core/Common/Src/PluginWiimote.h
Normal file
32
Source/Core/Common/Src/PluginWiimote.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef _PLUGINWIIMOTE_H
|
||||
#define _PLUGINWIIMOTE_H
|
||||
|
||||
#include "pluginspecs_wiimote.h"
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
|
||||
typedef void (__cdecl* TWiimote_Update)();
|
||||
typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size);
|
||||
typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size);
|
||||
typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)();
|
||||
|
||||
class PluginWiimote : public CPlugin {
|
||||
public:
|
||||
PluginWiimote(const char *_Filename);
|
||||
~PluginWiimote();
|
||||
virtual bool IsValid() {return validWiimote;};
|
||||
|
||||
TWiimote_Output Wiimote_ControlChannel;
|
||||
TWiimote_Input Wiimote_InterruptChannel;
|
||||
TWiimote_Update Wiimote_Update;
|
||||
TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers;
|
||||
|
||||
private:
|
||||
bool validWiimote;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
# -*- python -*-
|
||||
# -*- python -*-
|
||||
|
||||
Import('env')
|
||||
|
||||
@ -17,6 +17,10 @@ files = [
|
||||
"MemArena.cpp",
|
||||
"MemoryUtil.cpp",
|
||||
"Plugin.cpp",
|
||||
"PluginDSP.cpp",
|
||||
"PluginWiimote.cpp",
|
||||
"PluginVideo.cpp",
|
||||
"PluginPAD.cpp",
|
||||
"StringUtil.cpp",
|
||||
"TestFramework.cpp",
|
||||
"Thunk.cpp",
|
||||
|
@ -20,21 +20,18 @@
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <sys/timeb.h>
|
||||
|
||||
u32 timeGetTime()
|
||||
{
|
||||
struct timeb t;
|
||||
ftime(&t);
|
||||
return((u32)(t.time * 1000 + t.millitm));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -88,7 +85,6 @@ void _time64(u64* t)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
u64 Timer::GetTimeSinceJan1970(void)
|
||||
{
|
||||
time_t ltime;
|
||||
@ -108,4 +104,14 @@ u64 Timer::GetLocalTimeSinceJan1970(void)
|
||||
|
||||
return (u64)(sysTime + tzDiff);
|
||||
}
|
||||
|
||||
std::string Timer::GetTimeFormatted(void)
|
||||
{
|
||||
struct timeb tp;
|
||||
(void)::ftime(&tp);
|
||||
char temp[32];
|
||||
sprintf(temp, "%02hi:%02i:%03i", tp.time/60, tp.time%60, tp.millitm);
|
||||
|
||||
return std::string(temp);
|
||||
}
|
||||
} // end of namespace Common
|
||||
|
@ -39,6 +39,8 @@ class Timer
|
||||
static u64 GetTimeSinceJan1970();
|
||||
static u64 GetLocalTimeSinceJan1970();
|
||||
|
||||
static std::string GetTimeFormatted();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
Reference in New Issue
Block a user