feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -23,7 +23,7 @@ elif env["builtin_wslay"]:
]
thirdparty_sources = [thirdparty_dir + s for s in thirdparty_sources]
env_ws.Prepend(CPPPATH=[thirdparty_dir])
env_ws.Prepend(CPPEXTPATH=[thirdparty_dir])
env_ws.Append(CPPDEFINES=["HAVE_CONFIG_H"])
if env["platform"] == "windows":

View file

@ -30,8 +30,6 @@
#include "editor_debugger_server_websocket.h"
#ifdef TOOLS_ENABLED
#include "../remote_debugger_peer_websocket.h"
#include "editor/editor_log.h"
@ -135,5 +133,3 @@ EditorDebuggerServer *EditorDebuggerServerWebSocket::create(const String &p_prot
ERR_FAIL_COND_V(p_protocol != "ws://", nullptr);
return memnew(EditorDebuggerServerWebSocket);
}
#endif // TOOLS_ENABLED

View file

@ -28,10 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EDITOR_DEBUGGER_SERVER_WEBSOCKET_H
#define EDITOR_DEBUGGER_SERVER_WEBSOCKET_H
#ifdef TOOLS_ENABLED
#pragma once
#include "../websocket_peer.h"
@ -64,7 +61,3 @@ public:
EditorDebuggerServerWebSocket();
~EditorDebuggerServerWebSocket();
};
#endif // TOOLS_ENABLED
#endif // EDITOR_DEBUGGER_SERVER_WEBSOCKET_H

View file

@ -37,7 +37,8 @@
void EMWSPeer::_esws_on_connect(void *p_obj, char *p_proto) {
EMWSPeer *peer = static_cast<EMWSPeer *>(p_obj);
peer->ready_state = STATE_OPEN;
peer->selected_protocol.parse_utf8(p_proto);
peer->selected_protocol.clear();
peer->selected_protocol.append_utf8(p_proto);
}
void EMWSPeer::_esws_on_message(void *p_obj, const uint8_t *p_data, int p_data_size, int p_is_string) {
@ -54,7 +55,8 @@ void EMWSPeer::_esws_on_error(void *p_obj) {
void EMWSPeer::_esws_on_close(void *p_obj, int p_code, const char *p_reason, int p_was_clean) {
EMWSPeer *peer = static_cast<EMWSPeer *>(p_obj);
peer->close_code = p_code;
peer->close_reason.parse_utf8(p_reason);
peer->close_reason.clear();
peer->close_reason.append_utf8(p_reason);
peer->ready_state = STATE_CLOSED;
}

View file

@ -28,15 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef EMWS_PEER_H
#define EMWS_PEER_H
#pragma once
#ifdef WEB_ENABLED
#include "packet_buffer.h"
#include "websocket_peer.h"
#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
#include "core/templates/ring_buffer.h"
@ -111,5 +109,3 @@ public:
};
#endif // WEB_ENABLED
#endif // EMWS_PEER_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef PACKET_BUFFER_H
#define PACKET_BUFFER_H
#pragma once
#include "core/templates/ring_buffer.h"
@ -128,5 +127,3 @@ public:
clear();
}
};
#endif // PACKET_BUFFER_H

View file

@ -28,12 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WEBSOCKET_REGISTER_TYPES_H
#define WEBSOCKET_REGISTER_TYPES_H
#pragma once
#include "modules/register_module_types.h"
void initialize_websocket_module(ModuleInitializationLevel p_level);
void uninitialize_websocket_module(ModuleInitializationLevel p_level);
#endif // WEBSOCKET_REGISTER_TYPES_H

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef REMOTE_DEBUGGER_PEER_WEBSOCKET_H
#define REMOTE_DEBUGGER_PEER_WEBSOCKET_H
#pragma once
#include "websocket_peer.h"
@ -58,5 +57,3 @@ public:
RemoteDebuggerPeerWebSocket(Ref<WebSocketPeer> p_peer = Ref<WebSocketPeer>());
};
#endif // REMOTE_DEBUGGER_PEER_WEBSOCKET_H

View file

@ -28,12 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WEBSOCKET_MULTIPLAYER_PEER_H
#define WEBSOCKET_MULTIPLAYER_PEER_H
#pragma once
#include "websocket_peer.h"
#include "core/error/error_list.h"
#include "core/io/tcp_server.h"
#include "core/templates/list.h"
#include "scene/main/multiplayer_peer.h"
@ -140,5 +138,3 @@ public:
WebSocketMultiplayerPeer();
~WebSocketMultiplayerPeer();
};
#endif // WEBSOCKET_MULTIPLAYER_PEER_H

View file

@ -28,11 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WEBSOCKET_PEER_H
#define WEBSOCKET_PEER_H
#pragma once
#include "core/crypto/crypto.h"
#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
class WebSocketPeer : public PacketPeer {
@ -127,5 +125,3 @@ public:
VARIANT_ENUM_CAST(WebSocketPeer::WriteMode);
VARIANT_ENUM_CAST(WebSocketPeer::State);
#endif // WEBSOCKET_PEER_H

View file

@ -151,7 +151,7 @@ Error WSLPeer::accept_stream(Ref<StreamPeer> p_stream) {
}
bool WSLPeer::_parse_client_request() {
Vector<String> psa = String((const char *)handshake_buffer->get_data_array().ptr(), handshake_buffer->get_position() - 4).split("\r\n");
Vector<String> psa = String::ascii(Span((const char *)handshake_buffer->get_data_array().ptr(), handshake_buffer->get_position() - 4)).split("\r\n");
int len = psa.size();
ERR_FAIL_COND_V_MSG(len < 4, false, "Not enough response headers, got: " + itos(len) + ", expected >= 4.");
@ -416,7 +416,7 @@ void WSLPeer::_do_client_handshake() {
}
bool WSLPeer::_verify_server_response() {
Vector<String> psa = String((const char *)handshake_buffer->get_data_array().ptr(), handshake_buffer->get_position() - 4).split("\r\n");
Vector<String> psa = String::ascii(Span((const char *)handshake_buffer->get_data_array().ptr(), handshake_buffer->get_position() - 4)).split("\r\n");
int len = psa.size();
ERR_FAIL_COND_V_MSG(len < 4, false, "Not enough response headers. Got: " + itos(len) + ", expected >= 4.");
@ -451,7 +451,7 @@ bool WSLPeer::_verify_server_response() {
WSL_CHECK_NC("sec-websocket-accept", _compute_key_response(session_key));
#undef WSL_CHECK_NC
#undef WSL_CHECK
if (supported_protocols.size() == 0) {
if (supported_protocols.is_empty()) {
// We didn't request a custom protocol
ERR_FAIL_COND_V_MSG(headers.has("sec-websocket-protocol"), false, "Received unrequested sub-protocol -> " + headers["sec-websocket-protocol"]);
} else {
@ -646,9 +646,9 @@ void WSLPeer::_wsl_msg_recv_callback(wslay_event_context_ptr ctx, const struct w
// Close request or confirmation.
peer->close_code = arg->status_code;
size_t len = arg->msg_length;
peer->close_reason = "";
peer->close_reason.clear();
if (len > 2 /* first 2 bytes = close code */) {
peer->close_reason.parse_utf8((char *)arg->msg + 2, len - 2);
peer->close_reason.append_utf8((char *)arg->msg + 2, len - 2);
}
if (peer->ready_state == STATE_OPEN) {
peer->ready_state = STATE_CLOSING;

View file

@ -28,8 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifndef WSL_PEER_H
#define WSL_PEER_H
#pragma once
#ifndef WEB_ENABLED
@ -37,7 +36,6 @@
#include "websocket_peer.h"
#include "core/crypto/crypto_core.h"
#include "core/error/error_list.h"
#include "core/io/stream_peer_tcp.h"
#include <wslay/wslay.h>
@ -168,5 +166,3 @@ public:
};
#endif // WEB_ENABLED
#endif // WSL_PEER_H