diff --git a/.gitignore b/.gitignore index 3a15de49..7ca9e302 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ VisualGDB/VisualGDB/Release/gencpu VisualGDB/VisualGDB/Release/gencomp *.tlog VSLinux/obj/ARM/Debug/amiberry-sdl2-dev +VisualGDB/VisualGDB/Debug/Amiberry-sdl2-dev diff --git a/Makefile b/Makefile index 819cb282..367972e3 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,12 @@ guisan: cd src/guisan && make all && cd ../.. DEBUG=1 -PANDORA=1 SDL_CFLAGS = `sdl2-config --cflags --libs` -DEFS += `xml2-config --cflags` -DEFS += -DCPU_arm -DARMV6_ASSEMBLY -DAMIBERRY -DPICASSO96 -DEFS += -DWITH_INGAME_WARNING -DRASPBERRY -DCAPSLOCK_DEBIAN_WORKAROUND +DEFS += `xml2-config --cflags` +DEFS += -DARMV6_ASSEMBLY -DAMIBERRY +DEFS += -DCAPSLOCK_DEBIAN_WORKAROUND DEFS += -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" DEFS += -DUSE_SDL diff --git a/VSLinux/Amiberry.vcxproj b/VSLinux/Amiberry.vcxproj index 114f2317..c305cc2e 100644 --- a/VSLinux/Amiberry.vcxproj +++ b/VSLinux/Amiberry.vcxproj @@ -400,7 +400,6 @@ false - false diff --git a/VSLinux/Amiberry.vcxproj.filters b/VSLinux/Amiberry.vcxproj.filters index 52f036d1..e8a68f59 100644 --- a/VSLinux/Amiberry.vcxproj.filters +++ b/VSLinux/Amiberry.vcxproj.filters @@ -603,9 +603,6 @@ src\osdep\menu - - src\sounddep - src\sounddep diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj b/VisualGDB/Amiberry/Amiberry.vcxproj index 5a2a70c1..5ad7934a 100644 --- a/VisualGDB/Amiberry/Amiberry.vcxproj +++ b/VisualGDB/Amiberry/Amiberry.vcxproj @@ -31,31 +31,31 @@ Debug C:\SysGCC\raspberry - $(ProjectName)-sdl2 + $(ProjectName)-sdl2-dev C:\SysGCC\raspberry - $(ProjectName)-sdl2 + $(ProjectName)-sdl2-dev C:\SysGCC\raspberry - $(ProjectName)-sdl2-rpi2 + $(ProjectName)-sdl2-dev-rpi2 C:\SysGCC\raspberry - $(ProjectName)-sdl2-rpi1 + $(ProjectName)-sdl2-dev-rpi1 GNUPP14 C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - DEBUG=1;_REENTRANT;RASPBERRY;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;PICASSO96;USE_ARMNEON;CPU_arm;ARMV6_ASSEMBLY;AMIBERRY;WITH_INGAME_WARNING;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) + DEBUG=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe %(AdditionalOptions) -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) - SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;%(Link.AdditionalLibraryNames) + SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) =/usr/local/lib;%(ExtraRPATH) @@ -64,7 +64,7 @@ GNUPP14 C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;_REENTRANT;RASPBERRY;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;PICASSO96;USE_ARMNEON;CPU_arm;ARMV6_ASSEMBLY;AMIBERRY;WITH_INGAME_WARNING;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) + NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -fweb %(AdditionalOptions) true true @@ -72,7 +72,7 @@ -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) - SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;%(Link.AdditionalLibraryNames) + SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) =/usr/local/lib;%(ExtraRPATH) @@ -81,7 +81,7 @@ GNUPP14 C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;_REENTRANT;RASPBERRY;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;PICASSO96;USE_ARMNEON;CPU_arm;ARMV6_ASSEMBLY;AMIBERRY;WITH_INGAME_WARNING;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) + NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -pipe -fweb %(AdditionalOptions) true true @@ -89,7 +89,7 @@ -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) - SDL2;pthread;m;z;SDL2_image;png;rt;xml2;FLAC;mpg123;dl;SDL2_ttf;guisan;%(Link.AdditionalLibraryNames) + SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) =/usr/local/lib;%(ExtraRPATH) @@ -99,7 +99,7 @@ GNUPP14 C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) - NDEBUG=1;RELEASE=1;_REENTRANT;RASPBERRY;CAPSLOCK_DEBIAN_WORKAROUND;PICASSO96;CPU_arm;ARMV6_ASSEMBLY;AMIBERRY;WITH_INGAME_WARNING;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) + NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe -fweb %(AdditionalOptions) true true @@ -107,7 +107,7 @@ -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) - SDL2;pthread;m;z;SDL2_image;png;rt;xml2;FLAC;mpg123;dl;SDL2_ttf;guisan;%(Link.AdditionalLibraryNames) + SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) =/usr/local/lib;%(ExtraRPATH) diff --git a/src/fsdb_unix.cpp b/src/fsdb_unix.cpp index ee95a1f3..baaa11a1 100644 --- a/src/fsdb_unix.cpp +++ b/src/fsdb_unix.cpp @@ -83,7 +83,7 @@ int fsdb_fill_file_attrs (a_inode *base, a_inode *aino) | (S_IWUSR & statbuf.st_mode ? 0 : A_FIBF_WRITE) | (S_IRUSR & statbuf.st_mode ? 0 : A_FIBF_READ)); -#if defined(WIN32) || defined(ANDROIDSDL) || defined(RASPBERRY) +#if defined(WIN32) || defined(ANDROIDSDL) || defined(AMIBERRY) // Always give execute & read permission // Temporary do this for raspberry... aino->amigaos_mode &= ~A_FIBF_EXECUTE; diff --git a/src/osdep/amiberry_gui.cpp b/src/osdep/amiberry_gui.cpp index d5b77f70..03f10d17 100644 --- a/src/osdep/amiberry_gui.cpp +++ b/src/osdep/amiberry_gui.cpp @@ -22,7 +22,7 @@ #include "blkdev.h" #include -#ifdef RASPBERRY +#ifdef AMIBERRY #include #include #endif diff --git a/src/osdep/gui/PanelMisc.cpp b/src/osdep/gui/PanelMisc.cpp index 0fbab8cd..72c2f7da 100644 --- a/src/osdep/gui/PanelMisc.cpp +++ b/src/osdep/gui/PanelMisc.cpp @@ -27,7 +27,6 @@ static gcn::UaeDropDown* KeyForQuit; static gcn::Label* lblButtonForQuit; static gcn::UaeDropDown* ButtonForQuit; -#ifdef RASPBERRY class StringListModel : public gcn::ListModel { vector values; @@ -59,7 +58,6 @@ static gcn::UaeDropDown* cboKBDLed_scr; const char* listValues[] = {"none", "POWER", "DF0", "DF1", "DF2", "DF3", "DF*", "HD", "CD"}; StringListModel KBDLedList(listValues, 9); -#endif static const int ControlKey_SDLKeyValues[] = {0, SDL_SCANCODE_F11, SDL_SCANCODE_F12}; @@ -119,13 +117,11 @@ public: else if (actionEvent.getSource() == ButtonForQuit) changed_prefs.button_for_quit = ControlButton_SDLButtonValues[ButtonForQuit->getSelected()]; -#ifdef RASPBERRY else if (actionEvent.getSource() == cboKBDLed_num) changed_prefs.kbd_led_num = cboKBDLed_num->getSelected(); else if (actionEvent.getSource() == cboKBDLed_scr) changed_prefs.kbd_led_scr = cboKBDLed_scr->getSelected(); -#endif } }; @@ -249,12 +245,11 @@ void ExitPanelMisc() delete chkShowGUI; delete chkBSDSocket; -#ifdef RASPBERRY delete lblScrLock; delete lblNumLock; delete cboKBDLed_num; delete cboKBDLed_scr; -#endif + delete miscActionListener; delete lblKeyForMenu; delete KeyForMenu; @@ -272,12 +267,10 @@ void RefreshPanelMisc() chkStatusLine->setSelected(changed_prefs.leds_on_screen); chkShowGUI->setSelected(changed_prefs.start_gui); - chkBSDSocket->setSelected(changed_prefs.socket_emu); -#ifdef RASPBERRY cboKBDLed_num->setSelected(changed_prefs.kbd_led_num); cboKBDLed_scr->setSelected(changed_prefs.kbd_led_scr); -#endif + KeyForMenu->setSelected(GetControlKeyIndex(changed_prefs.key_for_menu)); KeyForQuit->setSelected(GetControlKeyIndex(changed_prefs.key_for_quit)); ButtonForMenu->setSelected(GetControlButtonIndex(changed_prefs.button_for_menu)); diff --git a/src/osdep/gui/SelectFile.cpp b/src/osdep/gui/SelectFile.cpp index cd19a8e8..42b721a2 100644 --- a/src/osdep/gui/SelectFile.cpp +++ b/src/osdep/gui/SelectFile.cpp @@ -18,7 +18,7 @@ #define DIALOG_WIDTH 520 #define DIALOG_HEIGHT 400 -#if defined(RASPBERRY) || defined(ANDROID) +#if defined(AMIBERRY) || defined(ANDROID) #define FILE_SELECT_KEEP_POSITION #endif diff --git a/src/osdep/menu/menu_config.cpp b/src/osdep/menu/menu_config.cpp index 137107f2..8e5e8211 100644 --- a/src/osdep/menu/menu_config.cpp +++ b/src/osdep/menu/menu_config.cpp @@ -423,7 +423,7 @@ int loadconfig_old(struct uae_prefs* p, const char* orgpath) int dummy; fscanf(f, "kickstart=%d\n", &kickstart); -#if defined(RASPBERRY) || defined(ANDROIDSDL) +#if defined(AMIBERRY) || defined(ANDROIDSDL) fscanf(f, "scaling=%d\n", &dummy); #else fscanf(f, "scaling=%d\n", &mainMenu_enableHWscaling); @@ -431,7 +431,7 @@ int loadconfig_old(struct uae_prefs* p, const char* orgpath) fscanf(f, "showstatus=%d\n", &p->leds_on_screen); fscanf(f, "mousemultiplier=%d\n", &p->input_joymouse_multiplier); p->input_joymouse_multiplier *= 10; -#if defined(RASPBERRY) || defined(ANDROIDSDL) +#if defined(AMIBERRY) || defined(ANDROIDSDL) fscanf(f, "systemclock=%d\n", &dummy); // mainMenu_throttle never changes -> removed fscanf(f, "syncthreshold=%d\n", &dummy); // timeslice_mode never changes -> removed #else diff --git a/src/osdep/picasso96.cpp b/src/osdep/picasso96.cpp index 73812995..02bc9292 100644 --- a/src/osdep/picasso96.cpp +++ b/src/osdep/picasso96.cpp @@ -30,15 +30,6 @@ * programs started from a Picasso workbench. */ -/* - * Note: This is the Pandora specific version of Picasso96: - * - only 16 bit color mode is available (R5G6B5) in hardware - * - we simulate R8G8B8A8 on Amiga side and use Neon-code to convert to R5G6B5 - * - we have no hardware sprite for mouse pointer - * I removed some code which handled unsupported modes and formats to make code - * easier to read. - */ - #include "sysconfig.h" #include "sysdeps.h" @@ -888,7 +879,7 @@ void picasso_handle_vsync() #define BLT_FUNC(s,d) *d = (*s) | (*d) #include "p96_blit.cpp" #define BLT_NAME BLIT_TRUE_32 -#ifdef RASPBERRY +#ifdef AMIBERRY #define BLT_FUNC(s,d) memset(d, 0xff, sizeof (*d)) #else #define BLT_FUNC(s,d) *d = 0xffffffff @@ -943,7 +934,7 @@ void picasso_handle_vsync() #define BLT_FUNC(s,d) *d = (*s) | (*d) #include "p96_blit.cpp" #define BLT_NAME BLIT_TRUE_24 -#ifdef RASPBERRY +#ifdef AMIBERRY #define BLT_FUNC(s,d) memset(d, 0xff, sizeof (*d)) #else #define BLT_FUNC(s,d) *d = 0xffffffff @@ -998,7 +989,7 @@ void picasso_handle_vsync() #define BLT_FUNC(s,d) *d = (*s) | (*d) #include "p96_blit.cpp" #define BLT_NAME BLIT_TRUE_16 -#ifdef RASPBERRY +#ifdef AMIBERRY #define BLT_FUNC(s,d) memset(d, 0xff, sizeof (*d)) #else #define BLT_FUNC(s,d) *d = 0xffffffff @@ -1053,7 +1044,7 @@ void picasso_handle_vsync() #define BLT_FUNC(s,d) *d = (*s) | (*d) #include "p96_blit.cpp" #define BLT_NAME BLIT_TRUE_8 -#ifdef RASPBERRY +#ifdef AMIBERRY #define BLT_FUNC(s,d) memset(d, 0xff, sizeof (*d)) #else #define BLT_FUNC(s,d) *d = 0xffffffff diff --git a/src/osdep/sysconfig.h b/src/osdep/sysconfig.h index 0ff32a43..ece93d65 100644 --- a/src/osdep/sysconfig.h +++ b/src/osdep/sysconfig.h @@ -36,7 +36,7 @@ #define CPUEMU_11 /* 68000+prefetch emulation */ /* #define CPUEMU_12 */ /* cycle-exact cpu&blitter */ /* #define ACTION_REPLAY */ /* Action Replay 1/2/3 support */ -/* #define PICASSO96 */ /* Picasso96 display card emulation */ +#define PICASSO96 /* Picasso96 display card emulation */ /* #define UAEGFX_INTERNAL */ /* built-in libs:picasso96/uaegfx.card */ #define BSDSOCKET /* bsdsocket.library emulation */ /* #define CAPS */ /* CAPS-image support */ diff --git a/src/sounddep/sound.cpp b/src/sounddep/sound.cpp deleted file mode 100644 index 1b2705fc..00000000 --- a/src/sounddep/sound.cpp +++ /dev/null @@ -1,317 +0,0 @@ - /* - * Minimalistic sound.c implementation for gp2x - * (c) notaz, 2007 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "sysconfig.h" -#include "sysdeps.h" -#include "uae.h" -#include "options.h" -#include "memory.h" -#include "newcpu.h" -#include "custom.h" -#include "audio.h" -#include "gensound.h" -#include "sd-pandora/sound.h" -#include "savestate.h" - - -uae_u16 sndbuffer[4][(SNDBUFFER_LEN+32)*DEFAULT_SOUND_CHANNELS]; -uae_u16 *sndbufpt = sndbuffer[0]; -uae_u16 *render_sndbuff = sndbuffer[0]; -uae_u16 *finish_sndbuff = sndbuffer[0] + SNDBUFFER_LEN*2; - -uae_u16 cdaudio_buffer[CDAUDIO_BUFFERS][(CDAUDIO_BUFFER_LEN + 32) * 2]; -uae_u16 *cdbufpt = cdaudio_buffer[0]; -uae_u16 *render_cdbuff = cdaudio_buffer[0]; -uae_u16 *finish_cdbuff = cdaudio_buffer[0] + CDAUDIO_BUFFER_LEN * 2; -bool cdaudio_active = false; -static int cdwrcnt = 0; -static int cdrdcnt = 0; - -static int have_sound = 0; -static int lastfreq; - -void update_sound (float clk) -{ - float evtime; - - evtime = clk * CYCLE_UNIT / (float)currprefs.sound_freq; - scaled_sample_evtime = (int)evtime; -} - - -static int sounddev = -1, s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0; -static int sound_thread_active = 0, sound_thread_exit = 0; -static sem_t sound_sem; -static sem_t sound_out_sem; -static int output_cnt = 0; -static int wrcnt = 0; - -static void *sound_thread(void *unused) -{ - int cnt = 0, sem_val = 0; - sound_thread_active = 1; - - for (;;) - { - sem_getvalue(&sound_sem, &sem_val); - while (sem_val > 1) - { - sem_wait(&sound_sem); - sem_getvalue(&sound_sem, &sem_val); - } - - sem_wait(&sound_sem); - if (sound_thread_exit) - break; - - cnt = output_cnt; - sem_post(&sound_out_sem); - - if(currprefs.sound_stereo) { - if(cdaudio_active && currprefs.sound_freq == 44100 && cdrdcnt < cdwrcnt) { - for(int i=0; i 22050) { bsize*=4; buffers*=2; } // 44k mode seems to be very demanding - while ((bsize>>=1)) frag++; - frag |= buffers<<16; // 16 buffers - ioctl(sounddev, SNDCTL_DSP_SETFRAGMENT, &frag); - - s_oldrate = rate; - s_oldbits = bits; - s_oldstereo = stereo; - usleep(100000); - return 0; -} - - -// this is meant to be called only once on exit -void pandora_stop_sound(void) -{ - if (sound_thread_exit) - printf("don't call pandora_stop_sound more than once!\n"); - if (sound_thread_active) - { - sound_thread_exit = 1; - sem_post(&sound_sem); - sem_wait(&sound_out_sem); - sem_destroy(&sound_sem); - sem_destroy(&sound_out_sem); - } - - if (sounddev > 0) - close(sounddev); - sounddev = -1; -} - - -void finish_sound_buffer (void) -{ - output_cnt = wrcnt; - - sem_post(&sound_sem); - sem_wait(&sound_out_sem); - - wrcnt++; - sndbufpt = render_sndbuff = sndbuffer[wrcnt&3]; - if(currprefs.sound_stereo) - finish_sndbuff = sndbufpt + SNDBUFFER_LEN; - else - finish_sndbuff = sndbufpt + SNDBUFFER_LEN/2; -} - - -void pause_sound_buffer (void) -{ - reset_sound (); -} - - -void restart_sound_buffer(void) -{ - sndbufpt = render_sndbuff = sndbuffer[wrcnt&3]; - if(currprefs.sound_stereo) - finish_sndbuff = sndbufpt + SNDBUFFER_LEN; - else - finish_sndbuff = sndbufpt + SNDBUFFER_LEN/2; - - cdbufpt = render_cdbuff = cdaudio_buffer[cdwrcnt & (CDAUDIO_BUFFERS - 1)]; - finish_cdbuff = cdbufpt + CDAUDIO_BUFFER_LEN * 2; -} - - -void finish_cdaudio_buffer (void) -{ - cdwrcnt++; - cdbufpt = render_cdbuff = cdaudio_buffer[cdwrcnt & (CDAUDIO_BUFFERS - 1)]; - finish_cdbuff = cdbufpt + CDAUDIO_BUFFER_LEN; - audio_activate(); -} - - -bool cdaudio_catchup(void) -{ - while((cdwrcnt > cdrdcnt + CDAUDIO_BUFFERS - 10) && (sound_thread_active != 0) && (quit_program == 0)) { - sleep_millis(10); - } - return (sound_thread_active != 0); -} - - -/* Try to determine whether sound is available. This is only for GUI purposes. */ -int setup_sound (void) -{ - if (pandora_start_sound(currprefs.sound_freq, 16, currprefs.sound_stereo) != 0) - return 0; - - sound_available = 1; - return 1; -} - -static int open_sound (void) -{ - if (pandora_start_sound(currprefs.sound_freq, 16, currprefs.sound_stereo) != 0) - return 0; - - have_sound = 1; - sound_available = 1; - - if(currprefs.sound_stereo) - sample_handler = sample16s_handler; - else - sample_handler = sample16_handler; - - return 1; -} - -void close_sound (void) -{ - if (!have_sound) - return; - - // testing shows that reopenning sound device is not a good idea on pandora (causes random sound driver crashes) - // we will close it on real exit instead - //pandora_stop_sound(); - have_sound = 0; -} - -int init_sound (void) -{ - have_sound=open_sound(); - return have_sound; -} - -void pause_sound (void) -{ - /* nothing to do */ -} - -void resume_sound (void) -{ - /* nothing to do */ -} - -void reset_sound (void) -{ - if (!have_sound) - return; - - init_soundbuffer_usage(); - - clear_sound_buffers(); - clear_cdaudio_buffers(); -} - -void sound_volume (int dir) -{ -} diff --git a/src/sounddep/sound_sdl_new.cpp b/src/sounddep/sound_sdl_new.cpp index 9fc724e7..cf5c130c 100644 --- a/src/sounddep/sound_sdl_new.cpp +++ b/src/sounddep/sound_sdl_new.cpp @@ -384,7 +384,7 @@ void close_sound(void) // testing shows that reopenning sound device is not a good idea (causes random sound driver crashes) // we will close it on real exit instead -#ifdef RASPBERRY +#ifdef AMIBERRY //amiberry_stop_sound(); #endif have_sound = 0;