From bef77bfbf6bf9e3c9a5122020f11a2f1b80dfd40 Mon Sep 17 00:00:00 2001 From: Mystro256 Date: Jan 19 2017 01:23:45 +0000 Subject: Initial import, v2 beta3 --- diff --git a/.gitignore b/.gitignore index e69de29..9bf4e44 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/visualboyadvance-m-2.0.0-Beta3.tar.gz diff --git a/sources b/sources index e69de29..d6fdb04 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (visualboyadvance-m-2.0.0-Beta3.tar.gz) = 61525a8b418087a00b2932f03f8cd1e8bb12c050126b813be46ce8347b53034365261563616a3f24a50d989cea953a28c930e8764dc38199ab45c4378125159e diff --git a/visualboyadvance-m-2.0.0-soundsync.patch b/visualboyadvance-m-2.0.0-soundsync.patch new file mode 100644 index 0000000..79c80d8 --- /dev/null +++ b/visualboyadvance-m-2.0.0-soundsync.patch @@ -0,0 +1,198 @@ +diff --git a/src/common/ConfigManager.cpp b/src/common/ConfigManager.cpp +index dafdb72..06752e4 100644 +--- a/src/common/ConfigManager.cpp ++++ b/src/common/ConfigManager.cpp +@@ -220,6 +220,7 @@ int speedupToggle; + int sunBars; + int surfaceSizeX; + int surfaceSizeY; ++int synchronize = false; + int threadPriority; + int tripleBuffering; + int useBios = 0; +@@ -522,6 +523,7 @@ void LoadConfig() + soundFiltering = (float)ReadPref("gbaSoundFiltering", 50) / 100.0f; + soundInterpolation = ReadPref("gbaSoundInterpolation", 1); + soundRecordDir = ReadPrefString("soundRecordDir"); ++ synchronize = ReadPref("synchronize", 1); + threadPriority = ReadPref("priority", 2); + throttle = ReadPref("throttle", 100); + tripleBuffering = ReadPref("tripleBuffering", 0); +@@ -1038,6 +1040,13 @@ int ReadOpts(int argc, char ** argv) + } + break; + ++ case OPT_SYNCHRONIZE: ++ // --synchronize ++ if (optarg) { ++ synchronize = atoi(optarg); ++ } ++ break; ++ + case OPT_VIDEO_OPTION: + // --video-option + if (optarg) { +diff --git a/src/common/ConfigManager.h b/src/common/ConfigManager.h +index e6a1008..034ceed 100644 +--- a/src/common/ConfigManager.h ++++ b/src/common/ConfigManager.h +@@ -119,6 +119,7 @@ extern int speedupToggle; + extern int sunBars; + extern int surfaceSizeX; + extern int surfaceSizeY; ++extern int synchronize; + extern int threadPriority; + extern int tripleBuffering; + extern int useBios; +diff --git a/src/common/SoundSDL.cpp b/src/common/SoundSDL.cpp +index 9713d44..09c46a7 100644 +--- a/src/common/SoundSDL.cpp ++++ b/src/common/SoundSDL.cpp +@@ -18,17 +18,15 @@ + #include "SoundSDL.h" + #include "ConfigManager.h" + #include "../gba/Globals.h" +-#include "../gba/Sound.h" + + extern int emulating; + +-// Hold up to 32 ms of data in the ring buffer +-const float SoundSDL::_delay = 0.032f; ++// Hold up to 100 ms of data in the ring buffer ++const float SoundSDL::_delay = 0.1f; + + SoundSDL::SoundSDL(): + _rbuf(0), + _dev(-1), +- current_rate(0), + _initialized(false) + { + +@@ -48,7 +46,7 @@ void SoundSDL::read(uint16_t * stream, int length) + /* since this is running in a different thread, speedup and + * throttle can change at any time; save the value so locks + * stay in sync */ +- bool lock = (emulating && !speedup && throttle && !gba_joybus_active) ? true : false; ++ bool lock = (emulating && !speedup && synchronize && !gba_joybus_active) ? true : false; + + if (lock) + SDL_SemWait (_semBufferFull); +@@ -77,7 +75,7 @@ void SoundSDL::write(uint16_t * finalWave, int length) + std::size_t avail; + while ((avail = _rbuf.avail() / 2) < samples) + { +- bool lock = (emulating && !speedup && throttle && !gba_joybus_active) ? true : false; ++ bool lock = (emulating && !speedup && synchronize && !gba_joybus_active) ? true : false; + + _rbuf.write(finalWave, avail * 2); + +@@ -89,12 +87,6 @@ void SoundSDL::write(uint16_t * finalWave, int length) + if (lock) + { + SDL_SemWait(_semBufferEmpty); +- if (throttle > 0 && throttle != current_rate) +- { +- SDL_CloseAudio(); +- init(soundGetSampleRate() * throttle / 100); +- current_rate = throttle; +- } + } + else + { +@@ -131,13 +123,10 @@ bool SoundSDL::init(long sampleRate) + + _rbuf.reset(_delay * sampleRate * 2); + +- if (!_initialized) +- { +- _mutex = SDL_CreateMutex(); +- _semBufferFull = SDL_CreateSemaphore (0); +- _semBufferEmpty = SDL_CreateSemaphore (1); +- _initialized = true; +- } ++ _mutex = SDL_CreateMutex(); ++ _semBufferFull = SDL_CreateSemaphore (0); ++ _semBufferEmpty = SDL_CreateSemaphore (1); ++ _initialized = true; + + return true; + } +@@ -165,8 +154,6 @@ SoundSDL::~SoundSDL() + SDL_CloseAudioDevice(_dev); + + emulating = iSave; +- +- _initialized = false; + } + + void SoundSDL::pause() +diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp +index c083678..5e31c1d 100644 +--- a/src/wx/cmdevents.cpp ++++ b/src/wx/cmdevents.cpp +@@ -2625,6 +2625,12 @@ EVT_HANDLER(SkipIntro, "Skip BIOS initialization") + update_opts(); + } + ++EVT_HANDLER(SyncGameAudio, "Synchronize game to audio") ++{ ++ GetMenuOptionInt("SyncGameAudio", synchronize, 1); ++ update_opts(); ++} ++ + EVT_HANDLER(BootRomEn, "Use the specified BIOS file for GBA") + { + GetMenuOptionInt("BootRomEn", useBiosFileGBA, 1); +diff --git a/src/wx/dsound.cpp b/src/wx/dsound.cpp +index 2ed26e2..062b1b2 100644 +--- a/src/wx/dsound.cpp ++++ b/src/wx/dsound.cpp +@@ -233,7 +233,7 @@ void DirectSound::write(uint16_t* finalWave, int length) + LPVOID lpvPtr2; + DWORD dwBytes2 = 0; + +- if (!speedup && throttle && !gba_joybus_active) { ++ if (!speedup && synchronize && !throttle && !gba_joybus_active) { + hr = dsbSecondary->GetStatus(&status); + + if (status & DSBSTATUS_PLAYING) { +diff --git a/src/wx/openal.cpp b/src/wx/openal.cpp +index a3a08da..82e2f72 100644 +--- a/src/wx/openal.cpp ++++ b/src/wx/openal.cpp +@@ -286,7 +286,7 @@ void OpenAL::write(uint16_t* finalWave, int length) + } + } + +- if (!speedup && throttle && !gba_joybus_active) { ++ if (!speedup && synchronize && !throttle && !gba_joybus_active) { + // wait until at least one buffer has finished + while (nBuffersProcessed == 0) { + winlog(" waiting...\n"); +diff --git a/src/wx/opts.cpp b/src/wx/opts.cpp +index 68198c4..f96cffe 100644 +--- a/src/wx/opts.cpp ++++ b/src/wx/opts.cpp +@@ -246,6 +246,7 @@ opt_desc opts[] = { + INTOPT("preferences/skipBios", "SkipIntro", wxTRANSLATE("Skip BIOS initialization"), skipBios, 0, 1), + INTOPT("preferences/skipSaveGameCheats", "", wxTRANSLATE("Do not overwrite cheat list when loading state"), skipSaveGameCheats, 0, 1), + INTOPT("preferences/skipSaveGameBattery", "", wxTRANSLATE("Do not overwrite native (battery) save when loading state"), skipSaveGameBattery, 0, 1), ++ INTOPT ("preferences/synchronize", "SyncGameAudio", wxTRANSLATE("Synchronize game to audio"), synchronize, 0, 1), + INTOPT("preferences/throttle", "", wxTRANSLATE("Throttle game speed, even when accelerated (0-1000%, 0 = disabled)"), throttle, 0, 1000), + INTOPT("preferences/useBiosGB", "BootRomGB", wxTRANSLATE("Use the specified BIOS file for GB"), useBiosFileGB, 0, 1), + INTOPT("preferences/useBiosGBA", "BootRomEn", wxTRANSLATE("Use the specified BIOS file"), useBiosFileGBA, 0, 1), +diff --git a/src/wx/xrc/MainMenu.xrc b/src/wx/xrc/MainMenu.xrc +index 5313057..b778ab2 100644 +--- a/src/wx/xrc/MainMenu.xrc ++++ b/src/wx/xrc/MainMenu.xrc +@@ -242,6 +242,10 @@ + + 1 + ++ ++ ++ 1 ++ + + + 1 diff --git a/visualboyadvance-m.spec b/visualboyadvance-m.spec new file mode 100644 index 0000000..75f14aa --- /dev/null +++ b/visualboyadvance-m.spec @@ -0,0 +1,231 @@ +%undefine _hardened_build + +%global shortname vbam +%global rctag Beta3 + +Name: visualboyadvance-m +Version: 2.0.0 +Release: 0.4%{?rctag:.%{rctag}}%{?dist} +Summary: High compatibility Gameboy Advance Emulator combining VBA builds + +License: GPLv2 +Url: http://www.vba-m.com +Source0: https://github.com/visualboyadvance-m/visualboyadvance-m/archive/Beta-3.tar.gz#/%{name}-%{version}%{?rctag:-%{rctag}}.tar.gz +#Workaround for sound synchronization issues: +#https://github.com/visualboyadvance-m/visualboyadvance-m/issues/51 +Patch0: %{name}-%{version}-soundsync.patch +BuildRequires: cairo-devel +BuildRequires: cmake +BuildRequires: libjpeg-turbo-devel +BuildRequires: libpng-devel +BuildRequires: libtiff-devel +BuildRequires: mesa-libGL-devel +BuildRequires: nasm +BuildRequires: openal-soft-devel +BuildRequires: SDL2-devel +BuildRequires: SFML-devel +BuildRequires: wxGTK3-devel +BuildRequires: zlib-devel +BuildRequires: zip + +BuildRequires: gettext +BuildRequires: desktop-file-utils +BuildRequires: hicolor-icon-theme +BuildRequires: libappstream-glib + +%if 0%{?fedora} < 25 +Requires(post): desktop-file-utils +Requires(postun): desktop-file-utils +%endif + +Requires: hicolor-icon-theme + +#Rpmfusion package name (wx frontend obsoletes the old gtk): +Provides: %{shortname}-gtk = %{version}-%{release} +Obsoletes: %{shortname}-gtk < %{version}-%{release} + +#Using info from here: http://vba-m.com/about.html and debian files +%description +VisualBoyAdvance-M is a Nintendo Game Boy Emulator with high compatibility with +commercial games. It emulates the Nintendo Game Boy Advance hand held console, +in addition to the original Game Boy hand held systems and its Super and Color +variants. VBA-M is a continued development of the now inactive VisualBoy +Advance project, with many improvements from various developments of VBA. + +%package sdl +Summary: SDL version (no GUI) for VBA-M, a high compatibility Gameboy Advance Emulator + +#Rpmfusion package name: +Provides: %{shortname}-sdl = %{version}-%{release} +Obsoletes: %{shortname}-sdl < %{version}-%{release} + +%description sdl +This package provides the no-GUI, SDL only version of VisualBoyAdvance-M. +VisualBoyAdvance-M is a Nintendo Game Boy Emulator with high compatibility with +commercial games. It emulates the Nintendo Game Boy Advance hand held console, +in addition to the original Game Boy hand held systems and its Super and Color +variants. VBA-M is a continued development of the now inactive VisualBoy +Advance project, with many improvements from various developments of VBA. + +%prep +%autosetup -p1 -n %{name}-Beta-3 +sed -i '/CMAKE_C.*_FLAGS/d' CMakeLists.txt + +%build +%cmake . \ + -DCMAKE_SKIP_RPATH=ON \ + -DVERSION="%{version}%{?rctag: %{rctag}}" \ + -DENABLE_SDL=ON \ + -DENABLE_WX=ON \ + -DENABLE_FFMPEG=OFF \ + -DENABLE_LINK=ON +%make_build + +%install +%make_install +%find_lang wx%{shortname} + +%check +desktop-file-validate \ + %{buildroot}%{_datadir}/applications/wx%{shortname}.desktop +appstream-util validate-relax --nonet \ + %{buildroot}/%{_datadir}/appdata/*.appdata.xml + +%files -f wx%{shortname}.lang +%license doc/gpl.txt doc/License.txt +%doc doc/ips.htm +%{_mandir}/man6/%{name}.* +%{_bindir}/%{name} +%{_datadir}/applications/wx%{shortname}.desktop +%{_datadir}/appdata/wx%{shortname}.appdata.xml +%{_datadir}/%{shortname} +%{_datadir}/icons/hicolor/*/apps/%{shortname}.* + +%files sdl +%doc doc/ReadMe.SDL.txt +%license doc/gpl.txt doc/License.txt +%config(noreplace) %{_sysconfdir}/%{shortname}.cfg +%{_mandir}/man6/%{shortname}.* +%{_bindir}/%{shortname} + +%post +/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : +%if 0%{?fedora} < 25 +/usr/bin/update-desktop-database &> /dev/null || : +%endif + +%postun +if [ $1 -eq 0 ] ; then + /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null + /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : +fi +%if 0%{?fedora} < 25 +/usr/bin/update-desktop-database &> /dev/null || : +%endif + +%posttrans +/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : + +%changelog +* Fri Dec 30 2016 Jeremy Newton - 2.0.0-0.4.Beta3 +- Added missing desktop scriptlet for f24 +- Added missing build requires +- Missing hicolor-icon-theme require +- Use %{_sysconfdir} in spec + +* Wed Dec 21 2016 Jeremy Newton - 2.0.0-0.3.Beta3 +- Update to beta 3 +- Dropping GTK, upstream no longer supports this +- Change packagename visualboyadvance-m to reflect upstream +- Various tweaks + +* Sat Dec 10 2016 Jeremy Newton - 2.0.0-0.2.beta2 +- Added patch to fix audio syncing issues +- Added fixes for linux data files + +* Fri Dec 9 2016 Jeremy Newton - 2.0.0-0.1.beta2 +- Update to 2.0.0 beta 2 +- Re-enable wx GUI +- Rename common subpackage to data +- Added appdata +- Build Require cleanup + +* Thu Jul 7 2016 Hans de Goede - 1.8.0.1229-3 +- Fix building with gcc6 / fix FTBFS + +* Mon Jan 12 2015 Jeremy Newton - 1.8.0.1229-2 +- Fix typo in desktop file + +* Sat Apr 5 2014 Jeremy Newton - 1.8.0.1229-1 +- Update to latest "release" version + +* Mon Nov 18 2013 Jeremy Newton - 1.8.0.1228-3 +- Update patch for SFML, thanks to Hans de Goede + +* Sun Nov 17 2013 Jeremy Newton - 1.8.0.1228-2 +- Added patch for SFML + +* Sun Nov 17 2013 Jeremy Newton - 1.8.0.1228-1 +- Updated to new snapshot version + +* Fri Mar 1 2013 Jeremy Newton - 1.8.0.1159-1 +- Updated to new upstream version +- Fixed some spec date typos + +* Mon Dec 10 2012 Jeremy Newton - 1.8.0.1149-1 +- Updated to new upstream version +- FFMpeg dep removed due to only needed by wx and now disabled by default + +* Thu Jul 5 2012 Jeremy Newton - 1.8.0.1097-1 +- Updated to new upstream version +- Disabling WX because its not supported +- Removed extra sources as they are now included +- Removed FFMPEG fix +- Moved ips.htm doc file into common to avoid duplicates +- Various cleanup + +* Wed Mar 28 2012 Jeremy Newton - 1.8.0.1054-6 +- Added man pages + +* Tue Feb 14 2012 Jeremy Newton - 1.8.0.1054-5 +- Added Zip as a dependancy + +* Tue Feb 14 2012 Jeremy Newton - 1.8.0.1054-4 +- Changed building commands to avoid failed builds + +* Sun Jan 29 2012 Jeremy Newton - 1.8.0.1054-3 +- Added missing Build Requirement: openal-soft-devel +- Removed redundant license files + +* Thu Jan 26 2012 Jeremy Newton - 1.8.0.1054-2 +- Added DCMAKE_SKIP_RPATH=ON to cmake (fixes rpath error) +- Added more relevant package summaries +- Fixed up the descriptions a bit +- Enabled Linking Support +- Various tweaks + +* Thu Jan 26 2012 Jeremy Newton - 1.8.0.1054-1 +- Updated to new upstream version +- Added new WX subpackage for new GUI +- Adding WX requires gui common subpackage to avoid conflicts +- Added DVERSION cmake tag for aesthetic reasons + +* Sun Jan 22 2012 Jeremy Newton - 1.8.0.1001-4 +- Added vbam-common package to avoid conflicts with common files +- Added ImageMagick build dep, as cmake checks for it +- Building now uses cmake macro +- Turned off building shared libs +- Removed unnecessary lines +- Fixed debuginfo-without-sources issue + +* Sun Jan 22 2012 Jeremy Newton - 1.8.0.1001-3 +- Fixed SPM summary +- Cleaned up SPEC for easier reading + +* Sun Jan 8 2012 Jeremy Newton - 1.8.0.1001-2 +- Fixed up spec file +- Split into two packages: sdl, gtk + +* Sun Dec 18 2011 Jeremy Newton - 1.8.0.1001-1 +- Initial package SPEC created +