mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-05 02:32:45 +00:00
The Mega Change Of Doom - or, fixing Stop. Almost. At least it's better than before. However, the OpenGL plugin seems to lose textures a lot between game restarts :P I think the GL plugin needs to do a lot more cleanup.
This change also includes tons of minor code formatting cleanup. Yeah, should've separated it ... sorry :( Kills the old CPUCompare support. I'll resurrect it if I need it again, right now it mostly clutters the code. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2321 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f992dae50d
commit
6cd34b318f
47 changed files with 685 additions and 1088 deletions
|
@ -15,10 +15,8 @@
|
|||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
/*
|
||||
All plugins from Core > Plugins are loaded and unloaded with this class when
|
||||
Dolpin is started and stopped.
|
||||
*/
|
||||
// All plugins from Core > Plugins are loaded and unloaded with this class when
|
||||
// Dolphin is started and stopped.
|
||||
|
||||
#include <string.h> // System
|
||||
#ifdef _WIN32
|
||||
|
@ -34,7 +32,6 @@
|
|||
#include "DynamicLibrary.h"
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
|
||||
DynamicLibrary::DynamicLibrary()
|
||||
{
|
||||
library = 0;
|
||||
|
@ -42,33 +39,33 @@ DynamicLibrary::DynamicLibrary()
|
|||
|
||||
std::string GetLastErrorAsString()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
LPVOID lpMsgBuf = 0;
|
||||
DWORD error = GetLastError();
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
error,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0, NULL);
|
||||
std::string s;
|
||||
if (lpMsgBuf)
|
||||
{
|
||||
s = ((char *)lpMsgBuf);
|
||||
LocalFree(lpMsgBuf);
|
||||
} else {
|
||||
s = StringFromFormat("(unknown error %08x)", error);
|
||||
}
|
||||
return s;
|
||||
#else
|
||||
static std::string errstr;
|
||||
char *tmp = dlerror();
|
||||
if (tmp)
|
||||
errstr = tmp;
|
||||
|
||||
return errstr;
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
LPVOID lpMsgBuf = 0;
|
||||
DWORD error = GetLastError();
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
error,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0, NULL);
|
||||
std::string s;
|
||||
if (lpMsgBuf)
|
||||
{
|
||||
s = ((char *)lpMsgBuf);
|
||||
LocalFree(lpMsgBuf);
|
||||
} else {
|
||||
s = StringFromFormat("(unknown error %08x)", error);
|
||||
}
|
||||
return s;
|
||||
#else
|
||||
static std::string errstr;
|
||||
char *tmp = dlerror();
|
||||
if (tmp)
|
||||
errstr = tmp;
|
||||
|
||||
return errstr;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Function: Loading means loading the dll with LoadLibrary() to get an
|
||||
|
@ -81,15 +78,16 @@ std::string GetLastErrorAsString()
|
|||
Called from: The Dolphin Core */
|
||||
int DynamicLibrary::Load(const char* filename)
|
||||
{
|
||||
if (!filename || strlen(filename) == 0) {
|
||||
LOG(MASTER_LOG, "Missing filename of dynamic library to load");
|
||||
PanicAlert("Missing filename of dynamic library to load");
|
||||
return 0;
|
||||
if (!filename || strlen(filename) == 0)
|
||||
{
|
||||
LOG(MASTER_LOG, "Missing filename of dynamic library to load");
|
||||
PanicAlert("Missing filename of dynamic library to load");
|
||||
return 0;
|
||||
}
|
||||
LOG(MASTER_LOG, "Trying to load library %s", filename);
|
||||
if (IsLoaded()) {
|
||||
LOG(MASTER_LOG, "Trying to load already loaded library %s", filename);
|
||||
return 2;
|
||||
if (IsLoaded())
|
||||
{
|
||||
LOG(MASTER_LOG, "Trying to load already loaded library %s", filename);
|
||||
return 2;
|
||||
}
|
||||
|
||||
Console::Print("LoadLibrary: %s", filename);
|
||||
|
@ -99,10 +97,11 @@ int DynamicLibrary::Load(const char* filename)
|
|||
library = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
|
||||
#endif
|
||||
Console::Print(" %p\n", library);
|
||||
if (!library) {
|
||||
LOG(MASTER_LOG, "Error loading DLL %s: %s", filename, GetLastErrorAsString().c_str());
|
||||
PanicAlert("Error loading DLL %s: %s\n", filename, GetLastErrorAsString().c_str());
|
||||
return 0;
|
||||
if (!library)
|
||||
{
|
||||
LOG(MASTER_LOG, "Error loading DLL %s: %s", filename, GetLastErrorAsString().c_str());
|
||||
PanicAlert("Error loading DLL %s: %s\n", filename, GetLastErrorAsString().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
library_file = filename;
|
||||
|
@ -111,28 +110,29 @@ int DynamicLibrary::Load(const char* filename)
|
|||
|
||||
int DynamicLibrary::Unload()
|
||||
{
|
||||
int retval;
|
||||
if (!IsLoaded()) {
|
||||
PanicAlert("Error unloading DLL %s: not loaded", library_file.c_str());
|
||||
return 0;
|
||||
}
|
||||
int retval;
|
||||
if (!IsLoaded())
|
||||
{
|
||||
PanicAlert("Error unloading DLL %s: not loaded", library_file.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Console::Print("FreeLibrary: %s %p\n", library_file.c_str(), library);
|
||||
Console::Print("FreeLibrary: %s %p\n", library_file.c_str(), library);
|
||||
#ifdef _WIN32
|
||||
retval = FreeLibrary(library);
|
||||
retval = FreeLibrary(library);
|
||||
#else
|
||||
retval = dlclose(library)?0:1;
|
||||
retval = dlclose(library)?0:1;
|
||||
#endif
|
||||
|
||||
if (! retval) {
|
||||
PanicAlert("Error unloading DLL %s: %s", library_file.c_str(),
|
||||
GetLastErrorAsString().c_str());
|
||||
}
|
||||
library = 0;
|
||||
return retval;
|
||||
if (!retval)
|
||||
{
|
||||
PanicAlert("Error unloading DLL %s: %s", library_file.c_str(),
|
||||
GetLastErrorAsString().c_str());
|
||||
}
|
||||
library = 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void* DynamicLibrary::Get(const char* funcname) const
|
||||
{
|
||||
void* retval;
|
||||
|
@ -156,5 +156,3 @@ void* DynamicLibrary::Get(const char* funcname) const
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue