Merge 7732ef0a7c
into 53b54406bd
This commit is contained in:
commit
68343eef28
|
@ -3,7 +3,7 @@ set(USE_LZMA ON)
|
|||
add_subdirectory(mgba EXCLUDE_FROM_ALL)
|
||||
dolphin_disable_warnings(mgba)
|
||||
|
||||
target_compile_definitions(mgba PUBLIC HAVE_CRC32)
|
||||
target_compile_definitions(mgba PUBLIC HAVE_CRC32 ENABLE_VFS ENABLE_DIRECTORIES)
|
||||
target_link_libraries(mgba ZLIB::ZLIB)
|
||||
|
||||
if(NOT MSVC)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)mGBA\mgba\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>ENABLE_VFS;ENABLE_DIRECTORIES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8739b22fbc90fdf0b4f6612ef9c0520f0ba44a51
|
||||
Subproject commit a75c6c41e04efca3ad9d81b28a216350d0973c62
|
|
@ -18,7 +18,7 @@
|
|||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>mgba\include;mgba\src;mgba\src\third-party\lzma;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BUILD_STATIC;M_CORE_GB;M_CORE_GBA;USE_LZMA;_7ZIP_PPMD_SUPPPORT;HAVE_STRDUP;HAVE_SETLOCALE;HAVE_CHMOD;HAVE_UMASK;HAVE_CRC32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BUILD_STATIC;M_CORE_GB;M_CORE_GBA;USE_LZMA;_7ZIP_PPMD_SUPPPORT;HAVE_STRDUP;HAVE_SETLOCALE;HAVE_CHMOD;HAVE_UMASK;HAVE_CRC32;ENABLE_VFS;ENABLE_VFS_FD;ENABLE_DIRECTORIES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(CScript)" /nologo /E:JScript "make_version.c.js"</Command>
|
||||
|
@ -67,7 +67,9 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="mgba\src\gb\mbc\pocket-cam.c" />
|
||||
<ClCompile Include="mgba\src\gb\mbc\tama5.c" />
|
||||
<ClCompile Include="mgba\src\gb\mbc\unlicensed.c" />
|
||||
<ClCompile Include="mgba\src\gb\mbc\unlicensed.c" >
|
||||
<ObjectFileName>$(IntDir)obj2\</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mgba\src\gb\memory.c" />
|
||||
<ClCompile Include="mgba\src\gb\overrides.c" />
|
||||
<ClCompile Include="mgba\src\gb\serialize.c">
|
||||
|
@ -95,6 +97,7 @@
|
|||
<ClCompile Include="mgba\src\gba\cart\ereader.c" />
|
||||
<ClCompile Include="mgba\src\gba\cart\gpio.c" />
|
||||
<ClCompile Include="mgba\src\gba\cart\matrix.c" />
|
||||
<ClCompile Include="mgba\src\gba\cart\unlicensed.c" />
|
||||
<ClCompile Include="mgba\src\gba\cart\vfame.c" />
|
||||
<ClCompile Include="mgba\src\gba\cheats.c">
|
||||
<ObjectFileName>$(IntDir)obj3\</ObjectFileName>
|
||||
|
@ -138,13 +141,14 @@
|
|||
<ObjectFileName>$(IntDir)obj2\</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mgba\src\gba\sio\gbp.c" />
|
||||
<ClCompile Include="mgba\src\gba\sio\joybus.c" />
|
||||
<ClCompile Include="mgba\src\gba\timer.c">
|
||||
<ObjectFileName>$(IntDir)obj2\</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mgba\src\gba\video.c">
|
||||
<ObjectFileName>$(IntDir)obj2\</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mgba\src\util\audio-buffer.c" />
|
||||
<ClCompile Include="mgba\src\util\audio-resampler.c" />
|
||||
<ClCompile Include="mgba\src\util\circle-buffer.c" />
|
||||
<ClCompile Include="mgba\src\util\configuration.c" />
|
||||
<ClCompile Include="mgba\src\util\crc32.c" />
|
||||
|
@ -153,6 +157,9 @@
|
|||
<ClCompile Include="mgba\src\util\geometry.c" />
|
||||
<ClCompile Include="mgba\src\util\hash.c" />
|
||||
<ClCompile Include="mgba\src\util\image.c" />
|
||||
<ClCompile Include="mgba\src\util\interpolator.c" />
|
||||
<ClCompile Include="mgba\src\util\md5.c" />
|
||||
<ClCompile Include="mgba\src\util\sha1.c" />
|
||||
<ClCompile Include="mgba\src\util\string.c" />
|
||||
<ClCompile Include="mgba\src\util\table.c" />
|
||||
<ClCompile Include="mgba\src\util\vector.c" />
|
||||
|
@ -177,7 +184,6 @@
|
|||
<ObjectFileName>$(IntDir)obj3\</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mgba\src\third-party\inih\ini.c" />
|
||||
<ClCompile Include="mgba\src\third-party\blip_buf\blip_buf.c" />
|
||||
<ClCompile Include="mgba\src\util\vfs\vfs-lzma.c" />
|
||||
<ClCompile Include="mgba\src\third-party\lzma\7zAlloc.c" />
|
||||
<ClCompile Include="mgba\src\third-party\lzma\7zArcIn.c" />
|
||||
|
@ -206,7 +212,6 @@
|
|||
<ObjectFileName>$(IntDir)obj3\</ObjectFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mgba\src\gb\sio\printer.c" />
|
||||
<ClCompile Include="mgba\src\gba\extra\audio-mixer.c" />
|
||||
<ClCompile Include="mgba\src\gba\extra\battlechip.c" />
|
||||
<ClCompile Include="mgba\src\gba\extra\proxy.c" />
|
||||
<ClCompile Include="mgba\src\gb\extra\proxy.c">
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#define PYCPARSE // Remove static functions from the header
|
||||
#include <mgba/core/interface.h>
|
||||
#undef PYCPARSE
|
||||
#include <mgba-util/audio-buffer.h>
|
||||
#include <mgba-util/audio-resampler.h>
|
||||
#include <mgba-util/vfs.h>
|
||||
#include <mgba/core/blip_buf.h>
|
||||
#include <mgba/core/log.h>
|
||||
#include <mgba/core/timing.h>
|
||||
#include <mgba/internal/gb/gb.h>
|
||||
|
@ -43,6 +44,8 @@ mLogger s_stub_logger = {
|
|||
constexpr auto SAMPLES = 512;
|
||||
constexpr auto SAMPLE_RATE = 48000;
|
||||
|
||||
static struct mAudioResampler resampler;
|
||||
|
||||
// libmGBA does not return the correct frequency for some GB models
|
||||
static u32 GetCoreFrequency(mCore* core)
|
||||
{
|
||||
|
@ -215,9 +218,9 @@ bool Core::Start(u64 gc_ticks)
|
|||
}
|
||||
rom_guard.Dismiss();
|
||||
|
||||
std::array<char, 17> game_title{};
|
||||
m_core->getGameTitle(m_core, game_title.data());
|
||||
m_game_title = game_title.data();
|
||||
struct mGameInfo info;
|
||||
m_core->getGameInfo(m_core, &info);
|
||||
m_game_title = info.title;
|
||||
|
||||
m_save_path = NetPlay::IsNetPlayRunning() ? NetPlay::GetGBASavePath(m_device_number) :
|
||||
GetSavePath(m_rom_path, m_device_number);
|
||||
|
@ -376,17 +379,18 @@ void Core::SetSIODriver()
|
|||
if (m_core->platform(m_core) != mPLATFORM_GBA)
|
||||
return;
|
||||
|
||||
GBASIOJOYCreate(&m_sio_driver);
|
||||
GBASIOSetDriver(&static_cast<::GBA*>(m_core->board)->sio, &m_sio_driver, SIO_JOYBUS);
|
||||
GBASIOSetDriver(&static_cast<::GBA*>(m_core->board)->sio, &m_sio_driver);
|
||||
|
||||
m_sio_driver.core = this;
|
||||
m_sio_driver.load = [](GBASIODriver* driver) {
|
||||
m_sio_driver.handlesMode = [](GBASIODriver* driver, GBASIOMode mode) {
|
||||
return mode == GBA_SIO_JOYBUS;
|
||||
};
|
||||
m_sio_driver.init = [](GBASIODriver* driver) {
|
||||
static_cast<SIODriver*>(driver)->core->m_link_enabled = true;
|
||||
return true;
|
||||
};
|
||||
m_sio_driver.unload = [](GBASIODriver* driver) {
|
||||
m_sio_driver.deinit = [](GBASIODriver* driver) {
|
||||
static_cast<SIODriver*>(driver)->core->m_link_enabled = false;
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -403,8 +407,8 @@ void Core::SetVideoBuffer()
|
|||
void Core::SetSampleRates()
|
||||
{
|
||||
m_core->setAudioBufferSize(m_core, SAMPLES);
|
||||
blip_set_rates(m_core->getAudioChannel(m_core, 0), m_core->frequency(m_core), SAMPLE_RATE);
|
||||
blip_set_rates(m_core->getAudioChannel(m_core, 1), m_core->frequency(m_core), SAMPLE_RATE);
|
||||
|
||||
mAudioResamplerSetSource(&resampler, m_core->getAudioBuffer(m_core), SAMPLE_RATE, true);
|
||||
|
||||
SoundStream* sound_stream = m_system.GetSoundStream();
|
||||
sound_stream->GetMixer()->SetGBAInputSampleRateDivisors(
|
||||
|
@ -435,11 +439,10 @@ void Core::SetAVStream()
|
|||
auto core = static_cast<AVStream*>(stream)->core;
|
||||
core->SetVideoBuffer();
|
||||
};
|
||||
m_stream.postAudioBuffer = [](mAVStream* stream, blip_t* left, blip_t* right) {
|
||||
m_stream.postAudioBuffer = [](mAVStream* stream, struct mAudioBuffer* audio_buffer) {
|
||||
auto core = static_cast<AVStream*>(stream)->core;
|
||||
std::vector<s16> buffer(SAMPLES * 2);
|
||||
blip_read_samples(left, &buffer[0], SAMPLES, 1);
|
||||
blip_read_samples(right, &buffer[1], SAMPLES, 1);
|
||||
mAudioBufferRead(audio_buffer, buffer.data(), SAMPLES);
|
||||
|
||||
SoundStream* sound_stream = core->m_system.GetSoundStream();
|
||||
sound_stream->GetMixer()->PushGBASamples(core->m_device_number, &buffer[0], SAMPLES);
|
||||
|
@ -723,9 +726,9 @@ bool Core::GetRomInfo(const char* rom_path, std::array<u8, 20>& hash, std::strin
|
|||
return false;
|
||||
}
|
||||
|
||||
std::array<char, 17> game_title{};
|
||||
core->getGameTitle(core, game_title.data());
|
||||
title = game_title.data();
|
||||
struct mGameInfo info;
|
||||
core->getGameInfo(core, &info);
|
||||
title = info.title;
|
||||
|
||||
core->deinit(core);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue