diff --git a/.gitmodules b/.gitmodules index 26854023e..83508951c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "third_party/sparsehash"] path = third_party/sparsehash url = https://github.com/benvanik/sparsehash.git -[submodule "third_party/wslay"] - path = third_party/wslay - url = https://github.com/benvanik/wslay.git [submodule "third_party/libjit"] path = third_party/libjit url = https://github.com/benvanik/libjit.git diff --git a/src/xenia/dbg/debugger.cc b/src/xenia/dbg/debugger.cc index 27cf39026..07ce09f8a 100644 --- a/src/xenia/dbg/debugger.cc +++ b/src/xenia/dbg/debugger.cc @@ -12,7 +12,7 @@ #include #include -#include +#include using namespace xe; @@ -26,7 +26,7 @@ DEFINE_int32(remote_debug_port, 6200, Debugger::Debugger() { - listener_ = auto_ptr(new WsListener(this, FLAGS_remote_debug_port)); + //listener_ = auto_ptr(new WsListener(this, FLAGS_remote_debug_port)); } Debugger::~Debugger() { @@ -50,6 +50,11 @@ void Debugger::RegisterContentSource(ContentSource* content_source) { } int Debugger::Startup() { + // HACK(benvanik): say we are ok even if we have no listener. + if (!listener_.get()) { + return 0; + } + // Start listener. // This may launch a thread and such. if (listener_->Setup()) { diff --git a/src/xenia/dbg/simple_sha1.cc b/src/xenia/dbg/simple_sha1.cc deleted file mode 100644 index 8529a6560..000000000 --- a/src/xenia/dbg/simple_sha1.cc +++ /dev/null @@ -1,234 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#include - -#if XE_PLATFORM(WIN32) -#include -#else -#include -#endif // WIN32 - - -using namespace xe; -using namespace xe::dbg; - - -namespace { - - -// http://git.kernel.org/?p=git/git.git;a=blob;f=block-sha1/sha1.c - -/* - * SHA1 routine optimized to do word accesses rather than byte accesses, - * and to avoid unnecessary copies into the context array. - * - * This was initially based on the Mozilla SHA1 implementation, although - * none of the original Mozilla code remains. - */ - -typedef struct { - size_t size; - uint32_t H[5]; - uint32_t W[16]; -} SHA_CTX; - -#define SHA_ROT(X,l,r) (((X) << (l)) | ((X) >> (r))) -#define SHA_ROL(X,n) SHA_ROT(X,n,32-(n)) -#define SHA_ROR(X,n) SHA_ROT(X,32-(n),n) - -#define setW(x, val) (*(volatile unsigned int *)&W(x) = (val)) - -#define get_be32(p) ntohl(*(unsigned int *)(p)) -#define put_be32(p, v) do { *(unsigned int *)(p) = htonl(v); } while (0) - -#define W(x) (array[(x)&15]) - -#define SHA_SRC(t) get_be32((unsigned char *) block + (t)*4) -#define SHA_MIX(t) SHA_ROL(W((t)+13) ^ W((t)+8) ^ W((t)+2) ^ W(t), 1); - -#define SHA_ROUND(t, input, fn, constant, A, B, C, D, E) do { \ - unsigned int TEMP = input(t); setW(t, TEMP); \ - E += TEMP + SHA_ROL(A,5) + (fn) + (constant); \ - B = SHA_ROR(B, 2); } while (0) - -#define T_0_15(t, A, B, C, D, E) SHA_ROUND(t, SHA_SRC, (((C^D)&B)^D) , 0x5a827999, A, B, C, D, E ) -#define T_16_19(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (((C^D)&B)^D) , 0x5a827999, A, B, C, D, E ) -#define T_20_39(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0x6ed9eba1, A, B, C, D, E ) -#define T_40_59(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, ((B&C)+(D&(B^C))) , 0x8f1bbcdc, A, B, C, D, E ) -#define T_60_79(t, A, B, C, D, E) SHA_ROUND(t, SHA_MIX, (B^C^D) , 0xca62c1d6, A, B, C, D, E ) - -static void SHA1_Block(SHA_CTX *ctx, const void *block) { - uint32_t A = ctx->H[0]; - uint32_t B = ctx->H[1]; - uint32_t C = ctx->H[2]; - uint32_t D = ctx->H[3]; - uint32_t E = ctx->H[4]; - - uint32_t array[16]; - - /* Round 1 - iterations 0-16 take their input from 'block' */ - T_0_15( 0, A, B, C, D, E); - T_0_15( 1, E, A, B, C, D); - T_0_15( 2, D, E, A, B, C); - T_0_15( 3, C, D, E, A, B); - T_0_15( 4, B, C, D, E, A); - T_0_15( 5, A, B, C, D, E); - T_0_15( 6, E, A, B, C, D); - T_0_15( 7, D, E, A, B, C); - T_0_15( 8, C, D, E, A, B); - T_0_15( 9, B, C, D, E, A); - T_0_15(10, A, B, C, D, E); - T_0_15(11, E, A, B, C, D); - T_0_15(12, D, E, A, B, C); - T_0_15(13, C, D, E, A, B); - T_0_15(14, B, C, D, E, A); - T_0_15(15, A, B, C, D, E); - - /* Round 1 - tail. Input from 512-bit mixing array */ - T_16_19(16, E, A, B, C, D); - T_16_19(17, D, E, A, B, C); - T_16_19(18, C, D, E, A, B); - T_16_19(19, B, C, D, E, A); - - /* Round 2 */ - T_20_39(20, A, B, C, D, E); - T_20_39(21, E, A, B, C, D); - T_20_39(22, D, E, A, B, C); - T_20_39(23, C, D, E, A, B); - T_20_39(24, B, C, D, E, A); - T_20_39(25, A, B, C, D, E); - T_20_39(26, E, A, B, C, D); - T_20_39(27, D, E, A, B, C); - T_20_39(28, C, D, E, A, B); - T_20_39(29, B, C, D, E, A); - T_20_39(30, A, B, C, D, E); - T_20_39(31, E, A, B, C, D); - T_20_39(32, D, E, A, B, C); - T_20_39(33, C, D, E, A, B); - T_20_39(34, B, C, D, E, A); - T_20_39(35, A, B, C, D, E); - T_20_39(36, E, A, B, C, D); - T_20_39(37, D, E, A, B, C); - T_20_39(38, C, D, E, A, B); - T_20_39(39, B, C, D, E, A); - - /* Round 3 */ - T_40_59(40, A, B, C, D, E); - T_40_59(41, E, A, B, C, D); - T_40_59(42, D, E, A, B, C); - T_40_59(43, C, D, E, A, B); - T_40_59(44, B, C, D, E, A); - T_40_59(45, A, B, C, D, E); - T_40_59(46, E, A, B, C, D); - T_40_59(47, D, E, A, B, C); - T_40_59(48, C, D, E, A, B); - T_40_59(49, B, C, D, E, A); - T_40_59(50, A, B, C, D, E); - T_40_59(51, E, A, B, C, D); - T_40_59(52, D, E, A, B, C); - T_40_59(53, C, D, E, A, B); - T_40_59(54, B, C, D, E, A); - T_40_59(55, A, B, C, D, E); - T_40_59(56, E, A, B, C, D); - T_40_59(57, D, E, A, B, C); - T_40_59(58, C, D, E, A, B); - T_40_59(59, B, C, D, E, A); - - /* Round 4 */ - T_60_79(60, A, B, C, D, E); - T_60_79(61, E, A, B, C, D); - T_60_79(62, D, E, A, B, C); - T_60_79(63, C, D, E, A, B); - T_60_79(64, B, C, D, E, A); - T_60_79(65, A, B, C, D, E); - T_60_79(66, E, A, B, C, D); - T_60_79(67, D, E, A, B, C); - T_60_79(68, C, D, E, A, B); - T_60_79(69, B, C, D, E, A); - T_60_79(70, A, B, C, D, E); - T_60_79(71, E, A, B, C, D); - T_60_79(72, D, E, A, B, C); - T_60_79(73, C, D, E, A, B); - T_60_79(74, B, C, D, E, A); - T_60_79(75, A, B, C, D, E); - T_60_79(76, E, A, B, C, D); - T_60_79(77, D, E, A, B, C); - T_60_79(78, C, D, E, A, B); - T_60_79(79, B, C, D, E, A); - - ctx->H[0] += A; - ctx->H[1] += B; - ctx->H[2] += C; - ctx->H[3] += D; - ctx->H[4] += E; -} - -void SHA1_Update(SHA_CTX *ctx, const void *data, unsigned long len) -{ - uint32_t lenW = ctx->size & 63; - ctx->size += len; - - if (lenW) { - uint32_t left = 64 - lenW; - if (len < left) { - left = len; - } - memcpy(lenW + (char *)ctx->W, data, left); - lenW = (lenW + left) & 63; - len -= left; - data = ((const char *)data + left); - if (lenW) { - return; - } - SHA1_Block(ctx, ctx->W); - } - while (len >= 64) { - SHA1_Block(ctx, data); - data = ((const char *)data + 64); - len -= 64; - } - if (len) { - memcpy(ctx->W, data, len); - } -} - -} - - -void xe::dbg::SHA1(const uint8_t* data, size_t length, uint8_t out_hash[20]) { - static const uint8_t pad[64] = { 0x80 }; - - SHA_CTX ctx = { - 0, - { - 0x67452301, - 0xefcdab89, - 0x98badcfe, - 0x10325476, - 0xc3d2e1f0, - }, - { 0 } - }; - - SHA1_Update(&ctx, data, (unsigned long)length); - - uint32_t padlen[2] = { - htonl((uint32_t)(ctx.size >> 29)), - htonl((uint32_t)(ctx.size << 3)), - }; - - size_t i = ctx.size & 63; - SHA1_Update(&ctx, pad, 1 + (63 & (55 - i))); - SHA1_Update(&ctx, padlen, 8); - - for (size_t n = 0; n < 5; n++) { - put_be32(out_hash + n * 4, ctx.H[n]); - } -} diff --git a/src/xenia/dbg/simple_sha1.h b/src/xenia/dbg/simple_sha1.h deleted file mode 100644 index 7ac269d2d..000000000 --- a/src/xenia/dbg/simple_sha1.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef XENIA_DBG_SIMPLE_SHA1_H_ -#define XENIA_DBG_SIMPLE_SHA1_H_ - -#include -#include - - -namespace xe { -namespace dbg { - - -// This is a (likely) slow SHA1 designed for use on small values such as -// Websocket security keys. If we need something more complex it'd be best -// to use a real library. -void SHA1(const uint8_t* data, size_t length, uint8_t out_hash[20]); - - -} // namespace dbg -} // namespace xe - - -#endif // XENIA_DBG_SIMPLE_SHA1_H_ diff --git a/src/xenia/dbg/sources.gypi b/src/xenia/dbg/sources.gypi index d379f69f1..80b60dc46 100644 --- a/src/xenia/dbg/sources.gypi +++ b/src/xenia/dbg/sources.gypi @@ -9,11 +9,5 @@ 'debugger.h', 'listener.cc', 'listener.h', - 'simple_sha1.cc', - 'simple_sha1.h', - 'ws_client.cc', - 'ws_client.h', - 'ws_listener.cc', - 'ws_listener.h', ], } diff --git a/third_party/wslay b/third_party/wslay deleted file mode 160000 index 8546b48b4..000000000 --- a/third_party/wslay +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8546b48b436cf4e176caf2177fe96c68adf4a292 diff --git a/third_party/wslay.gypi b/third_party/wslay.gypi deleted file mode 100644 index de99a01f1..000000000 --- a/third_party/wslay.gypi +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright 2013 Ben Vanik. All Rights Reserved. -{ - 'targets': [ - { - 'target_name': 'wslay', - 'type': '<(library)', - - 'direct_dependent_settings': { - 'include_dirs': [ - 'wslay/lib/includes/', - ], - - 'defines': [ - 'WSLAY_VERSION=1', - ], - - # libraries: ws2_32 on windows - }, - - 'defines': [ - 'WSLAY_VERSION="1"', - ], - - 'conditions': [ - ['OS != "win"', { - 'defines': [ - 'HAVE_ARPA_INET_H=1', - 'HAVE_NETINET_IN_H=1', - ], - }], - ['OS == "win"', { - 'defines': [ - 'HAVE_WINSOCK2_H=1', - 'ssize_t=long long', - ], - }], - ], - - 'include_dirs': [ - 'wslay/lib/', - 'wslay/lib/includes/', - ], - - 'sources': [ - 'wslay/lib/includes/wslay/wslay.h', - 'wslay/lib/wslay_event.c', - 'wslay/lib/wslay_event.h', - 'wslay/lib/wslay_frame.c', - 'wslay/lib/wslay_frame.h', - 'wslay/lib/wslay_net.c', - 'wslay/lib/wslay_net.h', - 'wslay/lib/wslay_queue.c', - 'wslay/lib/wslay_queue.h', - 'wslay/lib/wslay_stack.c', - 'wslay/lib/wslay_stack.h', - ], - } - ] -} diff --git a/tools/xenia-run/xenia-run.cc b/tools/xenia-run/xenia-run.cc index 09753f861..a5d0c8097 100644 --- a/tools/xenia-run/xenia-run.cc +++ b/tools/xenia-run/xenia-run.cc @@ -82,7 +82,7 @@ int Run::Launch(const xechar_t* path) { // Run the debugger. // This may pause waiting for connections. if (debugger_->Startup()) { - XELOGE("Debugger failed to startup"); + XELOGE("Debugger failed to start up"); return 1; } diff --git a/xenia.gyp b/xenia.gyp index fd29466eb..2b7e05a11 100644 --- a/xenia.gyp +++ b/xenia.gyp @@ -4,7 +4,6 @@ 'tools/tools.gypi', 'third_party/gflags.gypi', 'third_party/sparsehash.gypi', - 'third_party/wslay.gypi', ], 'targets': [ @@ -15,12 +14,10 @@ 'dependencies': [ 'gflags', - 'wslay', 'third_party/libjit/libjit.gyp:libjit', ], 'export_dependent_settings': [ 'gflags', - 'wslay', 'third_party/libjit/libjit.gyp:libjit', ],