usbgecko:

add some nice messages for SE LED commands.
allow exi communication even if there is no tcp client.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6879 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2011-01-19 03:47:01 +00:00
parent 83cff0fa63
commit f4dc56d553
1 changed files with 12 additions and 6 deletions

View File

@ -73,7 +73,7 @@ THREAD_RETURN GeckoSockServer::GeckoConnectionWaiter(void*)
return 0; return 0;
Core::DisplayMessage( Core::DisplayMessage(
StringFromFormat("USBGecko: listening on TCP port %u", server_port), StringFromFormat("USBGecko: Listening on TCP port %u", server_port),
5000); 5000);
server.SetBlocking(false); server.SetBlocking(false);
@ -106,6 +106,8 @@ bool GeckoSockServer::GetAvailableSock(sf::SocketTCP &sock_to_fill)
client_running = false; client_running = false;
delete clientThread; delete clientThread;
clientThread = NULL; clientThread = NULL;
recv_fifo = std::queue<u8>();
send_fifo = std::queue<u8>();
} }
clientThread = new Common::Thread(ClientThreadFunc, this); clientThread = new Common::Thread(ClientThreadFunc, this);
client_count++; client_count++;
@ -157,15 +159,19 @@ void CEXIGecko::ImmReadWrite(u32 &_uData, u32 _uSize)
(void)_uSize; (void)_uSize;
if (!client.IsValid()) if (!client.IsValid())
if (!GetAvailableSock(client)) GetAvailableSock(client);
return;
switch (_uData >> 28) switch (_uData >> 28)
{ {
// maybe do something fun later
case CMD_LED_OFF: case CMD_LED_OFF:
Core::DisplayMessage(StringFromFormat(
"USBGecko: No LEDs for you!"),
3000);
break; break;
case CMD_LED_ON: case CMD_LED_ON:
Core::DisplayMessage(StringFromFormat(
"USBGecko: A piercing blue light is now shining in your general direction"),
3000);
break; break;
case CMD_INIT: case CMD_INIT:
@ -176,7 +182,7 @@ void CEXIGecko::ImmReadWrite(u32 &_uData, u32 _uSize)
// |= 0x08000000 if successful // |= 0x08000000 if successful
case CMD_RECV: case CMD_RECV:
transfer_lock.Enter(); transfer_lock.Enter();
if (recv_fifo.size()) if (!recv_fifo.empty())
{ {
_uData = 0x08000000 | (recv_fifo.front() << 16); _uData = 0x08000000 | (recv_fifo.front() << 16);
recv_fifo.pop(); recv_fifo.pop();
@ -201,7 +207,7 @@ void CEXIGecko::ImmReadWrite(u32 &_uData, u32 _uSize)
// |= 0x04000000 if data in recv FIFO // |= 0x04000000 if data in recv FIFO
case CMD_CHK_RX: case CMD_CHK_RX:
transfer_lock.Enter(); transfer_lock.Enter();
_uData = recv_fifo.size() ? 0x04000000 : 0; _uData = recv_fifo.empty() ? 0 : 0x04000000;
transfer_lock.Leave(); transfer_lock.Leave();
break; break;