first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,68 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __SCRIPT_NETWORK_DEBUGGER__
#define __SCRIPT_NETWORK_DEBUGGER__
#include "async/async_call_queue.h"
#include "script/script_vm_debug_profile_base.h"
namespace GS {
namespace Script {
class NetworkDebuggerThread;
/*!
@short Networked debugger VM event handler.
This event handler spawns and communicates with a network controller thread.
@author Emmanuel Julien (ejulien@owloh.com)
*/
class NetworkDebugger : public IDebuggerProfiler
{
NetworkDebuggerThread *thread;
bool start_signal;
public:
ASync::CallQueue async;
String GetPeerAddress();
bool IsConnected() const;
void Stop();
void BroadcastNetworkCommand(const String &);
bool GetStartSignal() const { return start_signal; }
// Network debugger interface.
virtual void OnNetworkReady(const String &, int) {}
virtual void OnControllerConnected() {}
virtual void OnControllerDisconnected() {}
virtual void OnControllerPacketReceived(const Array <char> &);
// Debugger interface implementation.
void OnSuspendExecution(const char *source, int line);
bool OnUpdateSuspendedExecution();
// VM interface implementation.
void OnFatalError(const char *reason);
void OnCompilerError(const char *error, const char *source, int line);
void OnRuntimeException(const char *error);
NetworkDebugger(IVM *vm, IDebugger *dbg, const char *address, int port);
~NetworkDebugger();
};
} // Script
} // GS
#endif // __SCRIPT_NETWORK_DEBUGGER__

View File

@ -0,0 +1,76 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __NETWORK_DEBUGGER_THREAD__
#define __NETWORK_DEBUGGER_THREAD__
#include "network_enet/enet_network.h"
#include "async/async_call_queue.h"
#include "thread/thread.h"
#include "nstring/nstring.h"
namespace GS {
namespace Script {
class NetworkDebugger;
/*!
@short Debugger network controller.
@author Emmanuel Julien (ejulien@gsworks.fr)
*/
class NetworkDebuggerThread : public Threading::Thread, public Network::Enet
{
protected:
String address;
int port;
NetworkDebugger &ctl;
private:
static const int StateStopped = 0;
static const int StateWaitingController = 1;
static const int StateControllerConnected = 2;
static const int StateStop = 3;
Threading::Atomic32 connected, state;
void *ctl_peer;
virtual void OnPeerConnection(void *);
virtual void OnPacketReceived(void *, const void *, size_t);
virtual void OnConnectionClosed(void *);
virtual bool OpenServer(const char *address = "127.0.0.1", int port = 999);
virtual bool OpenClient(const char *address = "127.0.0.1", int port = 999) { return false; }
virtual void Execute();
public:
String GetControllerAddress();
bool IsConnected() const { return asbool(connected.Get()); }
void DisconnectController();
void SendToController(const String &);
void Stop();
ASync::CallQueue async;
NetworkDebuggerThread(NetworkDebugger &h, const char *address, int port);
~NetworkDebuggerThread();
};
} // Script
} // GS
#endif // __NETWORK_DEBUGGER_THREAD__