mirror of
https://github.com/TASVideos/desmume
synced 2024-07-01 07:14:37 +00:00
Compare commits
7 Commits
e0c55f2fed
...
79c6a728f6
Author | SHA1 | Date | |
---|---|---|---|
|
79c6a728f6 | ||
|
90d0abdae0 | ||
|
738298a9e8 | ||
|
4a53a30b91 | ||
|
9515af82b2 | ||
|
ae627d6847 | ||
|
ad09ed4e50 |
19
.github/ISSUE_TEMPLATE/new-issue--bug-report--question.md
vendored
Normal file
19
.github/ISSUE_TEMPLATE/new-issue--bug-report--question.md
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
name: New Issue, Bug report, Question
|
||||
about: New Issue, Bug report, Question
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## State your operating system:
|
||||
Windows/Mac/Linux. in case of linux, whether you use CLI, gtk2, or gtk3 version.
|
||||
|
||||
## DesMuME version
|
||||
e.g. 0.9.13 or git master
|
||||
|
||||
## Isse
|
||||
type here what's bothering you, in a detailed manner.
|
||||
|
||||
|
|
@ -472,6 +472,22 @@ void SPU_struct::KeyOn(int channel)
|
|||
thischan.status = CHANSTAT_STOPPED;
|
||||
}
|
||||
}
|
||||
|
||||
// If we are targetting data that is being played back by a
|
||||
// channel, then make sure to delay it by at least 4 samples
|
||||
// so that we don't get ourselves into buffer overrun.
|
||||
// This (and the corresponding fixup in ProbeCapture()) are a
|
||||
// nasty hack, but it's about all we can do, really :/
|
||||
if(channel == 1 || channel == 3) {
|
||||
const SPU_struct::REGS::CAP *cap = ®s.cap[(channel == 1) ? 0 : 1];
|
||||
if(cap->active && (cap->runtime.maxdad - cap->len*4) == thischan.addr) {
|
||||
// We are assuming that the channel and capture have the same length
|
||||
int capLen_shifted = cap->len * (32 / (cap->bits8 ? 8 : 16));
|
||||
int d = cap->runtime.sampcntInt - thischan.sampcntInt;
|
||||
if(d < 0) d += capLen_shifted;
|
||||
if(d < 4) thischan.sampcntInt -= 4 - d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -767,6 +783,15 @@ void SPU_struct::ProbeCapture(int which)
|
|||
cap.runtime.maxdad = cap.dad + len*4;
|
||||
cap.runtime.sampcntFrac = cap.runtime.sampcntInt = 0;
|
||||
cap.runtime.fifo.reset();
|
||||
|
||||
// Fix playback position for feedback capture - see notes in KeyProbe()
|
||||
const channel_struct *ch = &channels[(which == 0) ? 1 : 3];
|
||||
if(ch->status == CHANSTAT_PLAY && ch->addr == cap.dad) {
|
||||
int capLen_shifted = cap.len * (32 / (cap.bits8 ? 8 : 16));
|
||||
int d = cap.runtime.sampcntInt - ch->sampcntInt; // cap.runtime.sampcntInt - ch->sampcntInt, wrapped around
|
||||
if(d < 0) d += capLen_shifted;
|
||||
if(d < 4) cap.runtime.sampcntInt += 4 - d;
|
||||
}
|
||||
}
|
||||
|
||||
void SPU_struct::WriteByte(u32 addr, u8 val)
|
||||
|
@ -1467,22 +1492,15 @@ static void SPU_MixAudio_Advanced(bool actuallyMix, SPU_struct *SPU, int length)
|
|||
//Instead, what we do here is delay the capture by 16 samples to create a similar effect.
|
||||
//Subjectively, it seems to be working.
|
||||
|
||||
//Don't do anything until the fifo is filled, so as to delay it
|
||||
if (cap.runtime.fifo.size < 16)
|
||||
{
|
||||
cap.runtime.fifo.enqueue(capout[capchan]);
|
||||
continue;
|
||||
}
|
||||
|
||||
//(actually capture sample from fifo instead of most recently generated)
|
||||
u32 multiplier;
|
||||
s32 sample = cap.runtime.fifo.dequeue();
|
||||
//Fetch the FIFO-buffered sample and enqueue the most recently generated sample
|
||||
s32 sample = (cap.runtime.fifo.size >= 16) ? cap.runtime.fifo.dequeue() : 0;
|
||||
cap.runtime.fifo.enqueue(capout[capchan]);
|
||||
|
||||
//static FILE* fp = NULL;
|
||||
//if(!fp) fp = fopen("d:\\capout.raw","wb");
|
||||
//fwrite(&sample,2,1,fp);
|
||||
|
||||
u32 multiplier;
|
||||
if (cap.bits8)
|
||||
{
|
||||
s8 sample8 = sample >> 8;
|
||||
|
|
|
@ -87,7 +87,7 @@ void GetINIPath()
|
|||
}
|
||||
|
||||
FCEUD_MakePathDirs(IniName);
|
||||
wcscpy(IniNameW,mbstowcs(IniName).c_str()); //careful to use locale C-style mbstowcs to get IniName (which is with locale encoding) to unicode
|
||||
wcscpy(IniNameW,mbstowcs_locale(IniName).c_str());
|
||||
|
||||
//write BOM to get unicode
|
||||
FILE* test = fopen(IniName,"rb");
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE 500 /* For strdup, realpath */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -170,7 +170,7 @@ void createDirectoryRecursively(std::wstring path)
|
|||
|
||||
void FCEUD_MakePathDirs(const char *fname)
|
||||
{
|
||||
createDirectoryRecursively(mbstowcs(fname));
|
||||
createDirectoryRecursively(mbstowcs_locale(fname));
|
||||
}
|
||||
#endif
|
||||
//------------------------------
|
||||
|
|
|
@ -284,6 +284,19 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
|
|||
return answer;
|
||||
}
|
||||
|
||||
std::wstring mbstowcs_locale(std::string str)
|
||||
{
|
||||
#ifdef HOST_WINDOWS
|
||||
int plenty = str.size()*4+1;
|
||||
wchar_t *wgarbage = new wchar_t[plenty];
|
||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, str.data(), -1, wgarbage, plenty);
|
||||
std::wstring ret = wgarbage;
|
||||
delete[] wgarbage;
|
||||
return ret;
|
||||
#endif
|
||||
return mbstowcs(str);
|
||||
}
|
||||
|
||||
//convert a std::string to std::wstring
|
||||
std::wstring mbstowcs(std::string str)
|
||||
{
|
||||
|
|
|
@ -107,5 +107,7 @@ std::string mass_replace(const std::string &source, const std::string &victim, c
|
|||
std::wstring mbstowcs(std::string str);
|
||||
std::string wcstombs(std::wstring str);
|
||||
|
||||
std::wstring mbstowcs_locale(std::string str);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user