Port to *BSD. It runs but isn't terribly useful without Cg.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5934 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
cdce0ec322
commit
83883cee45
|
@ -10,7 +10,14 @@ files = [
|
|||
'src/joystick/SDL_joystick.c',
|
||||
]
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
if sys.platform.count('bsd'):
|
||||
env['LIBS'] += ['usbhid']
|
||||
files += [
|
||||
'src/joystick/bsd/SDL_sysjoystick.c',
|
||||
'src/stdlib/SDL_malloc.c',
|
||||
'src/stdlib/SDL_string.c',
|
||||
]
|
||||
elif sys.platform == 'darwin':
|
||||
files += [
|
||||
'src/joystick/darwin/SDL_sysjoystick.c',
|
||||
]
|
||||
|
@ -19,6 +26,10 @@ elif sys.platform == 'linux2':
|
|||
'src/joystick/linux/SDL_sysjoystick.c',
|
||||
'src/stdlib/SDL_string.c',
|
||||
]
|
||||
elif sys.platform == 'win32':
|
||||
files += [
|
||||
'src/joystick/win32/SDL_mmjoystick.c',
|
||||
]
|
||||
else:
|
||||
files += [
|
||||
'src/joystick/dummy/SDL_sysjoystick.c',
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
#ifndef _SDL_config_h
|
||||
#define _SDL_config_h
|
||||
|
||||
#include <sys/ioctl.h> /* XXX */
|
||||
|
||||
#define SDL_JOYSTICK_USBHID 1
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define HAVE_USBHID_H
|
||||
#endif
|
||||
#define USBHID_NEW
|
||||
#define USBHID_UCR_DATA
|
||||
|
||||
#define HAVE_ABS 1
|
||||
#define HAVE_ALLOCA 1
|
||||
#define HAVE_ATOF 1
|
||||
#define HAVE_ATOI 1
|
||||
#define HAVE_BCOPY 1
|
||||
#define HAVE_CALLOC 1
|
||||
#define HAVE_CTYPE_H 1
|
||||
#define HAVE_FREE 1
|
||||
#define HAVE_GETENV 1
|
||||
#define HAVE_INTTYPES_H 1
|
||||
#define HAVE_MALLOC 1
|
||||
#define HAVE_MATH_H 1
|
||||
#define HAVE_MEMCMP 1
|
||||
#define HAVE_MEMCPY 1
|
||||
#define HAVE_MEMMOVE 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
#define HAVE_MEMSET 1
|
||||
#define HAVE_MPROTECT 1
|
||||
#define HAVE_NANOSLEEP 1
|
||||
#define HAVE_PUTENV 1
|
||||
#define HAVE_QSORT 1
|
||||
#define HAVE_REALLOC 1
|
||||
#define HAVE_SETJMP 1
|
||||
#define HAVE_SIGACTION 1
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#define HAVE_SNPRINTF 1
|
||||
#define HAVE_SSCANF 1
|
||||
#define HAVE_STDARG_H 1
|
||||
#define HAVE_STDINT_H 1
|
||||
#define HAVE_STDIO_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_STRCASECMP 1
|
||||
#define HAVE_STRCHR 1
|
||||
#define HAVE_STRCMP 1
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRINGS_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_STRLCAT 1
|
||||
#define HAVE_STRLCPY 1
|
||||
#define HAVE_STRLEN 1
|
||||
#define HAVE_STRNCASECMP 1
|
||||
#define HAVE_STRNCMP 1
|
||||
#define HAVE_STRRCHR 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOD 1
|
||||
#define HAVE_STRTOL 1
|
||||
#define HAVE_STRTOLL 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_STRTOULL 1
|
||||
#define HAVE_SYS_TYPES_H
|
||||
#define HAVE_UNSETENV 1
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
#endif
|
|
@ -1,5 +1,9 @@
|
|||
#include <sys/param.h>
|
||||
|
||||
#if defined __APPLE__
|
||||
#include "include/SDL_config_macosx.h"
|
||||
#elif defined BSD4_4
|
||||
#include "SDL/SDL_config_bsd.h"
|
||||
#elif defined __linux__
|
||||
#include "SDL/SDL_config_linux.h"
|
||||
#endif
|
||||
|
|
|
@ -197,12 +197,12 @@ SDL_SYS_JoystickInit(void)
|
|||
}
|
||||
|
||||
const char *
|
||||
SDL_SYS_JoystickName(int index)
|
||||
SDL_SYS_JoystickName(int jindex)
|
||||
{
|
||||
if (joydevnames[index] != NULL) {
|
||||
return (joydevnames[index]);
|
||||
if (joydevnames[jindex] != NULL) {
|
||||
return (joydevnames[jindex]);
|
||||
}
|
||||
return (joynames[index]);
|
||||
return (joynames[jindex]);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
File diff suppressed because it is too large
Load Diff
25
SConstruct
25
SConstruct
|
@ -35,7 +35,6 @@ cppDefines = [
|
|||
]
|
||||
|
||||
include_paths = [
|
||||
'#',
|
||||
'#Source/Core/Common/Src',
|
||||
'#Source/Core/DiscIO/Src',
|
||||
'#Source/PluginSpecs',
|
||||
|
@ -68,7 +67,6 @@ dirs = [
|
|||
'Source/Core/DSPCore/Src',
|
||||
'Source/DSPTool/Src',
|
||||
'Source/Core/InputUICommon/Src',
|
||||
'Source/Plugins/Plugin_VideoOGL/Src',
|
||||
'Source/Plugins/Plugin_VideoSoftware/Src',
|
||||
'Source/Plugins/Plugin_DSP_HLE/Src',
|
||||
'Source/Plugins/Plugin_DSP_LLE/Src',
|
||||
|
@ -79,6 +77,9 @@ dirs = [
|
|||
'Source/UnitTests',
|
||||
]
|
||||
|
||||
if sys.platform == 'darwin' or sys.platform == 'linux2':
|
||||
dirs += ['Source/Plugins/Plugin_VideoOGL/Src']
|
||||
|
||||
builders = {}
|
||||
if sys.platform == 'darwin':
|
||||
from plistlib import writePlist
|
||||
|
@ -288,13 +289,13 @@ elif sys.platform == 'win32':
|
|||
env['tools'] = ['mingw']
|
||||
|
||||
else:
|
||||
env['CPPPATH'].insert(0, '#')
|
||||
env['LINKFLAGS'] += ['-pthread']
|
||||
conf = env.Configure(custom_tests = tests, config_h="#config.h")
|
||||
|
||||
if not conf.CheckPKGConfig('0.15.0'):
|
||||
print "Can't find pkg-config, some tests will fail"
|
||||
|
||||
env['LINKFLAGS'] += ['-pthread']
|
||||
|
||||
if env['shared_glew']:
|
||||
shared['glew'] = conf.CheckPKG('GLEW')
|
||||
if env['shared_sdl']:
|
||||
|
@ -324,6 +325,8 @@ else:
|
|||
print "WX libraries not found - see config.log"
|
||||
Exit(1)
|
||||
|
||||
conf.CheckPKG('usbhid')
|
||||
|
||||
env['HAVE_BLUEZ'] = conf.CheckPKG('bluez')
|
||||
conf.Define('HAVE_BLUEZ', env['HAVE_BLUEZ'])
|
||||
|
||||
|
@ -359,12 +362,14 @@ else:
|
|||
if not conf.CheckPKG('GLU'):
|
||||
print "Must have GLU to build"
|
||||
Exit(1)
|
||||
if not conf.CheckPKG('Cg'):
|
||||
print "Must have Cg toolkit from NVidia to build"
|
||||
Exit(1)
|
||||
if not conf.CheckPKG('CgGL'):
|
||||
print "Must have CgGl to build"
|
||||
Exit(1)
|
||||
|
||||
if sys.platform == 'linux2':
|
||||
if not conf.CheckPKG('Cg'):
|
||||
print "Must have Cg toolkit from NVidia to build"
|
||||
Exit(1)
|
||||
if not conf.CheckPKG('CgGL'):
|
||||
print "Must have CgGl to build"
|
||||
Exit(1)
|
||||
|
||||
if env['opencl']:
|
||||
env['HAVE_OPENCL'] = conf.CheckPKG('OpenCL')
|
||||
|
|
|
@ -26,12 +26,14 @@ void AudioCommonConfig::Load(IniFile &file) {
|
|||
file.Get("Config", "Volume", &m_Volume, 75);
|
||||
#ifdef _WIN32
|
||||
file.Get("Config", "Backend", &sBackend, BACKEND_DIRECTSOUND);
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined __APPLE__
|
||||
std::string temp;
|
||||
file.Get("Config", "Backend", &temp, BACKEND_COREAUDIO);
|
||||
strncpy(sBackend, temp.c_str(), 128);
|
||||
#else // linux
|
||||
#elif defined __linux__
|
||||
file.Get("Config", "Backend", &sBackend, BACKEND_ALSA);
|
||||
#else
|
||||
file.Get("Config", "Backend", &sBackend, BACKEND_OPENAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifdef _WIN32
|
||||
#include "../../../../Externals/OpenAL/include/al.h"
|
||||
#include "../../../../Externals/OpenAL/include/alc.h"
|
||||
#elif defined __linux__
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#ifdef _WIN32
|
||||
#include "../../../../Externals/OpenAL/include/al.h"
|
||||
#include "../../../../Externals/OpenAL/include/alc.h"
|
||||
#else // linux
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
#endif
|
||||
|
|
|
@ -1,51 +1,55 @@
|
|||
// Most of the code in this file was shamelessly ripped from libcdio With minor adjustments
|
||||
|
||||
|
||||
#include "CDUtils.h"
|
||||
#include "Common.h"
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#elif __APPLE__
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/IOBSD.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/storage/IOCDMedia.h>
|
||||
#include <IOKit/storage/IOMedia.h>
|
||||
#include <IOKit/IOBSD.h>
|
||||
#include <paths.h>
|
||||
#elif __linux__
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/cdrom.h>
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef __linux__
|
||||
#include <linux/cdrom.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// Returns a string that can be used in a CreateFile call if
|
||||
// Returns a string that can be used in a CreateFile call if
|
||||
// c_drive letter is a character. If not NULL is returned.
|
||||
const char *is_cdrom(const char c_drive_letter)
|
||||
{
|
||||
|
||||
UINT uDriveType;
|
||||
char sz_win32_drive[4];
|
||||
|
||||
|
||||
sz_win32_drive[0]= c_drive_letter;
|
||||
sz_win32_drive[1]=':';
|
||||
sz_win32_drive[2]='\\';
|
||||
sz_win32_drive[3]='\0';
|
||||
|
||||
|
||||
uDriveType = GetDriveType(sz_win32_drive);
|
||||
|
||||
|
||||
switch(uDriveType)
|
||||
{
|
||||
case DRIVE_CDROM:
|
||||
{
|
||||
{
|
||||
case DRIVE_CDROM:
|
||||
{
|
||||
char sz_win32_drive_full[] = "\\\\.\\X:";
|
||||
sz_win32_drive_full[4] = c_drive_letter;
|
||||
return __strdup(&sz_win32_drive_full[4]);
|
||||
}
|
||||
default:
|
||||
//cdio_debug("Drive %c is not a CD-ROM", c_drive_letter);
|
||||
return NULL;
|
||||
}
|
||||
default:
|
||||
{
|
||||
//cdio_debug("Drive %c is not a CD-ROM", c_drive_letter);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +57,7 @@ const char *is_cdrom(const char c_drive_letter)
|
|||
std::vector<std::string> cdio_get_devices() {
|
||||
std::vector<std::string> drives;
|
||||
char drive_letter;
|
||||
|
||||
|
||||
// Scan the system for CD-ROM drives.
|
||||
for (drive_letter='A'; drive_letter <= 'Z'; drive_letter++) {
|
||||
const char *drive_str=is_cdrom(drive_letter);
|
||||
|
@ -74,55 +78,53 @@ std::vector<std::string> cdio_get_devices()
|
|||
io_iterator_t media_iterator;
|
||||
CFMutableDictionaryRef classes_to_match;
|
||||
std::vector<std::string> drives;
|
||||
|
||||
|
||||
kern_result = IOMasterPort( MACH_PORT_NULL, &master_port );
|
||||
if( kern_result != KERN_SUCCESS )
|
||||
return( drives );
|
||||
|
||||
|
||||
classes_to_match = IOServiceMatching( kIOCDMediaClass );
|
||||
if( classes_to_match == NULL )
|
||||
return( drives );
|
||||
|
||||
CFDictionarySetValue( classes_to_match, CFSTR(kIOMediaEjectableKey),
|
||||
kCFBooleanTrue );
|
||||
|
||||
kern_result = IOServiceGetMatchingServices( master_port,
|
||||
classes_to_match,
|
||||
&media_iterator );
|
||||
|
||||
CFDictionarySetValue( classes_to_match,
|
||||
CFSTR(kIOMediaEjectableKey), kCFBooleanTrue );
|
||||
|
||||
kern_result = IOServiceGetMatchingServices( master_port,
|
||||
classes_to_match, &media_iterator );
|
||||
if( kern_result != KERN_SUCCESS)
|
||||
return( drives );
|
||||
|
||||
|
||||
next_media = IOIteratorNext( media_iterator );
|
||||
if( next_media != 0 )
|
||||
{
|
||||
{
|
||||
char psz_buf[0x32];
|
||||
size_t dev_path_length;
|
||||
CFTypeRef str_bsd_path;
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
str_bsd_path =
|
||||
{
|
||||
str_bsd_path =
|
||||
IORegistryEntryCreateCFProperty( next_media,
|
||||
CFSTR( kIOBSDNameKey ),
|
||||
kCFAllocatorDefault,
|
||||
0 );
|
||||
CFSTR( kIOBSDNameKey ), kCFAllocatorDefault,
|
||||
0 );
|
||||
if( str_bsd_path == NULL )
|
||||
{
|
||||
{
|
||||
IOObjectRelease( next_media );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Below, by appending 'r' to the BSD node name, we indicate
|
||||
// a raw disk. Raw disks receive I/O requests directly and
|
||||
// don't go through a buffer cache.
|
||||
snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
|
||||
dev_path_length = strlen( psz_buf );
|
||||
|
||||
|
||||
if( CFStringGetCString( (CFStringRef)str_bsd_path,
|
||||
(char*)&psz_buf + dev_path_length,
|
||||
sizeof(psz_buf) - dev_path_length,
|
||||
kCFStringEncodingASCII))
|
||||
{
|
||||
(char*)&psz_buf + dev_path_length,
|
||||
sizeof(psz_buf) - dev_path_length,
|
||||
kCFStringEncodingASCII))
|
||||
{
|
||||
if(psz_buf != NULL)
|
||||
{
|
||||
std::string str = psz_buf;
|
||||
|
@ -131,26 +133,31 @@ std::vector<std::string> cdio_get_devices()
|
|||
}
|
||||
CFRelease( str_bsd_path );
|
||||
IOObjectRelease( next_media );
|
||||
|
||||
|
||||
} while( ( next_media = IOIteratorNext( media_iterator ) ) != 0 );
|
||||
}
|
||||
IOObjectRelease( media_iterator );
|
||||
return drives;
|
||||
}
|
||||
#elif defined __linux__
|
||||
#else
|
||||
// checklist: /dev/cdrom, /dev/dvd /dev/hd?, /dev/scd? /dev/sr?
|
||||
static struct
|
||||
{
|
||||
const char * format;
|
||||
unsigned int num_min;
|
||||
unsigned int num_max;
|
||||
const char * format;
|
||||
unsigned int num_min;
|
||||
unsigned int num_max;
|
||||
} checklist[] =
|
||||
{
|
||||
#ifdef __linux__
|
||||
{ "/dev/cdrom", 0, 0},
|
||||
{ "/dev/dvd", 0, 0},
|
||||
{ "/dev/hd%c", 'a', 'z' },
|
||||
{ "/dev/scd%d", 0, 27 },
|
||||
{ "/dev/sr%d", 0, 27 },
|
||||
{ "/dev/scd%d", 0, 27 },
|
||||
{ "/dev/sr%d", 0, 27 },
|
||||
#else
|
||||
{ "/dev/acd%d", 0, 27 },
|
||||
{ "/dev/cd%d", 0, 27 },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -161,7 +168,8 @@ bool is_device(const char *source_name)
|
|||
if (0 != lstat(source_name, &buf))
|
||||
return false;
|
||||
|
||||
return ((S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) && !S_ISLNK(buf.st_mode));
|
||||
return ((S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) &&
|
||||
!S_ISLNK(buf.st_mode));
|
||||
}
|
||||
|
||||
// Check a device to see if it is a DVD/CD-ROM drive
|
||||
|
@ -169,39 +177,40 @@ static bool is_cdrom(const char *drive, char *mnttype)
|
|||
{
|
||||
bool is_cd=false;
|
||||
int cdfd;
|
||||
|
||||
|
||||
// Check if the device exists
|
||||
if (!is_device(drive))
|
||||
return(false);
|
||||
|
||||
|
||||
// If it does exist, verify that it is a cdrom/dvd drive
|
||||
cdfd = open(drive, (O_RDONLY|O_NONBLOCK), 0);
|
||||
if ( cdfd >= 0 )
|
||||
{
|
||||
{
|
||||
#ifdef __linux__
|
||||
if (ioctl(cdfd, CDROM_GET_CAPABILITY, 0) != -1)
|
||||
#endif
|
||||
is_cd = true;
|
||||
close(cdfd);
|
||||
}
|
||||
}
|
||||
return(is_cd);
|
||||
}
|
||||
|
||||
// Returns a pointer to an array of strings with the device names
|
||||
std::vector<std::string> cdio_get_devices ()
|
||||
{
|
||||
|
||||
unsigned int i;
|
||||
char drive[40];
|
||||
std::vector<std::string> drives;
|
||||
|
||||
|
||||
// Scan the system for DVD/CD-ROM drives.
|
||||
for ( i=0; checklist[i].format; ++i )
|
||||
{
|
||||
{
|
||||
unsigned int j;
|
||||
for ( j=checklist[i].num_min; j<=checklist[i].num_max; ++j )
|
||||
{
|
||||
{
|
||||
sprintf(drive, checklist[i].format, j);
|
||||
if ( (is_cdrom(drive, NULL)) > 0 )
|
||||
{
|
||||
{
|
||||
std::string str = drive;
|
||||
drives.push_back(str);
|
||||
}
|
||||
|
@ -215,8 +224,8 @@ std::vector<std::string> cdio_get_devices ()
|
|||
bool cdio_is_cdrom(std::string device)
|
||||
{
|
||||
#ifdef __linux__
|
||||
// Resolve symbolic links. This allows symbolic links to valid cdrom/dvd drives to
|
||||
// be passed from the command line with the -e flag.
|
||||
// Resolve symbolic links. This allows symbolic links to valid
|
||||
// drives to be passed from the command line with the -e flag.
|
||||
char *devname = realpath(device.c_str(), NULL);
|
||||
if (!devname)
|
||||
return false;
|
||||
|
@ -225,23 +234,23 @@ bool cdio_is_cdrom(std::string device)
|
|||
std::vector<std::string> devices = cdio_get_devices();
|
||||
bool res = false;
|
||||
for (unsigned int i = 0; i < devices.size(); i++)
|
||||
{
|
||||
{
|
||||
#ifdef __linux__
|
||||
if (strncmp(devices[i].c_str(), devname, MAX_PATH) == 0)
|
||||
#else
|
||||
if (strncmp(devices[i].c_str(), device.c_str(), MAX_PATH) == 0)
|
||||
#endif
|
||||
{
|
||||
{
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
if (devname)
|
||||
free(devname);
|
||||
#endif
|
||||
|
||||
|
||||
devices.clear();
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -29,15 +29,14 @@ template<> struct CompileTimeAssert<true> {};
|
|||
|
||||
#ifndef _WIN32
|
||||
|
||||
#if defined __APPLE__
|
||||
char* strndup (char const *s, size_t n);
|
||||
size_t strnlen(const char *s, size_t n);
|
||||
#else
|
||||
#include <errno.h>
|
||||
#ifdef __linux__
|
||||
#include <byteswap.h>
|
||||
#else
|
||||
char * strndup(char const *s, size_t n);
|
||||
size_t strnlen(const char *s, size_t n);
|
||||
#endif
|
||||
#endif // APPLE
|
||||
#include <errno.h>
|
||||
|
||||
// go to debugger mode
|
||||
#ifdef GEKKO
|
||||
#define Crash()
|
||||
|
|
|
@ -48,6 +48,10 @@
|
|||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#if defined __NetBSD__ || defined __FreeBSD__ || defined __OpenBSD__
|
||||
#define stat64 stat // XXX
|
||||
#endif
|
||||
|
||||
// This namespace has various generic functions related to files and paths.
|
||||
// The code still needs a ton of cleanup.
|
||||
// REMEMBER: strdup considered harmful!
|
||||
|
|
|
@ -120,7 +120,7 @@ u8* MemArena::Find4GBBase()
|
|||
return base;
|
||||
#else
|
||||
void* base = mmap(0, 0x31000000, PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_SHARED, 0, 0);
|
||||
MAP_ANON | MAP_SHARED, -1, 0);
|
||||
if (base == MAP_FAILED) {
|
||||
PanicAlert("Failed to map 1 GB of memory space: %s", strerror(errno));
|
||||
return 0;
|
||||
|
|
|
@ -37,7 +37,7 @@ const char *GetLastErrorMsg()
|
|||
return errStr;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
#if !defined(__linux__) && !defined(_WIN32)
|
||||
// strlen with cropping after size n
|
||||
size_t strnlen(const char *s, size_t n)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
|
@ -37,9 +37,9 @@ u32 Timer::GetTimeMs() {
|
|||
#else
|
||||
u32 Timer::GetTimeMs()
|
||||
{
|
||||
struct timeb t;
|
||||
ftime(&t);
|
||||
return ((u32)(t.time * 1000 + t.millitm));
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
return((u32)(t.tv_sec * 1000 + t.tv_usec / 1000));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -202,9 +202,9 @@ std::string Timer::GetTimeFormatted()
|
|||
strftime(tmp, 6, "%M:%S", gmTime);
|
||||
|
||||
// Now tack on the milliseconds
|
||||
struct timeb tp;
|
||||
(void)::ftime(&tp);
|
||||
sprintf(formattedTime, "%s:%03i", tmp, tp.millitm);
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
sprintf(formattedTime, "%s:%03ld", tmp, t.tv_usec / 1000);
|
||||
|
||||
return std::string(formattedTime);
|
||||
}
|
||||
|
@ -214,8 +214,8 @@ std::string Timer::GetTimeFormatted()
|
|||
// ----------------
|
||||
double Timer::GetDoubleTime()
|
||||
{
|
||||
struct timeb tp;
|
||||
(void)::ftime(&tp);
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp
|
||||
|
||||
/* Remove a few years. We only really want enough seconds to make sure that we are
|
||||
|
@ -226,7 +226,7 @@ double Timer::GetDoubleTime()
|
|||
//if (TmpSeconds < 0) return 0; // Check the the user's clock is working somewhat
|
||||
|
||||
u32 Seconds = (u32)TmpSeconds; // Make a smaller integer that fits in the double
|
||||
double ms = tp.millitm / 1000.0;
|
||||
double ms = t.tv_usec / 1000.0 / 1000.0;
|
||||
double TmpTime = Seconds + ms;
|
||||
return TmpTime;
|
||||
}
|
||||
|
|
|
@ -211,9 +211,8 @@ bool RamWriteAndFill()
|
|||
case 0x4 :
|
||||
{
|
||||
// TODO: complete
|
||||
u32 new_data = data;
|
||||
// u32 new_data = data;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -372,7 +371,6 @@ bool FlowControl()
|
|||
|
||||
// not all of these are used in all subtypes
|
||||
const u8 block_num = (u8)(code.data & 0xF);
|
||||
const s16 code_offset = (s16)code.address;
|
||||
|
||||
switch (code.subtype)
|
||||
{
|
||||
|
@ -680,8 +678,6 @@ bool SpecialIf()
|
|||
// CT5 Part2 : 16bits Counter check
|
||||
// TODO:
|
||||
|
||||
const u16 z = (u16)(data >> 16);
|
||||
|
||||
switch (code.subtype)
|
||||
{
|
||||
// CST4 : 16bits (endif, then) If counter value equal
|
||||
|
@ -849,4 +845,4 @@ bool EndCodes()
|
|||
return true;
|
||||
}
|
||||
|
||||
} // namespace Gecko
|
||||
} // namespace Gecko
|
||||
|
|
|
@ -136,6 +136,4 @@ void SaveCodes(IniFile& inifile, const std::vector<GeckoCode>& gcodes)
|
|||
inifile.SetLines(GECKO_CODE_INI_SECTION, lines);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -12,9 +12,6 @@ namespace Gecko
|
|||
void LoadCodes(const IniFile& inifile, std::vector<GeckoCode>& gcodes);
|
||||
void SaveCodes(IniFile& inifile, const std::vector<GeckoCode>& gcodes);
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -23,8 +23,12 @@
|
|||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if.h>
|
||||
#ifdef __linux__
|
||||
#include <linux/if_tun.h>
|
||||
#else
|
||||
#include <net/if_tun.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
int fd = -1;
|
||||
bool CEXIETHERNET::deactivate()
|
||||
|
@ -39,6 +43,7 @@ bool CEXIETHERNET::isActivated()
|
|||
}
|
||||
|
||||
bool CEXIETHERNET::activate() {
|
||||
#ifdef __linux__
|
||||
if(isActivated())
|
||||
return true;
|
||||
if( (fd = open("/dev/net/tun", O_RDWR)) < 0)
|
||||
|
@ -77,8 +82,8 @@ bool CEXIETHERNET::activate() {
|
|||
system("brctl addif pan0 Dolphin");
|
||||
system("ifconfig Dolphin 0.0.0.0 promisc up");
|
||||
resume();
|
||||
#endif
|
||||
return true;
|
||||
|
||||
}
|
||||
bool CEXIETHERNET::CheckRecieved()
|
||||
{
|
||||
|
|
|
@ -25,4 +25,4 @@ void GCPad_Deinit();
|
|||
void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus);
|
||||
void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength);
|
||||
|
||||
InputPlugin *PAD_GetPlugin();
|
||||
InputPlugin *PAD_GetPlugin();
|
||||
|
|
|
@ -193,4 +193,4 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
|
|||
// Triggers
|
||||
set_control(m_triggers, 0, "Q"); // L
|
||||
set_control(m_triggers, 1, "W"); // R
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,17 +353,7 @@ u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesAZERTY[256] = {
|
|||
0x00, // Nothing interesting past this point.
|
||||
|
||||
};
|
||||
#elif defined __linux__
|
||||
// TODO Add support for Linux keycodes
|
||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesQWERTY[256] = {
|
||||
0
|
||||
};
|
||||
|
||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesAZERTY[256] = {
|
||||
0
|
||||
};
|
||||
#elif defined __APPLE__
|
||||
// TODO Add support for Apple keycodes
|
||||
#else
|
||||
u8 CWII_IPC_HLE_Device_usb_kbd::m_KeyCodesQWERTY[256] = {
|
||||
0
|
||||
};
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <execinfo.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <sys/ucontext.h> // Look in here for the context definition.
|
||||
|
@ -26,11 +25,16 @@
|
|||
#define CREG_RIP(ctx) (ctx)->gregs[REG_RIP]
|
||||
#define CREG_EAX(ctx) (ctx)->gregs[REG_EAX]
|
||||
#define CREG_EIP(ctx) (ctx)->gregs[REG_EIP]
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined __APPLE__
|
||||
#define CREG_RAX(ctx) (*(ctx))->__ss.__rax
|
||||
#define CREG_RIP(ctx) (*(ctx))->__ss.__rip
|
||||
#define CREG_EAX(ctx) (*(ctx))->__ss.__eax
|
||||
#define CREG_EIP(ctx) (*(ctx))->__ss.__eip
|
||||
#else
|
||||
#define CREG_RAX(ctx) (ctx)->mc_rax
|
||||
#define CREG_RIP(ctx) (ctx)->mc_rip
|
||||
#define CREG_EAX(ctx) (ctx)->mc_eax
|
||||
#define CREG_EIP(ctx) (ctx)->mc_eip
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
@ -152,10 +156,10 @@ void InstallExceptionHandler()
|
|||
|
||||
#else // _WIN32
|
||||
|
||||
//
|
||||
// backtrace useful function
|
||||
//
|
||||
|
||||
#if defined __APPLE__ || defined __linux__ || defined _WIN32
|
||||
#ifndef _WIN32
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
void print_trace(const char * msg)
|
||||
{
|
||||
void *array[100];
|
||||
|
@ -170,6 +174,7 @@ void print_trace(const char * msg)
|
|||
printf("--> %s\n", strings[i]);
|
||||
free(strings);
|
||||
}
|
||||
#endif
|
||||
|
||||
void sigsegv_handler(int signal, siginfo_t *info, void *raw_context)
|
||||
{
|
||||
|
|
|
@ -256,6 +256,8 @@ int DSPCore_RunCycles(int cycles)
|
|||
|
||||
DSPHost_UpdateDebugger();
|
||||
break;
|
||||
case DSPCORE_STOP:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return cycles;
|
||||
|
|
|
@ -82,6 +82,7 @@ elif sys.platform == 'darwin' and env['HAVE_WX']:
|
|||
)
|
||||
else:
|
||||
files += [ 'X11Utils.cpp' ]
|
||||
libs += [ 'SDL' ]
|
||||
exeGUI = env['binary_dir'] + 'dolphin-emu'
|
||||
exeNoGUI = env['binary_dir'] + 'dolphin-emu-nogui'
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@ files = [
|
|||
'InputConfig.cpp',
|
||||
'ControllerInterface/ControllerInterface.cpp',
|
||||
'UDPWiimote.cpp',
|
||||
'UDPWrapper.cpp'
|
||||
'UDPWrapper.cpp',
|
||||
'SDL_Util.cpp', # XXX needed by old Wiimote plugin
|
||||
]
|
||||
|
||||
if sys.platform == 'win32':
|
||||
|
@ -16,6 +17,7 @@ if sys.platform == 'win32':
|
|||
'ControllerInterface/DInput/DInput.cpp',
|
||||
'ControllerInterface/DInput/DInputJoystick.cpp',
|
||||
'ControllerInterface/DInput/DInputKeyboardMouse.cpp'
|
||||
'ControllerInterface/SDL/SDL.cpp',
|
||||
'ControllerInterface/XInput/XInput.cpp',
|
||||
]
|
||||
elif sys.platform == 'darwin':
|
||||
|
@ -23,18 +25,12 @@ elif sys.platform == 'darwin':
|
|||
'ControllerInterface/OSX/OSX.mm',
|
||||
'ControllerInterface/OSX/OSXKeyboard.mm',
|
||||
'ControllerInterface/OSX/OSXMouse.mm',
|
||||
'SDL_Util.cpp', # XXX needed by old Wiimote plugin
|
||||
]
|
||||
else:
|
||||
elif env['HAVE_X11']:
|
||||
files += [
|
||||
'ControllerInterface/SDL/SDL.cpp',
|
||||
'ControllerInterface/Xlib/Xlib.cpp',
|
||||
'X11InputBase.cpp'
|
||||
]
|
||||
|
||||
if sys.platform == 'win32' or sys.platform == 'linux2':
|
||||
files += [
|
||||
'ControllerInterface/SDL/SDL.cpp',
|
||||
'SDL_Util.cpp',
|
||||
]
|
||||
|
||||
env.StaticLibrary(env['local_libs'] + "inputcommon", files)
|
||||
|
|
|
@ -76,8 +76,10 @@ WiimoteBasicConfigDialog::WiimoteBasicConfigDialog(wxWindow *parent, wxWindowID
|
|||
ControlsCreated = false;
|
||||
m_Page = 0;
|
||||
|
||||
#if defined HAVE_WIIUSE && HAVE_WIIUSE
|
||||
// Initialize the Real WiiMotes here, so we get a count of how many were found and set everything properly
|
||||
WiiMoteReal::Initialize();
|
||||
#endif
|
||||
|
||||
CreateGUIControls();
|
||||
UpdateGUI();
|
||||
|
@ -93,7 +95,9 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event)
|
|||
switch(event.GetId())
|
||||
{
|
||||
case wxID_OK:
|
||||
#if defined HAVE_WIIUSE && HAVE_WIIUSE
|
||||
WiiMoteReal::Allocate();
|
||||
#endif
|
||||
g_Config.Save();
|
||||
Close();
|
||||
break;
|
||||
|
|
|
@ -36,4 +36,4 @@ private:
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#include "WiimoteEmu.h"
|
||||
|
||||
#ifdef USE_WIIMOTE_EMU_SPEAKER
|
||||
|
@ -36,4 +35,4 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue