Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // based on the pre-decomp https://github.com/MNGoldenEagle/DebugConsole/blob/master/DebugServer.js
- var debugServer = new Server({port:411});
- var socket = null;
- // default baserom location for function
- var proutSyncPrintf = 0x800021B0
- // decomp map file path
- path_to_map_file = "path/to/z64.map"
- // set function location from map file if provided
- if (path_to_map_file != "") {
- var is_prout_pattern = / 0x00000000([\da-fA-F]{8}) is_proutSyncPrintf/
- var map_content = fs.readFile(path_to_map_file)
- if (map_content == false) {
- throw new Error("Failed to open map file for reading\n");
- }
- proutSyncPrintf = parseInt("0x" + is_prout_pattern.exec(map_content.toString())[1])
- }
- debugServer.on('connection', function(newSocket) {
- socket = newSocket;
- console.print("Connection to client established.\n");
- socket.write("Server reporting ready status.\n");
- newSocket.on('close', function() {
- console.print("Connection to client lost.\n");
- socket = null;
- });
- });
- events.onexec(proutSyncPrintf, function() {
- var addr = gpr.a1;
- var len = gpr.a2;
- var str = mem.getblock(addr, len);
- if (socket !== null) {
- socket.write(str);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement