more warning fixes

This commit is contained in:
Jordan Cristiano 2013-11-14 02:19:15 -05:00
commit 39a4d4329d
27 changed files with 89 additions and 70 deletions

View file

@ -86,7 +86,7 @@ bool FifoDataFile::Save(const char *filename)
header.xfRegsSize = XF_REGS_SIZE; header.xfRegsSize = XF_REGS_SIZE;
header.frameListOffset = frameListOffset; header.frameListOffset = frameListOffset;
header.frameCount = m_Frames.size(); header.frameCount = (u32)m_Frames.size();
header.flags = m_Flags; header.flags = m_Flags;
@ -111,7 +111,7 @@ bool FifoDataFile::Save(const char *filename)
dstFrame.fifoStart = srcFrame.fifoStart; dstFrame.fifoStart = srcFrame.fifoStart;
dstFrame.fifoEnd = srcFrame.fifoEnd; dstFrame.fifoEnd = srcFrame.fifoEnd;
dstFrame.memoryUpdatesOffset = memoryUpdatesOffset; dstFrame.memoryUpdatesOffset = memoryUpdatesOffset;
dstFrame.numMemoryUpdates = srcFrame.memoryUpdates.size(); dstFrame.numMemoryUpdates = (u32)srcFrame.memoryUpdates.size();
// Write frame info // Write frame info
u64 frameOffset = frameListOffset + (i * sizeof(FileFrameInfo)); u64 frameOffset = frameListOffset + (i * sizeof(FileFrameInfo));

View file

@ -234,7 +234,7 @@ u32 FifoPlaybackAnalyzer::DecodeCommand(u8 *data)
break; break;
} }
return data - dataStart; return (u32)(data - dataStart);
} }
void FifoPlaybackAnalyzer::StoreEfbCopyRegion() void FifoPlaybackAnalyzer::StoreEfbCopyRegion()

View file

@ -105,7 +105,9 @@ bool FifoPlayer::Play()
u32 FifoPlayer::GetFrameObjectCount() u32 FifoPlayer::GetFrameObjectCount()
{ {
if (m_CurrentFrame < m_FrameInfo.size()) if (m_CurrentFrame < m_FrameInfo.size())
return m_FrameInfo[m_CurrentFrame].objectStarts.size(); {
return (u32)(m_FrameInfo[m_CurrentFrame].objectStarts.size());
}
return 0; return 0;
} }
@ -172,7 +174,7 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
m_FrameFifoSize = frame.fifoDataSize; m_FrameFifoSize = frame.fifoDataSize;
// Determine start and end objects // Determine start and end objects
u32 numObjects = info.objectStarts.size(); u32 numObjects = (u32)(info.objectStarts.size());
u32 drawStart = std::min(numObjects, m_ObjectRangeStart); u32 drawStart = std::min(numObjects, m_ObjectRangeStart);
u32 drawEnd = std::min(numObjects - 1, m_ObjectRangeEnd); u32 drawEnd = std::min(numObjects - 1, m_ObjectRangeEnd);
@ -181,7 +183,9 @@ void FifoPlayer::WriteFrame(const FifoFrameInfo &frame, const AnalyzedFrameInfo
// Skip memory updates during frame if true // Skip memory updates during frame if true
if (m_EarlyMemoryUpdates) if (m_EarlyMemoryUpdates)
memoryUpdate = frame.memoryUpdates.size(); {
memoryUpdate = (u32)(frame.memoryUpdates.size());
}
if (numObjects > 0) if (numObjects > 0)
{ {

View file

@ -83,9 +83,9 @@ void FifoRecorder::WriteGPCommand(u8 *data, u32 size)
if (m_FrameEnded && m_FifoData.size() > 0) if (m_FrameEnded && m_FifoData.size() > 0)
{ {
size_t dataSize = m_FifoData.size(); size_t dataSize = m_FifoData.size();
m_CurrentFrame.fifoDataSize = dataSize; m_CurrentFrame.fifoDataSize = (u32)dataSize;
m_CurrentFrame.fifoData = new u8[dataSize]; m_CurrentFrame.fifoData = new u8[dataSize];
memcpy(m_CurrentFrame.fifoData, &m_FifoData[0], dataSize); memcpy(m_CurrentFrame.fifoData, m_FifoData.data(), dataSize);
sMutex.lock(); sMutex.lock();
@ -129,7 +129,7 @@ void FifoRecorder::WriteMemory(u32 address, u32 size, MemoryUpdate::Type type)
// Record memory update // Record memory update
MemoryUpdate memUpdate; MemoryUpdate memUpdate;
memUpdate.address = address; memUpdate.address = address;
memUpdate.fifoPosition = m_FifoData.size(); memUpdate.fifoPosition = (u32)(m_FifoData.size());
memUpdate.size = size; memUpdate.size = size;
memUpdate.type = type; memUpdate.type = type;
memUpdate.data = new u8[size]; memUpdate.data = new u8[size];

View file

@ -325,7 +325,7 @@ void ChangeDisc(const char* _newFileName)
{ {
Movie::g_bDiscChange = true; Movie::g_bDiscChange = true;
std::string fileName = _newFileName; std::string fileName = _newFileName;
int sizeofpath = fileName.find_last_of("/\\") + 1; auto sizeofpath = fileName.find_last_of("/\\") + 1;
if (fileName.substr(sizeofpath).length() > 40) if (fileName.substr(sizeofpath).length() > 40)
{ {
PanicAlert("Saving iso filename to .dtm failed; max file name length is 40 characters."); PanicAlert("Saving iso filename to .dtm failed; max file name length is 40 characters.");

View file

@ -191,7 +191,7 @@ void CEXIMemoryCard::CmdDone()
void CEXIMemoryCard::CmdDoneLater(u64 cycles) void CEXIMemoryCard::CmdDoneLater(u64 cycles)
{ {
CoreTiming::RemoveEvent(et_cmd_done); CoreTiming::RemoveEvent(et_cmd_done);
CoreTiming::ScheduleEvent(cycles, et_cmd_done, (u64)card_index); CoreTiming::ScheduleEvent((int)cycles, et_cmd_done, (u64)card_index);
} }
void CEXIMemoryCard::SetCS(int cs) void CEXIMemoryCard::SetCS(int cs)

View file

@ -40,7 +40,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
PanicAlertT("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str()); PanicAlertT("File has the extension \"%s\"\nvalid extensions are (.raw/.gcp)", fileType.c_str());
return; return;
} }
u32 size = mcdFile.GetSize(); auto size = mcdFile.GetSize();
if (size < MC_FST_BLOCKS*BLOCK_SIZE) if (size < MC_FST_BLOCKS*BLOCK_SIZE)
{ {
PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename, size); PanicAlertT("%s failed to load as a memorycard \nfile is not large enough to be a valid memory card file (0x%x bytes)", filename, size);
@ -52,7 +52,7 @@ GCMemcard::GCMemcard(const char *filename, bool forceCreation, bool sjis)
return; return;
} }
m_sizeMb = (size/BLOCK_SIZE) / MBIT_TO_BLOCKS; m_sizeMb = (u16)((size/BLOCK_SIZE) / MBIT_TO_BLOCKS);
switch (m_sizeMb) switch (m_sizeMb)
{ {
case MemCard59Mb: case MemCard59Mb:

View file

@ -209,5 +209,5 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
bool GCPad::GetMicButton() const bool GCPad::GetMicButton() const
{ {
return m_buttons->controls.back()->control_ref->State(); return (0 != m_buttons->controls.back()->control_ref->State());
} }

View file

@ -32,7 +32,7 @@
namespace WiimoteEmu namespace WiimoteEmu
{ {
void Spy(Wiimote* wm_, const void* data_, int size_) void Spy(Wiimote* wm_, const void* data_, size_t size_)
{ {
#if 0 #if 0
// enable log // enable log
@ -1275,7 +1275,7 @@ void Wiimote::DoState(PointerWrap& p)
else else
{ {
std::queue<ReadRequest> tmp_queue(m_read_requests); std::queue<ReadRequest> tmp_queue(m_read_requests);
size = m_read_requests.size(); size = (u32)(m_read_requests.size());
p.Do(size); p.Do(size);
while (!tmp_queue.empty()) while (!tmp_queue.empty())
{ {

View file

@ -765,7 +765,7 @@ void Wiimote::Update()
if (-1 == rptf_size) if (-1 == rptf_size)
{ {
std::copy(rpt.begin(), rpt.end(), data); std::copy(rpt.begin(), rpt.end(), data);
rptf_size = rpt.size(); rptf_size = (s8)(rpt.size());
} }
} }
} }

View file

@ -96,7 +96,7 @@ inline double trim(double a)
class Wiimote : public ControllerEmu class Wiimote : public ControllerEmu
{ {
friend class WiimoteReal::Wiimote; friend class WiimoteReal::Wiimote;
friend void Spy(Wiimote* wm_, const void* data_, int size_); friend void Spy(Wiimote* wm_, const void* data_, size_t size_);
public: public:
enum enum
@ -245,7 +245,7 @@ private:
} m_reg_speaker; } m_reg_speaker;
}; };
void Spy(Wiimote* wm_, const void* data_, int size_); void Spy(Wiimote* wm_, const void* data_, size_t size_);
} }

View file

@ -140,7 +140,7 @@ namespace WiimoteReal
{ {
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, int len); int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len);
int _IORead(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read, u8* buf, int index); int _IORead(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read, u8* buf, int index);
void _IOWakeup(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read); void _IOWakeup(HANDLE &dev_handle, OVERLAPPED &hid_overlap_read);
@ -247,7 +247,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
// SLEEP(2000); // SLEEP(2000);
} }
int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, int size, int attempts) int CheckDeviceType_Write(HANDLE &dev_handle, const u8* buf, size_t size, int attempts)
{ {
OVERLAPPED hid_overlap_write = OVERLAPPED(); OVERLAPPED hid_overlap_write = OVERLAPPED();
hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL); hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL);
@ -641,7 +641,7 @@ int Wiimote::IORead(u8* buf)
} }
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, int len) int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len)
{ {
WiimoteEmu::Spy(NULL, buf, len); WiimoteEmu::Spy(NULL, buf, len);
@ -663,7 +663,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
} }
case MSBT_STACK_MS: case MSBT_STACK_MS:
{ {
auto result = HidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, len - 1); auto result = HidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, (ULONG)(len - 1));
//FlushFileBuffers(dev_handle); //FlushFileBuffers(dev_handle);
if (!result) if (!result)
@ -715,7 +715,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
return 0; return 0;
} }
int Wiimote::IOWrite(const u8* buf, int len) int Wiimote::IOWrite(const u8* buf, size_t len)
{ {
return _IOWrite(dev_handle, hid_overlap_write, stack, buf, len); return _IOWrite(dev_handle, hid_overlap_write, stack, buf, len);
} }

View file

@ -239,7 +239,9 @@ bool Wiimote::Write()
IOWrite(rpt.data(), rpt.size()); IOWrite(rpt.data(), rpt.size());
if (is_speaker_data) if (is_speaker_data)
{
m_last_audio_report.Update(); m_last_audio_report.Update();
}
m_write_reports.Pop(); m_write_reports.Pop();
return true; return true;
@ -293,8 +295,10 @@ void Wiimote::Update()
// Send the report // Send the report
if (!rpt.empty() && m_channel > 0) if (!rpt.empty() && m_channel > 0)
Core::Callback_WiimoteInterruptChannel(index, m_channel, {
rpt.data(), rpt.size()); Core::Callback_WiimoteInterruptChannel(index, m_channel,
rpt.data(), (u32)rpt.size());
}
} }
void Wiimote::Prepare(int _index) void Wiimote::Prepare(int _index)

View file

@ -106,7 +106,7 @@ private:
void WriteReport(Report rpt); void WriteReport(Report rpt);
int IORead(u8* buf); int IORead(u8* buf);
int IOWrite(u8 const* buf, int len); int IOWrite(u8 const* buf, size_t len);
void IOWakeup(); void IOWakeup();
void ThreadFunc(); void ThreadFunc();

View file

@ -83,7 +83,7 @@ static u64 last_reply_time;
void EnqueReplyCallback(u64 userdata, int) void EnqueReplyCallback(u64 userdata, int)
{ {
std::lock_guard<std::mutex> lk(s_reply_queue); std::lock_guard<std::mutex> lk(s_reply_queue);
reply_queue.push_back(userdata); reply_queue.push_back((u32)userdata);
} }
void Init() void Init()
@ -546,7 +546,9 @@ void ExecuteCommand(u32 _Address)
const s64 ticks_til_last_reply = last_reply_time - CoreTiming::GetTicks(); const s64 ticks_til_last_reply = last_reply_time - CoreTiming::GetTicks();
if (ticks_til_last_reply > 0) if (ticks_til_last_reply > 0)
reply_delay = ticks_til_last_reply; {
reply_delay = (int)ticks_til_last_reply;
}
last_reply_time = CoreTiming::GetTicks() + reply_delay; last_reply_time = CoreTiming::GetTicks() + reply_delay;

View file

