add dummy cdrom, fix joystick init, small audio changes

This commit is contained in:
dborth 2009-04-30 05:38:31 +00:00
parent 3071956417
commit a8da628b77
4 changed files with 20 additions and 23 deletions

View file

@ -87,7 +87,7 @@ $(BIN_DIR)/%.dol: $(TEST_OBJ_DIR)/%.elf
# Compilation flags. # Compilation flags.
COMMON_FLAGS := -g -O2 -mrvl -Wall -mcpu=750 -meabi -mhard-float $(MACHDEP) COMMON_FLAGS := -g -O2 -mrvl -Wall -mcpu=750 -meabi -mhard-float $(MACHDEP)
INCLUDES := -Iinclude -I$(DEVKITPRO)/libogc/include INCLUDES := -Iinclude -I$(DEVKITPRO)/libogc/include
DEFINES := -DGEKKO -DSDL_AUDIO_DRIVER_WII DEFINES := -DGEKKO
CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES) CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES)
# Test link flags. # Test link flags.

View file

@ -88,11 +88,10 @@ typedef unsigned int uintptr_t;
#define HAVE_SETJMP 1 #define HAVE_SETJMP 1
/* Supported audio drivers. */ /* Supported audio drivers. */
/* #define SDL_AUDIO_DRIVER_WII 1 */ #define SDL_AUDIO_DRIVER_WII 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */ /* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DISABLED 1 #define SDL_CDROM_DUMMY 1
/* Enable the wii joystick driver */ /* Enable the wii joystick driver */
#define SDL_JOYSTICK_WII 1 #define SDL_JOYSTICK_WII 1
@ -102,10 +101,8 @@ typedef unsigned int uintptr_t;
/* Enable thread support */ /* Enable thread support */
#define SDL_THREAD_WII 1 #define SDL_THREAD_WII 1
/*#define SDL_THREADS_DISABLED */
/* Supported video drivers. */ /* Supported video drivers. */
#define SDL_VIDEO_DRIVER_WII 1 #define SDL_VIDEO_DRIVER_WII 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#endif /* _SDL_config_minimal_h */ #endif /* _SDL_config_minimal_h */

View file

@ -140,11 +140,6 @@ static int WIIAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
spec->padding = 0; spec->padding = 0;
SDL_CalculateAudioSpec(spec); SDL_CalculateAudioSpec(spec);
// Initialise the Wii side of the audio system.
AUDIO_Init(0);
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
AUDIO_RegisterDMACallback(DMACallback);
memset(dma_buffers[0], 0, SAMPLES_PER_DMA_BUFFER); memset(dma_buffers[0], 0, SAMPLES_PER_DMA_BUFFER);
memset(dma_buffers[1], 0, SAMPLES_PER_DMA_BUFFER); memset(dma_buffers[1], 0, SAMPLES_PER_DMA_BUFFER);
@ -174,9 +169,6 @@ static Uint8 *WIIAUD_GetAudioBuf(_THIS)
static void WIIAUD_CloseAudio(_THIS) static void WIIAUD_CloseAudio(_THIS)
{ {
// Forget the DMA callback
AUDIO_RegisterDMACallback(0);
// Stop any DMA going on // Stop any DMA going on
AUDIO_StopDMA(); AUDIO_StopDMA();
@ -192,6 +184,9 @@ static void WIIAUD_DeleteDevice(SDL_AudioDevice *device)
// Stop any DMA going on // Stop any DMA going on
AUDIO_StopDMA(); AUDIO_StopDMA();
// terminate conversion thread
LWP_ThreadSignal(audioqueue);
SDL_free(device->hidden); SDL_free(device->hidden);
SDL_free(device); SDL_free(device);
} }
@ -216,6 +211,11 @@ static SDL_AudioDevice *WIIAUD_CreateDevice(int devindex)
} }
SDL_memset(this->hidden, 0, (sizeof *this->hidden)); SDL_memset(this->hidden, 0, (sizeof *this->hidden));
// Initialise the Wii side of the audio system
AUDIO_Init(0);
AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
AUDIO_RegisterDMACallback(DMACallback);
/* Set the function pointers */ /* Set the function pointers */
this->OpenAudio = WIIAUD_OpenAudio; this->OpenAudio = WIIAUD_OpenAudio;
this->WaitAudio = WIIAUD_WaitAudio; this->WaitAudio = WIIAUD_WaitAudio;

View file

@ -87,17 +87,16 @@ static int __jspad_enabled = 1;
static int __numwiijoysticks = 4; static int __numwiijoysticks = 4;
static int __numgcjoysticks = 4; static int __numgcjoysticks = 4;
static int __scan_pads_callback_set = 0; static int __num_joysticks_open = 0;
/* Function to scan the system for joysticks. /* Function to scan the system for joysticks.
* This function should set SDL_numjoysticks to the number of available * This function should return the number of available
* joysticks. Joystick 0 should be the system default joystick. * joysticks. Joystick 0 should be the system default joystick.
* It should return 0, or -1 on an unrecoverable fatal error. * It should return -1 on an unrecoverable fatal error.
*/ */
int SDL_SYS_JoystickInit(void) int SDL_SYS_JoystickInit(void)
{ {
SDL_numjoysticks = 8; return 8;
return 0;
} }
static char joy_name[] = "Gamecube 0"; static char joy_name[] = "Gamecube 0";
@ -159,8 +158,9 @@ int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
} }
/* Update pads at vertical retrace */ /* Update pads at vertical retrace */
VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB); if(__num_joysticks_open == 0)
__scan_pads_callback_set++; VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB);
__num_joysticks_open++;
return(0); return(0);
} }
@ -398,8 +398,8 @@ void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
SDL_free(joystick->hwdata); SDL_free(joystick->hwdata);
/* Clear callback again */ /* Clear callback again */
__scan_pads_callback_set--; __num_joysticks_open--;
if ( __scan_pads_callback_set == 0 ) if (__num_joysticks_open == 0)
VIDEO_SetPostRetraceCallback (NULL); VIDEO_SetPostRetraceCallback (NULL);
} }