mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-09-27 09:56:08 +00:00
Refactor : completely excise win-shim
- Moves remaining shim code into mockingboard.c - Breaks Mac builds for now =P
This commit is contained in:
parent
994e1a4568
commit
1707c60701
@ -24,8 +24,7 @@ APPLE2_VIDEO_SRC = \
|
||||
|
||||
APPLE2_AUDIO_SRC = \
|
||||
$(APPLE2_SRC_PATH)/audio/soundcore.c $(APPLE2_SRC_PATH)/audio/soundcore-openal.c $(APPLE2_SRC_PATH)/audio/speaker.c \
|
||||
$(APPLE2_SRC_PATH)/audio/win-shim.c $(APPLE2_SRC_PATH)/audio/alhelpers.c $(APPLE2_SRC_PATH)/audio/mockingboard.c \
|
||||
$(APPLE2_SRC_PATH)/audio/AY8910.c
|
||||
$(APPLE2_SRC_PATH)/audio/alhelpers.c $(APPLE2_SRC_PATH)/audio/mockingboard.c $(APPLE2_SRC_PATH)/audio/AY8910.c
|
||||
|
||||
APPLE2_META_SRC = \
|
||||
$(APPLE2_SRC_PATH)/meta/debug.c $(APPLE2_SRC_PATH)/meta/debugger.c $(APPLE2_SRC_PATH)/meta/opcodes.c \
|
||||
|
@ -19,7 +19,7 @@ noinst_HEADERS = src/common.h src/cpu.h src/disk.h src/glue.h \
|
||||
src/audio/alhelpers.h src/audio/AY8910.h src/audio/ds-shim.h \
|
||||
src/audio/mockingboard.h src/audio/peripherals.h src/audio/soundcore.h \
|
||||
src/audio/soundcore-openal.h src/audio/speaker.h \
|
||||
src/audio/SSI263Phonemes.h src/audio/win-shim.h
|
||||
src/audio/SSI263Phonemes.h
|
||||
|
||||
noinst_PROGRAMS = genfont genrom
|
||||
|
||||
@ -45,8 +45,7 @@ VIDEO_SRC = \
|
||||
|
||||
AUDIO_SRC = \
|
||||
src/audio/soundcore.c src/audio/soundcore-openal.c src/audio/speaker.c \
|
||||
src/audio/win-shim.c src/audio/alhelpers.c src/audio/mockingboard.c \
|
||||
src/audio/AY8910.c
|
||||
src/audio/alhelpers.c src/audio/mockingboard.c src/audio/AY8910.c
|
||||
|
||||
META_SRC = \
|
||||
src/meta/debug.l src/meta/debugger.c src/meta/opcodes.c \
|
||||
|
@ -227,7 +227,7 @@ AC_ARG_ENABLE([audio], AS_HELP_STRING([--disable-audio], [Disable emulator audio
|
||||
AC_DEFINE(AUDIO_OPENAL, 1, [Enable OpenAL audio output])
|
||||
AC_DEFINE(AUDIO_ENABLED, 1, [Enable sound module])
|
||||
AUDIO_GLUE_C="src/audio/speaker.c src/audio/mockingboard.c"
|
||||
AUDIO_O="src/audio/soundcore.o src/audio/soundcore-openal.o src/audio/speaker.o src/audio/win-shim.o src/audio/alhelpers.o src/audio/mockingboard.o src/audio/AY8910.o"
|
||||
AUDIO_O="src/audio/soundcore.o src/audio/soundcore-openal.o src/audio/speaker.o src/audio/alhelpers.o src/audio/mockingboard.o src/audio/AY8910.o"
|
||||
], [
|
||||
AC_MSG_WARN([Could not find OpenAL libraries, sound will be disabled])
|
||||
], [])
|
||||
|
@ -25,9 +25,7 @@
|
||||
// [AppleWin-TC] From FUSE's sound.c module
|
||||
|
||||
#include "common.h"
|
||||
#ifdef APPLE2IX
|
||||
#include "audio/win-shim.h"
|
||||
#else
|
||||
#if !defined(APPLE2IX)
|
||||
#include "StdAfx.h"
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
@ -12,8 +12,6 @@
|
||||
#ifndef _DS_SHIM_H_
|
||||
#define _DS_SHIM_H_
|
||||
|
||||
#include "audio/win-shim.h"
|
||||
|
||||
// 2013/09/19 - http://msdn.microsoft.com/en-us/library/ms897820.aspx
|
||||
|
||||
typedef struct IDirectSoundBuffer {
|
||||
|
@ -80,16 +80,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include "common.h"
|
||||
#ifdef APPLE2IX
|
||||
#include "audio/win-shim.h"
|
||||
# ifdef __linux
|
||||
# include <sys/io.h>
|
||||
# endif
|
||||
|
||||
#define THREAD_PRIORITY_NORMAL 0
|
||||
#define THREAD_PRIORITY_TIME_CRITICAL 15
|
||||
#define STILL_ACTIVE 259
|
||||
extern bool GetExitCodeThread(pthread_t hThread, unsigned long *lpExitCode);
|
||||
extern pthread_t CreateThread(void* unused_lpThreadAttributes, int unused_dwStackSize, void *(*lpStartAddress)(void *unused), void *lpParameter, unsigned long unused_dwCreationFlags, unsigned long *lpThreadId);
|
||||
extern bool SetThreadPriority(pthread_t hThread, int nPriority);
|
||||
#else
|
||||
#include "StdAfx.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define LOG_SSI263 0
|
||||
|
||||
#include <wchar.h>
|
||||
@ -269,6 +275,75 @@ static unsigned long SSI263Thread(void *);
|
||||
#endif
|
||||
static void Votrax_Write(uint8_t nDevice, uint8_t nValue);
|
||||
|
||||
#ifdef APPLE2IX
|
||||
//---------------------------------------------------------------------------
|
||||
// Windows Shim Code ...
|
||||
|
||||
pthread_t CreateThread(void* unused_lpThreadAttributes, int unused_dwStackSize, void *(*lpStartRoutine)(void *stuff), void *lpParameter, unsigned long unused_dwCreationFlags, unsigned long *lpThreadId)
|
||||
{
|
||||
pthread_t a_thread = 0;
|
||||
int err = 0;
|
||||
if ((err = pthread_create(&a_thread, NULL, lpStartRoutine, lpParameter)))
|
||||
{
|
||||
ERRLOG("pthread_create");
|
||||
}
|
||||
|
||||
return a_thread;
|
||||
}
|
||||
|
||||
bool SetThreadPriority(pthread_t thread, int unused_nPriority)
|
||||
{
|
||||
// assuming time critical ...
|
||||
#if defined(__APPLE__)
|
||||
#warning possible FIXME possible TODO : set thread priority in Darwin/Mach ?
|
||||
#else
|
||||
int policy = sched_getscheduler(getpid());
|
||||
|
||||
int prio = 0;
|
||||
if ((prio = sched_get_priority_max(policy)) < 0)
|
||||
{
|
||||
ERRLOG("OOPS sched_get_priority_max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int err = 0;
|
||||
if ((err = pthread_setschedprio(thread, prio)))
|
||||
{
|
||||
ERRLOG("OOPS pthread_setschedprio");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool GetExitCodeThread(pthread_t thread, unsigned long *lpExitCode)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
int err = 0;
|
||||
if ( (err = pthread_join(thread, NULL)) ) {
|
||||
ERRLOG("OOPS pthread_join");
|
||||
}
|
||||
if (lpExitCode) {
|
||||
*lpExitCode = err;
|
||||
}
|
||||
#else
|
||||
if (pthread_tryjoin_np(thread, NULL))
|
||||
{
|
||||
if (lpExitCode)
|
||||
{
|
||||
*lpExitCode = STILL_ACTIVE;
|
||||
}
|
||||
}
|
||||
else if (lpExitCode)
|
||||
{
|
||||
*lpExitCode = 0;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void StartTimer(SY6522_AY8910* pMB)
|
||||
|
@ -13,7 +13,6 @@
|
||||
#define _MOCKINGBOARD_H__
|
||||
|
||||
#ifdef APPLE2IX
|
||||
#include "audio/win-shim.h"
|
||||
#include "audio/peripherals.h"
|
||||
|
||||
extern bool g_bDisableDirectSoundMockingboard;
|
||||
|
@ -13,7 +13,6 @@
|
||||
#define _PERIPHERALS_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "audio/win-shim.h"
|
||||
|
||||
typedef enum eIRQSRC {
|
||||
IS_6522=0x08, // NOTE : matches IRQ... defines in cpu.h
|
||||
|
@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "audio/win-shim.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Apple // emulator for *nix
|
||||
*
|
||||
* This software package is subject to the GNU General Public License
|
||||
* version 2 or later (your choice) as published by the Free Software
|
||||
* Foundation.
|
||||
*
|
||||
* THERE ARE NO WARRANTIES WHATSOEVER.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "audio/win-shim.h"
|
||||
|
||||
pthread_t CreateThread(void* unused_lpThreadAttributes, int unused_dwStackSize, LPTHREAD_START_ROUTINE lpStartRoutine, void *lpParameter, unsigned long unused_dwCreationFlags, unsigned long *lpThreadId)
|
||||
{
|
||||
pthread_t a_thread = 0;
|
||||
int err = 0;
|
||||
if ((err = pthread_create(&a_thread, NULL, lpStartRoutine, lpParameter)))
|
||||
{
|
||||
ERRLOG("pthread_create");
|
||||
}
|
||||
|
||||
return a_thread;
|
||||
}
|
||||
|
||||
bool SetThreadPriority(pthread_t thread, int unused_nPriority)
|
||||
{
|
||||
// assuming time critical ...
|
||||
#if defined(__APPLE__)
|
||||
#warning possible FIXME possible TODO : set thread priority in Darwin/Mach ?
|
||||
#else
|
||||
int policy = sched_getscheduler(getpid());
|
||||
|
||||
int prio = 0;
|
||||
if ((prio = sched_get_priority_max(policy)) < 0)
|
||||
{
|
||||
ERRLOG("OOPS sched_get_priority_max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int err = 0;
|
||||
if ((err = pthread_setschedprio(thread, prio)))
|
||||
{
|
||||
ERRLOG("OOPS pthread_setschedprio");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool GetExitCodeThread(pthread_t thread, unsigned long *lpExitCode)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
int err = 0;
|
||||
if ( (err = pthread_join(thread, NULL)) ) {
|
||||
ERRLOG("OOPS pthread_join");
|
||||
}
|
||||
if (lpExitCode) {
|
||||
*lpExitCode = err;
|
||||
}
|
||||
#else
|
||||
if (pthread_tryjoin_np(thread, NULL))
|
||||
{
|
||||
if (lpExitCode)
|
||||
{
|
||||
*lpExitCode = STILL_ACTIVE;
|
||||
}
|
||||
}
|
||||
else if (lpExitCode)
|
||||
{
|
||||
*lpExitCode = 0;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Apple // emulator for *nix
|
||||
*
|
||||
* This software package is subject to the GNU General Public License
|
||||
* version 2 or later (your choice) as published by the Free Software
|
||||
* Foundation.
|
||||
*
|
||||
* THERE ARE NO WARRANTIES WHATSOEVER.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WINSHIM_H_
|
||||
#define _WINSHIM_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#import <MacTypes.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is mostly a shim for Windows-related stuff but also contains some AppleWin-isms
|
||||
*
|
||||
*/
|
||||
|
||||
// 2013/09/19 - http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
|
||||
|
||||
typedef void *IUnknown;
|
||||
|
||||
typedef void *(*LPTHREAD_START_ROUTINE)(void *unused);
|
||||
|
||||
pthread_t CreateThread(void* unused_lpThreadAttributes, int unused_dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, void *lpParameter, unsigned long unused_dwCreationFlags, unsigned long *lpThreadId);
|
||||
|
||||
#define THREAD_PRIORITY_NORMAL 0
|
||||
#define THREAD_PRIORITY_TIME_CRITICAL 15
|
||||
bool SetThreadPriority(pthread_t hThread, int nPriority);
|
||||
|
||||
#define STILL_ACTIVE 259
|
||||
bool GetExitCodeThread(pthread_t hThread, unsigned long *lpExitCode);
|
||||
|
||||
#endif /* whole file */
|
||||
|
Loading…
Reference in New Issue
Block a user