@ -133,7 +133,7 @@ void CWII_IPC_HLE_Device_es::DoState(PointerWrap& p)
p.Do(m_AccessIdentID); p.Do(m_AccessIdentID);
p.Do(m_TitleIDs); p.Do(m_TitleIDs);
u32 Count = m_ContentAccessMap.size(); u32 Count = (u32)(m_ContentAccessMap.size());
p.Do(Count); p.Do(Count);
u32 CFD, Position; u32 CFD, Position;

View file

@ -571,7 +571,7 @@ void CWII_IPC_HLE_Device_fs::DoState(PointerWrap& p)
} }
else else
{ {
u32 size = entry.size; u32 size = (u32)entry.size;
p.Do(size); p.Do(size);
File::IOFile handle(entry.physicalName, "rb"); File::IOFile handle(entry.physicalName, "rb");

View file

@ -866,7 +866,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets() bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets()
{ {
SQueuedEvent Event(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size(), 0); SQueuedEvent Event((u32)(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + (sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size())), 0);
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets"); INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets");

View file

@ -445,10 +445,11 @@ void NetPlayClient::SendWiimoteState(const PadMapping in_game_pad, const NetWiim
sf::Packet spac; sf::Packet spac;
spac << (MessageId)NP_MSG_WIIMOTE_DATA; spac << (MessageId)NP_MSG_WIIMOTE_DATA;
spac << in_game_pad; spac << in_game_pad;
u8 size = nw.size(); spac << (u8)nw.size();
spac << size; for (auto it : nw)
for (unsigned int i = 0; i < size; ++i) {
spac << nw.data()[i]; spac << it;
}
std::lock_guard<std::recursive_mutex> lks(m_crit.send); std::lock_guard<std::recursive_mutex> lks(m_crit.send);
m_socket.Send(spac); m_socket.Send(spac);

View file

@ -153,7 +153,7 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
rpac >> player.name; rpac >> player.name;
// give new client first available id // give new client first available id
player.pid = m_players.size() + 1; player.pid = (PlayerId)(m_players.size() + 1);
// try to automatically assign new user a pad // try to automatically assign new user a pad
for (unsigned int m = 0; m < 4; ++m) for (unsigned int m = 0; m < 4; ++m)
@ -435,12 +435,14 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, sf::SocketTCP& socket)
case NP_MSG_PONG : case NP_MSG_PONG :
{ {
const u32 ping = m_ping_timer.GetTimeElapsed(); const u32 ping = (u32)m_ping_timer.GetTimeElapsed();
u32 ping_key = 0; u32 ping_key = 0;
packet >> ping_key; packet >> ping_key;
if (m_ping_key == ping_key) if (m_ping_key == ping_key)
{
player.ping = ping; player.ping = ping;
}
sf::Packet spac; sf::Packet spac;
spac << (MessageId)NP_MSG_PLAYER_PING_DATA; spac << (MessageId)NP_MSG_PLAYER_PING_DATA;

View file

@ -234,7 +234,7 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void)
XEmitter emitter(start); XEmitter emitter(start);
const u8 *trampoline = trampolines.GetWriteTrampoline(info, registersInUse); const u8 *trampoline = trampolines.GetWriteTrampoline(info, registersInUse);
emitter.CALL((void *)trampoline); emitter.CALL((void *)trampoline);
emitter.NOP(codePtr + info.instructionSize - emitter.GetCodePtr()); emitter.NOP((int)(codePtr + info.instructionSize - emitter.GetCodePtr()));
return start; return start;
} }
#else #else

View file

@ -323,7 +323,7 @@ void EmuCodeBlock::SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int acce
MOV(32, M(&PC), Imm32(jit->js.compilerPC)); // Helps external systems know which instruction triggered the write MOV(32, M(&PC), Imm32(jit->js.compilerPC)); // Helps external systems know which instruction triggered the write
TEST(32, R(reg_addr), Imm32(mem_mask)); TEST(32, R(reg_addr), Imm32(mem_mask));
FixupBranch fast = J_CC(CC_Z, true); FixupBranch fast = J_CC(CC_Z, true);
bool noProlog = flags & SAFE_LOADSTORE_NO_PROLOG; bool noProlog = (0 != (flags & SAFE_LOADSTORE_NO_PROLOG));
bool swap = !(flags & SAFE_LOADSTORE_NO_SWAP); bool swap = !(flags & SAFE_LOADSTORE_NO_SWAP);
ABI_PushRegistersAndAdjustStack(registersInUse, noProlog); ABI_PushRegistersAndAdjustStack(registersInUse, noProlog);
switch (accessSize) switch (accessSize)

View file

@ -192,7 +192,7 @@ void PrintInstructionRunCounts()
{ {
op_inf x; op_inf x;
x.name = m_allInstructions[i]->opname; x.name = m_allInstructions[i]->opname;
x.count = m_allInstructions[i]->runCount; x.count = (int)(m_allInstructions[i]->runCount);
temp.push_back(x); temp.push_back(x);
} }
std::sort(temp.begin(), temp.end()); std::sort(temp.begin(), temp.end());

View file

@ -247,7 +247,7 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
// Setting up the header // Setting up the header
StateHeader header; StateHeader header;
memcpy(header.gameID, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), 6); memcpy(header.gameID, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str(), 6);
header.size = g_use_compression ? buffer_size : 0; header.size = g_use_compression ? (u32)buffer_size : 0;
header.time = Common::Timer::GetDoubleTime(); header.time = Common::Timer::GetDoubleTime();
f.WriteArray(&header, 1); f.WriteArray(&header, 1);
@ -261,9 +261,13 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
lzo_uint out_len = 0; lzo_uint out_len = 0;
if ((i + IN_LEN) >= buffer_size) if ((i + IN_LEN) >= buffer_size)
cur_len = buffer_size - i; {
cur_len = (lzo_uint32)(buffer_size - i);
}
else else
{
cur_len = IN_LEN; cur_len = IN_LEN;
}
if (lzo1x_1_compress(buffer_data + i, cur_len, out, &out_len, wrkmem) != LZO_E_OK) if (lzo1x_1_compress(buffer_data + i, cur_len, out, &out_len, wrkmem) != LZO_E_OK)
PanicAlertT("Internal LZO Error - compression failed"); PanicAlertT("Internal LZO Error - compression failed");

View file

@ -154,12 +154,13 @@ Joystick::~Joystick()
{ {
// stop/destroy all effects // stop/destroy all effects
SDL_HapticStopAll(m_haptic); SDL_HapticStopAll(m_haptic);
std::list<EffectIDState>::iterator for (auto &i : m_state_out)
i = m_state_out.begin(), {
e = m_state_out.end(); if (i.id != -1)
for ( ; i != e; ++i) {
if (i->id != -1) SDL_HapticDestroyEffect(m_haptic, i.id);
SDL_HapticDestroyEffect(m_haptic, i->id); }
}
// close haptic first // close haptic first
SDL_HapticClose(m_haptic); SDL_HapticClose(m_haptic);
} }
@ -210,7 +211,7 @@ void Joystick::ConstantEffect::SetState(ControlState state)
} }
const Sint16 old = m_effect.effect.constant.level; const Sint16 old = m_effect.effect.constant.level;
m_effect.effect.constant.level = state * 0x7FFF; m_effect.effect.constant.level = (Sint16)(state * 0x7FFF);
if (old != m_effect.effect.constant.level) if (old != m_effect.effect.constant.level)
m_effect.changed = true; m_effect.changed = true;
} }
@ -228,7 +229,7 @@ void Joystick::RampEffect::SetState(ControlState state)
} }
const Sint16 old = m_effect.effect.ramp.start; const Sint16 old = m_effect.effect.ramp.start;
m_effect.effect.ramp.start = state * 0x7FFF; m_effect.effect.ramp.start = (Sint16)(state * 0x7FFF);
if (old != m_effect.effect.ramp.start) if (old != m_effect.effect.ramp.start)
m_effect.changed = true; m_effect.changed = true;
} }
@ -247,7 +248,7 @@ void Joystick::SineEffect::SetState(ControlState state)
const Sint16 old = m_effect.effect.periodic.magnitude; const Sint16 old = m_effect.effect.periodic.magnitude;
m_effect.effect.periodic.period = 5; m_effect.effect.periodic.period = 5;
m_effect.effect.periodic.magnitude = state * 0x5000; m_effect.effect.periodic.magnitude = (Sint16)(state * 0x5000);
m_effect.effect.periodic.attack_length = 0; m_effect.effect.periodic.attack_length = 0;
m_effect.effect.periodic.fade_length = 500; m_effect.effect.periodic.fade_length = 500;
@ -293,7 +294,7 @@ void Joystick::TriangleEffect::SetState(ControlState state)
const Sint16 old = m_effect.effect.periodic.magnitude; const Sint16 old = m_effect.effect.periodic.magnitude;
m_effect.effect.periodic.period = 5; m_effect.effect.periodic.period = 5;
m_effect.effect.periodic.magnitude = state * 0x5000; m_effect.effect.periodic.magnitude = (Sint16)(state * 0x5000);
m_effect.effect.periodic.attack_length = 0; m_effect.effect.periodic.attack_length = 0;
m_effect.effect.periodic.fade_length = 100; m_effect.effect.periodic.fade_length = 100;
@ -313,34 +314,35 @@ bool Joystick::UpdateInput()
bool Joystick::UpdateOutput() bool Joystick::UpdateOutput()
{ {
#ifdef USE_SDL_HAPTIC #ifdef USE_SDL_HAPTIC
std::list<EffectIDState>::iterator for (auto &i : m_state_out)
i = m_state_out.begin(),
e = m_state_out.end();
for ( ; i != e; ++i)
{ {
if (i->changed) // if SetState was called on this output if (i.changed) // if SetState was called on this output
{ {
if (-1 == i->id) // effect isn't currently uploaded if (-1 == i.id) // effect isn't currently uploaded
{ {
if (i->effect.type) // if outputstate is >0 this would be true if (i.effect.type) // if outputstate is >0 this would be true
if ((i->id = SDL_HapticNewEffect( m_haptic, &i->effect )) > -1) // upload the effect {
SDL_HapticRunEffect(m_haptic, i->id, 1); // run the effect if ((i.id = SDL_HapticNewEffect(m_haptic, &i.effect)) > -1) // upload the effect
{
SDL_HapticRunEffect(m_haptic, i.id, 1); // run the effect
}
}
} }
else // effect is already uploaded else // effect is already uploaded
{ {
if (i->effect.type) // if ouputstate >0 if (i.effect.type) // if ouputstate >0
{ {
SDL_HapticUpdateEffect(m_haptic, i->id, &i->effect); // update the effect SDL_HapticUpdateEffect(m_haptic, i.id, &i.effect); // update the effect
} }
else else
{ {
SDL_HapticStopEffect(m_haptic, i->id); // else, stop and remove the effect SDL_HapticStopEffect(m_haptic, i.id); // else, stop and remove the effect
SDL_HapticDestroyEffect(m_haptic, i->id); SDL_HapticDestroyEffect(m_haptic, i.id);
i->id = -1; // mark it as not uploaded i.id = -1; // mark it as not uploaded
} }
} }
i->changed = false; i.changed = false;
} }
} }
#endif #endif

View file

@ -144,7 +144,7 @@ RasterFont::RasterFont()
for(u32 y=0; y<char_height; y++) { for(u32 y=0; y<char_height; y++) {
for(u32 c=0; c<char_count; c++) { for(u32 c=0; c<char_count; c++) {
for(u32 x=0; x<char_width; x++) { for(u32 x=0; x<char_width; x++) {
bool pixel = rasters[c][y] & (1<<(char_width-x-1)); bool pixel = (0 != (rasters[c][y] & (1<<(char_width-x-1))));
texture_data[char_width*char_count*y+char_width*c+x] = pixel ? -1 : 0; texture_data[char_width*char_count*y+char_width*c+x] = pixel ? -1 : 0;
} }
} }

View file

@ -1460,7 +1460,7 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++) for (int iy = 0, xStep = 4 * yStep; iy < 4; iy++, xStep++)
{ {
u32 *newdst = dst+(y+iy)*width+x; u32 *newdst = dst+(y+iy)*width+x;
const __m128i mask = _mm_set_epi8(128,128,6,7,128,128,4,5,128,128,2,3,128,128,0,1); const __m128i mask = _mm_set_epi8(-128,-128,6,7,-128,-128,4,5,-128,-128,2,3,-128,-128,0,1);
const __m128i valV = _mm_shuffle_epi8(_mm_loadl_epi64((const __m128i*)(src + 8 * xStep)),mask); const __m128i valV = _mm_shuffle_epi8(_mm_loadl_epi64((const __m128i*)(src + 8 * xStep)),mask);
int cmp = _mm_movemask_epi8(valV); //MSB: 0x2 = val0; 0x20=val1; 0x200 = val2; 0x2000=val3 int cmp = _mm_movemask_epi8(valV); //MSB: 0x2 = val0; 0x20=val1; 0x200 = val2; 0x2000=val3
if ((cmp&0x2222)==0x2222) // SSSE3 case #1: all 4 pixels are in RGB555 and alpha = 0xFF. if ((cmp&0x2222)==0x2222) // SSSE3 case #1: all 4 pixels are in RGB555 and alpha = 0xFF.