From 0ed6c602b14554a02f7782bd5e5635b1e9d9c195 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Fri, 3 Jul 2026 22:02:56 -0500 Subject: init --- src/type.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/type.c (limited to 'src/type.c') diff --git a/src/type.c b/src/type.c new file mode 100644 index 0000000..19548e9 --- /dev/null +++ b/src/type.c @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tinyosc.h" +#include "tinyosc.c" + +/* + type.c. sends text to vrchat using osc from user input. + Copyright (C) 2026 iceyrazor + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + + +int main(int argc, char **argv){ + char wbuffer[2048]; // declare a 2Kb buffer to read packet data into + int port=9000; + struct sockaddr_in servaddr; + + int socketfd = socket(AF_INET, SOCK_DGRAM, 0); + if (socketfd < 0) { + perror("ERROR:"); + return -1; + } + + servaddr.sin_family = AF_INET; // IPv4 + servaddr.sin_port = htons(port); // Server port + servaddr.sin_addr.s_addr = inet_addr("127.0.0.1"); // Server IP + + size_t size=0; + for (int i=1; i < argc; i++){ + size+=strlen(argv[i])+1; + } + char *send_str=(char*)malloc(sizeof(char)*size+1); + send_str[0]='\0'; + for (int i=1; i < argc; i++){ + strcat(send_str,argv[i]); + strcat(send_str," "); + } + + int len = tosc_writeMessage(wbuffer, sizeof(wbuffer), "/chatbox/input", "sTF", send_str); + sendto(socketfd, wbuffer, len, MSG_CONFIRM, (const struct sockaddr *)&servaddr, sizeof(servaddr)); + + free(send_str); + + return 0; +} -- cgit v1.3