-Added NDS Sound emulation(spu.c/spu.h)
-Fixed a few odd bugs -Added a new sound core system(pretty much taken right out of yabause) -Added Wav file write core -Added dummy core(it's currently set as the default) -Added Direct Sound core(windows port only) -There's still a number of issues with sound. I really don't understand what's causing them.
This commit is contained in:
parent
10bd92e7c1
commit
bbdd032c12
|
@ -63,7 +63,7 @@ case $target in
|
|||
AC_SUBST([UI_DIR])
|
||||
;;
|
||||
*mingw*)
|
||||
LIBS="$LIBS -mwindows"
|
||||
LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -mwindows"
|
||||
UI_DIR=windows
|
||||
AC_SUBST([UI_DIR])
|
||||
;;
|
||||
|
|
|
@ -331,6 +331,7 @@ u8 FASTCALL MMU_read8(u32 proc, u32 adr)
|
|||
return (unsigned char)cflash_read(adr);
|
||||
|
||||
adr &= 0x0FFFFFFF;
|
||||
|
||||
switch(adr)
|
||||
{
|
||||
case 0x027FFCDC :
|
||||
|
@ -366,7 +367,7 @@ u16 FASTCALL MMU_read16(u32 proc, u32 adr)
|
|||
return (unsigned short)cflash_read(adr);
|
||||
|
||||
adr &= 0x0FFFFFFF;
|
||||
|
||||
|
||||
if((adr>>24)==4)
|
||||
{
|
||||
/* Adress is an IO register */
|
||||
|
@ -554,9 +555,19 @@ void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val)
|
|||
cflash_write(adr,val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
adr &= 0x0FFFFFFF;
|
||||
|
||||
|
||||
// This is bad, remove it
|
||||
if(proc == ARMCPU_ARM7)
|
||||
{
|
||||
if ((adr>=0x04000400)&&(adr<0x0400051D))
|
||||
{
|
||||
SPU_WriteByte(adr, val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch(adr)
|
||||
{
|
||||
/* TODO: EEEK ! Controls for VRAMs A, B, C, D are missing ! */
|
||||
|
@ -687,8 +698,7 @@ void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val)
|
|||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef LOG_CARD
|
||||
#ifdef LOG_CARD
|
||||
case 0x040001A0 : /* TODO (clear): ??? */
|
||||
case 0x040001A1 :
|
||||
case 0x040001A2 :
|
||||
|
@ -727,9 +737,19 @@ void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val)
|
|||
cflash_write(adr,val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
adr &= 0x0FFFFFFF;
|
||||
|
||||
// This is bad, remove it
|
||||
if(proc == ARMCPU_ARM7)
|
||||
{
|
||||
if ((adr>=0x04000400)&&(adr<0x0400051D))
|
||||
{
|
||||
SPU_WriteWord(adr, val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if((adr >> 24) == 4)
|
||||
{
|
||||
/* Adress is an IO register */
|
||||
|
@ -1310,9 +1330,19 @@ void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
|
|||
cflash_write(adr,val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
adr &= 0x0FFFFFFF;
|
||||
|
||||
|
||||
// This is bad, remove it
|
||||
if(proc == ARMCPU_ARM7)
|
||||
{
|
||||
if ((adr>=0x04000400)&&(adr<0x0400051D))
|
||||
{
|
||||
SPU_WriteLong(adr, val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if((adr>>24)==4)
|
||||
{
|
||||
switch(adr)
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
SUBDIRS = . $(UI_DIR)
|
||||
noinst_LIBRARIES = libdesmume.a
|
||||
libdesmume_a_SOURCES = \
|
||||
armcpu.c armcpu.h \
|
||||
armcpu.c armcpu.h ARM9.h \
|
||||
arm_instructions.c arm_instructions.h \
|
||||
bios.c bios.h cp15.c cp15.h \
|
||||
cflash.c cflash.h fs.h \
|
||||
debug.c debug.h \
|
||||
Disassembler.c Disassembler.h \
|
||||
FIFO.c FIFO.h \
|
||||
debug.c debug.h \
|
||||
MMU.c MMU.h NDSSystem.c NDSSystem.h \
|
||||
thumb_instructions.c thumb_instructions.h \
|
||||
mc.c mc.h \
|
||||
GPU.c GPU.h \
|
||||
ARM9.h \
|
||||
cflash.c cflash.h fs.h \
|
||||
saves.c saves.h
|
||||
mc.c mc.h \
|
||||
MMU.c MMU.h NDSSystem.c NDSSystem.h \
|
||||
saves.c saves.h \
|
||||
SPU.c SPU.h \
|
||||
thumb_instructions.c thumb_instructions.h
|
||||
libdesmume_a_LIBADD = fs-$(desmume_arch).$(OBJEXT)
|
||||
|
|
|
@ -39,6 +39,10 @@ void NDS_Init(void) {
|
|||
armcpu_new(&NDS_ARM7,1);
|
||||
armcpu_new(&NDS_ARM9,0);
|
||||
|
||||
// if (SPU_Init(SNDCORE_FILEWRITE, 735) != 0)
|
||||
if (SPU_Init(SNDCORE_DUMMY, 735) != 0)
|
||||
return -1;
|
||||
|
||||
//ARM7 BIOS IRQ HANDLER
|
||||
MMU_writeWord(1, 0x00, 0xE25EF002);
|
||||
MMU_writeWord(1, 0x04, 0xEAFFFFFE);
|
||||
|
@ -75,6 +79,7 @@ void NDS_DeInit(void) {
|
|||
NDS_FreeROM();
|
||||
|
||||
nds.nextHBlank = 3168;
|
||||
SPU_DeInit();
|
||||
Screen_DeInit();
|
||||
MMU_DeInit();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "MMU.h"
|
||||
|
||||
#include "GPU.h"
|
||||
#include "SPU.h"
|
||||
|
||||
#include "mem.h"
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,94 @@
|
|||
/* Copyright (C) 2006 Theo Berkau
|
||||
|
||||
This file is part of DeSmuME
|
||||
|
||||
DeSmuME is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
DeSmuME is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DeSmuME; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef SPU_H
|
||||
#define SPU_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define SNDCORE_DEFAULT -1
|
||||
#define SNDCORE_DUMMY 0
|
||||
#define SNDCORE_FILEWRITE 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
const char *Name;
|
||||
int (*Init)(int buffersize);
|
||||
void (*DeInit)();
|
||||
void (*UpdateAudio)(s16 *buffer, u32 num_samples);
|
||||
u32 (*GetAudioSpace)();
|
||||
void (*MuteAudio)();
|
||||
void (*UnMuteAudio)();
|
||||
void (*SetVolume)(int volume);
|
||||
} SoundInterface_struct;
|
||||
|
||||
extern SoundInterface_struct SNDDummy;
|
||||
extern SoundInterface_struct SNDFile;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 vol;
|
||||
u8 datashift;
|
||||
u8 hold;
|
||||
u8 pan;
|
||||
u8 waveduty;
|
||||
u8 repeat;
|
||||
u8 format;
|
||||
u8 status;
|
||||
u32 addr;
|
||||
u16 timer;
|
||||
u16 loopstart;
|
||||
u32 length;
|
||||
s8 *buf8;
|
||||
s16 *buf16;
|
||||
double sampcnt;
|
||||
double sampinc;
|
||||
// ADPCM specific
|
||||
int lastsampcnt;
|
||||
s16 pcm16b;
|
||||
int index;
|
||||
} channel_struct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// u8 mvol;
|
||||
// u8 lout;
|
||||
// u8 rout;
|
||||
BOOL enable;
|
||||
u32 bufpos;
|
||||
u32 buflength;
|
||||
s32 *sndbuf;
|
||||
s16 *outbuf;
|
||||
u32 bufsize;
|
||||
channel_struct chan[16];
|
||||
} SPU_struct;
|
||||
|
||||
extern SPU_struct *SPU;
|
||||
|
||||
int SPU_Init(int coreid, int buffersize);
|
||||
void SPU_Reset(void);
|
||||
void SPU_DeInit(void);
|
||||
void SPU_KeyOn(int channel);
|
||||
void SPU_WriteByte(u32 addr, u8 val);
|
||||
void SPU_WriteWord(u32 addr, u16 val);
|
||||
void SPU_WriteLong(u32 addr, u32 val);
|
||||
void SPU_Emulate(void);
|
||||
|
||||
#endif
|
|
@ -6,6 +6,7 @@ desmume_SOURCES = \
|
|||
main.cpp mapView.c mapView.h memView.c memView.h \
|
||||
oamView.c oamView.h palView.c palView.h \
|
||||
resource.h \
|
||||
snddx.c snddx.h \
|
||||
tileView.c tileView.h yopyop_private.h \
|
||||
ConfigKeys.c ConfigKeys.h
|
||||
desmume_LDADD = ../libdesmume.a yopyop_private.o
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "../saves.h"
|
||||
#include "../cflash.h"
|
||||
#include "ConfigKeys.h"
|
||||
#include "snddx.h"
|
||||
|
||||
#ifdef RENDER3D
|
||||
#include "OGLRender.h"
|
||||
|
@ -72,6 +73,13 @@ HMENU menu;
|
|||
const DWORD tabkey[48]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,VK_SPACE,VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT,VK_TAB,VK_SHIFT,VK_DELETE,VK_INSERT,VK_HOME,VK_END,0x0d};
|
||||
DWORD ds_up,ds_down,ds_left,ds_right,ds_a,ds_b,ds_x,ds_y,ds_l,ds_r,ds_select,ds_start,ds_debug;
|
||||
|
||||
SoundInterface_struct *SNDCoreList[] = {
|
||||
&SNDDummy,
|
||||
&SNDFile,
|
||||
&SNDDIRECTX,
|
||||
NULL
|
||||
};
|
||||
|
||||
DWORD WINAPI run( LPVOID lpParameter)
|
||||
{
|
||||
u64 count;
|
||||
|
@ -107,6 +115,8 @@ DWORD WINAPI run( LPVOID lpParameter)
|
|||
while(execute)
|
||||
{
|
||||
cycles = NDS_exec((560190<<1)-cycles,FALSE);
|
||||
SPU_Emulate();
|
||||
|
||||
++nbframe;
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&count);
|
||||
if(nextcount<=count)
|
||||
|
@ -229,11 +239,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
case WM_DESTROY:
|
||||
execute = FALSE;
|
||||
finished = TRUE;
|
||||
NDS_DeInit();
|
||||
PostQuitMessage (0); // send a WM_QUIT to the message queue
|
||||
return 0;
|
||||
case WM_CLOSE:
|
||||
execute = FALSE;
|
||||
finished = TRUE;
|
||||
NDS_DeInit();
|
||||
PostMessage(hwnd, WM_QUIT, 0, 0);
|
||||
return 0;
|
||||
case WM_DROPFILES:
|
||||
|
@ -301,7 +313,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
if(wParam==tabkey[ds_debug]){
|
||||
((u16 *)MMU.ARM7_REG)[0x136>>1] &= 0xFFFB;
|
||||
return 0; }
|
||||
break;
|
||||
return 0;
|
||||
/*case 0x1E :
|
||||
MMU.ARM7_REG[0x136] &= 0xFE;
|
||||
break;
|
||||
|
@ -728,7 +740,5 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
NDS_DeInit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue