commit
8f61c6f239
|
@ -69,7 +69,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
return;
|
||||
|
||||
// TODO consider using static max size instead of new
|
||||
s16 *samples = new s16[sd->length * 2];
|
||||
std::unique_ptr<s16[]> samples(new s16[sd->length * 2]);
|
||||
|
||||
unsigned int sample_rate_dividend;
|
||||
u8 volume_divisor;
|
||||
|
@ -99,6 +99,11 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
sample_rate_dividend = 6000000;
|
||||
volume_divisor = 0x40;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(WII_IPC_WIIMOTE, "Unknown speaker format %x\n", m_reg_speaker.format);
|
||||
return;
|
||||
}
|
||||
|
||||
// Speaker Pan
|
||||
unsigned int vol = (unsigned int)(m_options->settings[4]->GetValue() * 100);
|
||||
|
@ -115,7 +120,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
right_volume = 255;
|
||||
|
||||
g_sound_stream->GetMixer()->SetWiimoteSpeakerVolume(left_volume, right_volume);
|
||||
g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples, sd->length, sample_rate);
|
||||
g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples.get(), sd->length, sample_rate);
|
||||
|
||||
|
||||
#ifdef WIIMOTE_SPEAKER_DUMP
|
||||
|
@ -129,7 +134,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
OpenFStream(ofile, "rmtdump.bin", ofile.binary | ofile.out);
|
||||
wav.Start("rmtdump.wav", 6000/*Common::swap16(m_reg_speaker.sample_rate)*/);
|
||||
}
|
||||
wav.AddMonoSamples(samples, sd->length*2);
|
||||
wav.AddMonoSamples(samples.get(), sd->length*2);
|
||||
if (ofile.good())
|
||||
{
|
||||
for (int i = 0; i < sd->length; i++)
|
||||
|
@ -139,8 +144,6 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
|
|||
}
|
||||
num++;
|
||||
#endif
|
||||
|
||||
delete[] samples;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -409,7 +409,6 @@ void TASInputDlg::GetKeyBoardInput(u8* data, WiimoteEmu::ReportFeatures rptf)
|
|||
{
|
||||
u8* const coreData = rptf.core ? (data + rptf.core) : nullptr;
|
||||
u8* const accelData = rptf.accel ? (data + rptf.accel) : nullptr;
|
||||
u8* const irData = rptf.ir ? (data + rptf.ir) : nullptr;
|
||||
|
||||
if (coreData)
|
||||
{
|
||||
|
@ -451,7 +450,6 @@ void TASInputDlg::GetValues(u8* data, WiimoteEmu::ReportFeatures rptf)
|
|||
u8* const coreData = rptf.core ? (data + rptf.core) : nullptr;
|
||||
u8* const accelData = rptf.accel ? (data + rptf.accel) : nullptr;
|
||||
u8* const irData = rptf.ir ? (data + rptf.ir) : nullptr;
|
||||
u8 size = rptf.size;
|
||||
|
||||
if (coreData)
|
||||
SetWiiButtons((wm_core*)coreData);
|
||||
|
@ -484,42 +482,42 @@ void TASInputDlg::GetValues(u8* data, WiimoteEmu::ReportFeatures rptf)
|
|||
if (mode == 1)
|
||||
{
|
||||
memset(irData, 0xFF, sizeof(wm_ir_basic) * 2);
|
||||
wm_ir_basic* data = (wm_ir_basic*)irData;
|
||||
wm_ir_basic* irBasic = (wm_ir_basic*)irData;
|
||||
for (unsigned int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (x[i*2] < 1024 && y < 768)
|
||||
{
|
||||
data[i].x1 = static_cast<u8>(x[i*2]);
|
||||
data[i].x1hi = x[i*2] >> 8;
|
||||
irBasic[i].x1 = static_cast<u8>(x[i*2]);
|
||||
irBasic[i].x1hi = x[i*2] >> 8;
|
||||
|
||||
data[i].y1 = static_cast<u8>(y);
|
||||
data[i].y1hi = y >> 8;
|
||||
irBasic[i].y1 = static_cast<u8>(y);
|
||||
irBasic[i].y1hi = y >> 8;
|
||||
}
|
||||
if (x[i*2+1] < 1024 && y < 768)
|
||||
{
|
||||
data[i].x2 = static_cast<u8>(x[i*2+1]);
|
||||
data[i].x2hi = x[i*2+1] >> 8;
|
||||
irBasic[i].x2 = static_cast<u8>(x[i*2+1]);
|
||||
irBasic[i].x2hi = x[i*2+1] >> 8;
|
||||
|
||||
data[i].y2 = static_cast<u8>(y);
|
||||
data[i].y2hi = y >> 8;
|
||||
irBasic[i].y2 = static_cast<u8>(y);
|
||||
irBasic[i].y2hi = y >> 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(data, 0xFF, sizeof(wm_ir_extended) * 4);
|
||||
wm_ir_extended* const data = (wm_ir_extended*)irData;
|
||||
wm_ir_extended* const irExtended = (wm_ir_extended*)irData;
|
||||
for (unsigned int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (x[i] < 1024 && y < 768)
|
||||
{
|
||||
data[i].x = static_cast<u8>(x[i]);
|
||||
data[i].xhi = x[i] >> 8;
|
||||
irExtended[i].x = static_cast<u8>(x[i]);
|
||||
irExtended[i].xhi = x[i] >> 8;
|
||||
|
||||
data[i].y = static_cast<u8>(y);
|
||||
data[i].yhi = y >> 8;
|
||||
irExtended[i].y = static_cast<u8>(y);
|
||||
irExtended[i].yhi = y >> 8;
|
||||
|
||||
data[i].size = 10;
|
||||
irExtended[i].size = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -705,11 +703,8 @@ void TASInputDlg::OnMouseDownL(wxMouseEvent& event)
|
|||
|
||||
stick->xCont.value = (unsigned)stick->xCont.value > stick->xCont.range ? stick->xCont.range : stick->xCont.value;
|
||||
stick->yCont.value = (unsigned)stick->yCont.value > stick->yCont.range ? stick->yCont.range : stick->yCont.value;
|
||||
stick->xCont.value = (unsigned)stick->xCont.value < 0 ? 0 : stick->xCont.value;
|
||||
stick->yCont.value = (unsigned)stick->yCont.value < 0 ? 0 : stick->yCont.value;
|
||||
|
||||
int x = (u8)((double)stick->xCont.value / (double)stick->xCont.range * 255.0);
|
||||
int y = (u8)((double)stick->yCont.value / (double)stick->yCont.range * 255.0);
|
||||
stick->xCont.value = stick->xCont.value < 0 ? 0 : stick->xCont.value;
|
||||
stick->yCont.value = stick->yCont.value < 0 ? 0 : stick->yCont.value;
|
||||
|
||||
stick->bitmap->SetBitmap(CreateStickBitmap(ptM.x*2, ptM.y*2));
|
||||
|
||||
|
|
|
@ -719,9 +719,9 @@ void Renderer::DrawDebugInfo()
|
|||
debug_info += " - ";
|
||||
if (SConfig::GetInstance().m_ShowFrameCount)
|
||||
{
|
||||
debug_info += StringFromFormat("Frame: %lu", Movie::g_currentFrame);
|
||||
debug_info += StringFromFormat("Frame: %llu", (unsigned long long) Movie::g_currentFrame);
|
||||
if (Movie::IsPlayingInput())
|
||||
debug_info += StringFromFormat(" / %lu", Movie::g_totalFrames);
|
||||
debug_info += StringFromFormat(" / %llu", (unsigned long long) Movie::g_totalFrames);
|
||||
}
|
||||
|
||||
debug_info += "\n";
|
||||
|
|
|
@ -50,7 +50,7 @@ void SamplerCache::SetSamplerState(int stage, const TexMode0& tm0, const TexMode
|
|||
}
|
||||
}
|
||||
|
||||
auto SamplerCache::GetEntry(const Params& params) -> Value&
|
||||
SamplerCache::Value& SamplerCache::GetEntry(const Params& params)
|
||||
{
|
||||
auto& val = m_cache[params];
|
||||
if (!val.sampler_id)
|
||||
|
|
Loading…
Reference in New Issue