Compare commits

...

6 Commits

Author SHA1 Message Date
Tygyh b014665149
Merge c1ff466e16 into 4b0b9799a9 2024-11-09 11:15:59 +08:00
Tilka 4b0b9799a9
Merge pull request #13000 from tygyh/Simplify-type-specifiers
Remove redundant elaborated type specifiers
2024-11-08 23:59:08 +00:00
Tilka 97ea64164b
Merge pull request #13182 from jordan-woyak/wiimote-speaker-remove-dumping-code
WiimoteEmu: Remove disabled and no-longer-compiling wav dumping code.
2024-11-08 22:53:56 +00:00
Jordan Woyak edb947df4f WiimoteEmu: Remove disabled and no-longer-compiling wav dumping code. 2024-11-08 15:38:05 -06:00
Dr. Dystopia c1ff466e16 Split 'IsRAMAddress' method into 'IsEffectiveRAMAddress' and 'IsPhysicalRAMAddress' methods 2024-08-20 15:31:13 +02:00
Dr. Dystopia 0aa8e0f477 Remove redundant elaborated type specifiers 2024-08-14 10:41:36 +02:00
10 changed files with 29 additions and 69 deletions

View File

@ -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),

View File

@ -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()

View File

@ -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>

View File

@ -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)

View File

@ -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.");

View File

@ -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);

View File

@ -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;
};

View File

@ -258,7 +258,7 @@ static void ReadCommand()
static bool IsDataAvailable()
{
struct timeval t;
timeval t;
fd_set _fds, *fds = &_fds;
FD_ZERO(fds);

View File

@ -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);

View File

@ -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,