Compare commits
6 Commits
bbc4b48000
...
b014665149
Author | SHA1 | Date |
---|---|---|
Tygyh | b014665149 | |
Tilka | 4b0b9799a9 | |
Tilka | 97ea64164b | |
Jordan Woyak | edb947df4f | |
Dr. Dystopia | c1ff466e16 | |
Dr. Dystopia | 0aa8e0f477 |
|
@ -834,7 +834,7 @@ BbaTcpSocket::ConnectingState BbaTcpSocket::Connected(StackRef* ref)
|
|||
fd_set read_fds;
|
||||
fd_set write_fds;
|
||||
fd_set except_fds;
|
||||
struct timeval t = {0, 0};
|
||||
timeval t = {0, 0};
|
||||
FD_ZERO(&read_fds);
|
||||
FD_ZERO(&write_fds);
|
||||
FD_ZERO(&except_fds);
|
||||
|
@ -965,7 +965,7 @@ sf::Socket::Status BbaUdpSocket::Bind(u16 port, u32 net_ip)
|
|||
|
||||
// Subscribe to the SSDP multicast group
|
||||
// NB: Other groups aren't supported because of HLE
|
||||
struct ip_mreq mreq;
|
||||
ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = std::bit_cast<u32>(Common::IP_ADDR_SSDP);
|
||||
mreq.imr_interface.s_addr = net_ip;
|
||||
if (setsockopt(getHandle(), IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast<const char*>(&mreq),
|
||||
|
|
|
@ -8,21 +8,12 @@
|
|||
#include "AudioCommon/AudioCommon.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/MathUtil.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "Core/System.h"
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||
|
||||
//#define WIIMOTE_SPEAKER_DUMP
|
||||
#ifdef WIIMOTE_SPEAKER_DUMP
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
#include "AudioCommon/WaveFile.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#endif
|
||||
|
||||
namespace WiimoteEmu
|
||||
{
|
||||
// Yamaha ADPCM decoder code based on The ffmpeg Project (Copyright (s) 2001-2003)
|
||||
|
@ -60,17 +51,6 @@ static s16 adpcm_yamaha_expand_nibble(ADPCMState& s, u8 nibble)
|
|||
return s.predictor;
|
||||
}
|
||||
|
||||
#ifdef WIIMOTE_SPEAKER_DUMP
|
||||
std::ofstream ofile;
|
||||
WaveFileWriter wav;
|
||||
|
||||
void stopdamnwav()
|
||||
{
|
||||
wav.Stop();
|
||||
ofile.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
void SpeakerLogic::SpeakerData(const u8* data, int length, float speaker_pan)
|
||||
{
|
||||
// TODO: should we still process samples for the decoder state?
|
||||
|
@ -151,28 +131,6 @@ void SpeakerLogic::SpeakerData(const u8* data, int length, float speaker_pan)
|
|||
const unsigned int sample_rate = sample_rate_dividend / reg_data.sample_rate;
|
||||
sound_stream->GetMixer()->PushWiimoteSpeakerSamples(
|
||||
samples.get(), sample_length, Mixer::FIXED_SAMPLE_RATE_DIVIDEND / (sample_rate * 2));
|
||||
|
||||
#ifdef WIIMOTE_SPEAKER_DUMP
|
||||
static int num = 0;
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
File::Delete("rmtdump.wav");
|
||||
File::Delete("rmtdump.bin");
|
||||
atexit(stopdamnwav);
|
||||
File::OpenFStream(ofile, "rmtdump.bin", ofile.binary | ofile.out);
|
||||
wav.Start("rmtdump.wav", 6000);
|
||||
}
|
||||
wav.AddMonoSamples(samples.get(), length * 2);
|
||||
if (ofile.good())
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
ofile << data[i];
|
||||
}
|
||||
}
|
||||
num++;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SpeakerLogic::Reset()
|
||||
|
|
|
@ -197,8 +197,8 @@ void init_lib()
|
|||
|
||||
namespace WiimoteReal
|
||||
{
|
||||
int IOWrite(HANDLE& dev_handle, OVERLAPPED& hid_overlap_write, enum WinWriteMethod& stack,
|
||||
const u8* buf, size_t len, DWORD* written);
|
||||
int IOWrite(HANDLE& dev_handle, OVERLAPPED& hid_overlap_write, WinWriteMethod& stack, const u8* buf,
|
||||
size_t len, DWORD* written);
|
||||
int IORead(HANDLE& dev_handle, OVERLAPPED& hid_overlap_read, u8* buf, int index);
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -798,7 +798,7 @@ IPCReply NetIPTopDevice::HandleInetAToNRequest(const IOCtlRequest& request)
|
|||
auto& memory = system.GetMemory();
|
||||
|
||||
const std::string hostname = memory.GetString(request.buffer_in);
|
||||
struct hostent* remoteHost = gethostbyname(hostname.c_str());
|
||||
hostent* remoteHost = gethostbyname(hostname.c_str());
|
||||
|
||||
if (remoteHost == nullptr || remoteHost->h_addr_list == nullptr ||
|
||||
remoteHost->h_addr_list[0] == nullptr)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
static DRESULT read_vff_header(IOS::HLE::FS::FileHandle* vff, FATFS* fs)
|
||||
{
|
||||
struct IOS::HLE::NWC24::VFFHeader header;
|
||||
IOS::HLE::NWC24::VFFHeader header;
|
||||
if (!vff->Read(&header, 1))
|
||||
{
|
||||
ERROR_LOG_FMT(IOS_WC24, "Failed to read VFF header.");
|
||||
|
|
|
@ -770,7 +770,7 @@ WiiSocket::ConnectingState WiiSocket::GetConnectingState() const
|
|||
fd_set read_fds;
|
||||
fd_set write_fds;
|
||||
fd_set except_fds;
|
||||
struct timeval t = {0, 0};
|
||||
timeval t = {0, 0};
|
||||
FD_ZERO(&read_fds);
|
||||
FD_ZERO(&write_fds);
|
||||
FD_ZERO(&except_fds);
|
||||
|
@ -998,7 +998,7 @@ void WiiSockMan::Update()
|
|||
{
|
||||
s32 nfds = 0;
|
||||
fd_set read_fds, write_fds, except_fds;
|
||||
struct timeval t = {0, 0};
|
||||
timeval t = {0, 0};
|
||||
FD_ZERO(&read_fds);
|
||||
FD_ZERO(&write_fds);
|
||||
FD_ZERO(&except_fds);
|
||||
|
|
|
@ -2505,7 +2505,7 @@ struct hci_filter
|
|||
uint32_t mask[8]; /* 256 bits */
|
||||
};
|
||||
|
||||
static __inline void hci_filter_set(uint8_t bit, struct hci_filter* filter)
|
||||
static __inline void hci_filter_set(uint8_t bit, hci_filter* filter)
|
||||
{
|
||||
uint8_t off = bit - 1;
|
||||
|
||||
|
@ -2513,7 +2513,7 @@ static __inline void hci_filter_set(uint8_t bit, struct hci_filter* filter)
|
|||
filter->mask[off] |= (1 << ((bit - 1) & 0x1f));
|
||||
}
|
||||
|
||||
static __inline void hci_filter_clr(uint8_t bit, struct hci_filter* filter)
|
||||
static __inline void hci_filter_clr(uint8_t bit, hci_filter* filter)
|
||||
{
|
||||
uint8_t off = bit - 1;
|
||||
|
||||
|
@ -2581,7 +2581,7 @@ struct btreq
|
|||
uint16_t btri_link_policy; /* Link Policy */
|
||||
uint16_t btri_packet_type; /* Packet Type */
|
||||
} btri;
|
||||
struct bt_stats btrs; /* unit stats */
|
||||
bt_stats btrs; /* unit stats */
|
||||
} btru;
|
||||
};
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ static void ReadCommand()
|
|||
|
||||
static bool IsDataAvailable()
|
||||
{
|
||||
struct timeval t;
|
||||
timeval t;
|
||||
fd_set _fds, *fds = &_fds;
|
||||
|
||||
FD_ZERO(fds);
|
||||
|
|
|
@ -938,16 +938,14 @@ bool MMU::IsOptimizableRAMAddress(const u32 address, const u32 access_size) cons
|
|||
}
|
||||
|
||||
template <XCheckTLBFlag flag>
|
||||
bool MMU::IsRAMAddress(u32 address, bool translate)
|
||||
bool MMU::IsEffectiveRAMAddress(u32 address)
|
||||
{
|
||||
if (translate)
|
||||
{
|
||||
auto translate_address = TranslateAddress<flag>(address);
|
||||
if (!translate_address.Success())
|
||||
return false;
|
||||
address = translate_address.address;
|
||||
}
|
||||
auto translate_address = TranslateAddress<flag>(address);
|
||||
return translate_address.Success() && IsPhysicalRAMAddress(translate_address.address);
|
||||
}
|
||||
|
||||
bool MMU::IsPhysicalRAMAddress(const u32 address) const
|
||||
{
|
||||
u32 segment = address >> 28;
|
||||
if (m_memory.GetRAM() && segment == 0x0 && (address & 0x0FFFFFFF) < m_memory.GetRamSizeReal())
|
||||
{
|
||||
|
@ -977,13 +975,14 @@ bool MMU::HostIsRAMAddress(const Core::CPUThreadGuard& guard, u32 address,
|
|||
switch (space)
|
||||
{
|
||||
case RequestedAddressSpace::Effective:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::NoException>(address, mmu.m_ppc_state.msr.DR);
|
||||
return mmu.m_ppc_state.msr.DR ? mmu.IsEffectiveRAMAddress<XCheckTLBFlag::NoException>(address) :
|
||||
mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Physical:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::NoException>(address, false);
|
||||
return mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Virtual:
|
||||
if (!mmu.m_ppc_state.msr.DR)
|
||||
return false;
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::NoException>(address, true);
|
||||
return mmu.IsEffectiveRAMAddress<XCheckTLBFlag::NoException>(address);
|
||||
}
|
||||
|
||||
ASSERT(false);
|
||||
|
@ -1001,13 +1000,15 @@ bool MMU::HostIsInstructionRAMAddress(const Core::CPUThreadGuard& guard, u32 add
|
|||
switch (space)
|
||||
{
|
||||
case RequestedAddressSpace::Effective:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, mmu.m_ppc_state.msr.IR);
|
||||
return mmu.m_ppc_state.msr.IR ?
|
||||
mmu.IsEffectiveRAMAddress<XCheckTLBFlag::OpcodeNoException>(address) :
|
||||
mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Physical:
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, false);
|
||||
return mmu.IsPhysicalRAMAddress(address);
|
||||
case RequestedAddressSpace::Virtual:
|
||||
if (!mmu.m_ppc_state.msr.IR)
|
||||
return false;
|
||||
return mmu.IsRAMAddress<XCheckTLBFlag::OpcodeNoException>(address, true);
|
||||
return mmu.IsEffectiveRAMAddress<XCheckTLBFlag::OpcodeNoException>(address);
|
||||
}
|
||||
|
||||
ASSERT(false);
|
||||
|
|
|
@ -310,7 +310,8 @@ private:
|
|||
template <XCheckTLBFlag flag, bool never_translate = false>
|
||||
void WriteToHardware(u32 em_address, const u32 data, const u32 size);
|
||||
template <XCheckTLBFlag flag>
|
||||
bool IsRAMAddress(u32 address, bool translate);
|
||||
bool IsEffectiveRAMAddress(u32 address);
|
||||
bool IsPhysicalRAMAddress(u32 address) const;
|
||||
|
||||
template <typename T>
|
||||
static std::optional<ReadResult<T>> HostTryReadUX(const Core::CPUThreadGuard& guard,
|
||||
|
|
Loading…
Reference in New Issue