From e3dd31797e6bc1e76f5a46e1097ecb6951705055 Mon Sep 17 00:00:00 2001 From: Brad Colbert Date: Thu, 29 Feb 2024 14:11:56 -0800 Subject: [PATCH] Removed ASYNCIO from the yailsrv. There is much more to do with that. The "set server" command was borked due to INTERNAL CODE vs ATASCII mixup. Now converting all tokens to ATASCII before hand. --- Makefile.mak | 4 +++- YAIL.XEX | Bin 25538 -> 25522 bytes server/testclient.py | 27 ++++++++++++++------------- server/yailsrv.py | 16 +++++++--------- src/console.c | 42 ++++++++++++++++++------------------------ src/imgload.c | 4 ++-- src/netimage.c | 12 ++++++------ src/utility.c | 30 +++++++++++++++++++++++++++++- src/utility.h | 6 ++++++ 9 files changed, 85 insertions(+), 56 deletions(-) diff --git a/Makefile.mak b/Makefile.mak index 6202de8..c74b5b7 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -7,6 +7,8 @@ PRODUCT=YAIL TARGET=atari SRC_DIR=src CFLAGS=-Or +LINKFLAGS= +#LINKFLAGS=--debug-info -Wl --dbgfile,"myapp.dbg" # -D__SYSTEM_CHECK__=1 LIBRARIES=fujinet-lib/fujinet-atari-2.2.1.lib @@ -24,7 +26,7 @@ s_files: $(SRC_DIR)\*.s @$(MAKE) -nologo /f Makefile.mak $(**:.s=.o) link_files: $(SRC_DIR)\*.o - $(CL65) -t $(TARGET) $(CFLAGS) -o $(PRODUCT).XEX --config $(SRC_DIR)\$(PRODUCT).$(TARGET)-xex.cfg --mapfile $(PRODUCT).map -Ln $(PRODUCT).lbl $(**) $(TARGET).lib $(LIBRARIES) + $(CL65) -t $(TARGET) $(CFLAGS) $(LINKFLAGS) -o $(PRODUCT).XEX --config $(SRC_DIR)\$(PRODUCT).$(TARGET)-xex.cfg --mapfile $(PRODUCT).map -Ln $(PRODUCT).lbl $(**) $(TARGET).lib $(LIBRARIES) .s.o: $(CA65) -t $(TARGET) $< diff --git a/YAIL.XEX b/YAIL.XEX index 033a7d2e9f4227dbd0aa2df4b4cc37a4f7ce0698..0fa31d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!pM-AK$x*UDZz zPmlhD|KL@8FMI11K9CZ9h3|cpNz$DUB#8$5kA!I3Si8iQTUnxi6abRx=Q0|%t} z=UzeAC>W)jdllW0MKY3%EveVRGtmJ zHBik>&24Fk)7}9Hxpdwit?^t{9*tsC&A? zhpkB;UTx?>5Nv0^L^o8;U2XG>rn$dLAI&Cn*BtSOjWOijGLS#N&ir<9aTR3%A>nm& z?Ly%tT4*Lu)^MlR(>BZDW@%W&2@UM{&Rs{B4(@-g$0lk;=@>f@pIyiO@AWD}PqthZ zR&srfnu1e+DYOUFT2uz28SAZQQ(*Lr81q40)Zeup%%W$--uLM~sAUDJ*F&x72V%@- z8MVpO67^eYfm%?%epEFeVbK%zK{P0q!dyq3D?$gpQ;ce>($g=Xus#F*d@a6n;3Jfi z9%(U4c5LigB^y1I^6om!VVvqR=L3ZY>f?)LbFpB7Z?festjD)b)Ipk;Y2v_O-Kc< zgL!lE=PcSlDqWO;i{PC5cDH9!1F5Uu?CQ!iPq3rc7AU$+taEK396kLm!qzw^LYulW zsg9K0c*jawV;w^W24vl`;;zh5yK$iY;aXQ6so(C}MzNz*WX9&jvu8BSW|&1c&6>lc zE`o_S0W}F4}ESZ&H;@V8xJ=;8u948ZuKdk(YyeMd&}?%((Z~>Ha^Jl9x8Jeg&V_g7 zFIslr@)dxL`KbsJ_h`#At({IU0cGxphQtT<|_|Z#BCOd6fvOUFVpGJSSq}22&wkh_^ zRNIs^vu4_~sne#Vu=dn6XZmted_@6`%#{TWJe4&uwviF{nv3+J52cH%mX|M{H*fx; z+jHkH%+H;ldwbrUix=TH@8(N7fBTB<7D+b4Sp{Vi@88TTkMRCSdEaXzBTA!nYv9`+ zJ5(p#^NFb0vAb~&vfdm2x1QG}& a5J(`9Kp=rY0)Yeq-xh&E_Fq|B?*9c;_!_MM diff --git a/server/testclient.py b/server/testclient.py index e399bd8..c31da6d 100755 --- a/server/testclient.py +++ b/server/testclient.py @@ -8,22 +8,23 @@ client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # connect the client -client.connect(('127.0.0.1', 5556)) +client.connect(('192.168.1.126', 5556)) client.send(b'search funny\n') IMAGE_SIZE = 8807 -while True: - numbytes = 0 - # receive the response data (4096 is recommended buffer size) - while numbytes < IMAGE_SIZE: - response = client.recv(4096) - numbytes += len(response) - if numbytes == 0: - break +numbytes = 0 +# receive the response data (4096 is recommended buffer size) +while numbytes < IMAGE_SIZE: + response = client.recv(4096) + numbytes += len(response) - print('\trecv\'d %d bytes (%d)\n' % (len(response), numbytes)) - print('\trecv\'d %d bytes (%d)\n' % (len(response), numbytes)) + if numbytes == 0: + break + + print('\trecv\'d %d bytes (%d)\n' % (len(response), numbytes)) + +input("Press Enter to continue...") +client.send(b'quit\n') +client.close() - input("Press Enter to continue...") - client.send(b'stop\n') diff --git a/server/yailsrv.py b/server/yailsrv.py index d93784c..2f365b6 100644 --- a/server/yailsrv.py +++ b/server/yailsrv.py @@ -4,10 +4,10 @@ import requests import re -import json +#import json import time import logging -import urllib +#import urllib import os from tqdm import tqdm import socket @@ -18,7 +18,7 @@ from pprint import pprint from PIL import Image import numpy as np -import asyncio +#import asyncio GRAPHICS_8 = 2 GRAPHICS_9 = 4 @@ -65,7 +65,6 @@ def search_images(term, max_images=1000): def hash_string(s): import hashlib import binascii - #hsh = bytearray(hashlib.md5(s.encode(encoding="ascii")).digest()) hsh = bytearray(hashlib.shake_256(s.encode(encoding="ascii")).digest(2)) assert len(hsh) == 2 output = \ @@ -284,12 +283,11 @@ def stream_YAI(url, client, gfx_mode): print('Exception:', e) return False -# new asyncio loop - +# For now this function is not async. It may be in the future. def handle_client_connection(client_socket): # Set up a new event loop for this thread - loop = asyncio.new_event_loop() - asyncio.set_event_loop(loop) + #loop = asyncio.new_event_loop() + #asyncio.set_event_loop(loop) gfx_mode = GRAPHICS_9 try: @@ -339,7 +337,7 @@ def handle_client_connection(client_socket): finally: client_socket.close() - loop.close() # Close the loop when done + #loop.close() # Close the loop when done def main(): while True: diff --git a/src/console.c b/src/console.c index 42a93c8..c8f9f10 100644 --- a/src/console.c +++ b/src/console.c @@ -6,6 +6,7 @@ #include "files.h" #include "consts.h" #include "types.h" +#include "utility.h" #include #include @@ -32,8 +33,8 @@ char CONSOLE_BUFF[GFX_0_MEM_LINE * CONSOLE_LINES]; #else #define CONSOLE_BUFF ((byte*)((ushort*)ORG_SDLIST)[2]) #endif -char* tokens[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; // Maximum of 8 tokens -char server[80] = { "N:TCP://192.168.1.205:9999/\"\0" }; +char* tokens[8]; // = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; // Maximum of 8 tokens +char server[80] = { "N:TCP://192.168.1.126:5556/\"\0" }; void reset_console(void) { @@ -70,7 +71,7 @@ byte get_tokens(byte* buff, byte endx) } } - // Fix last token. For some strange reason, the last token is ending with 0x80 + // Fix last token. For some strange reason, the last token is ending with 0x80 (ENTER key?) i = strlen(tokens[count-1]); tokens[count-1][i-1] = 0x0; @@ -86,17 +87,6 @@ byte get_tokens(byte* buff, byte endx) return count; } -void fix_chars(char* buff) -{ - byte i; - for(i=0;i 1) { - fix_chars(tokens[1]); + //internal_to_atascii(tokens[1], 40); load_image_file(tokens[1]); } else @@ -196,9 +186,7 @@ void process_command(byte ntokens) else { if(strncmp(tokens[1], "server", 3) == 0) - { strncpy(server, tokens[2], 79); - } } } @@ -264,10 +252,11 @@ void start_console(char first_char) { // process the tokens #define WORKING_BUFF_SIZE 80 - byte buff[80]; // two lines of data + byte buff[WORKING_BUFF_SIZE]; // two lines of data byte ntokens = 0; memcpy(buff, CONSOLE_BUFF, WORKING_BUFF_SIZE); + internal_to_atascii(buff, WORKING_BUFF_SIZE); #ifdef DEBUG_CONSOLE gotoxy(0,1); @@ -312,8 +301,13 @@ void start_console(char first_char) if(ntokens > 0) { + byte i; reset_console(); process_command(ntokens); + + // Clear the tokens for the next command + for(i = 0; i < 7; ++i) + tokens[i] = 0x0; } reset_console(); diff --git a/src/imgload.c b/src/imgload.c index cb544e7..1d0eb33 100644 --- a/src/imgload.c +++ b/src/imgload.c @@ -18,7 +18,7 @@ extern char server[]; // //char version[] = "YAIL (Yet Another Image Loader) v1.2.2"; -const byte version[] = "\x00\x39\x21\x29\x2C\x00\x08\x39\x65\x74\x00\x21\x6E\x6F\x74\x68\x65\x72\x00\x29\x6D\x61\x67\x65\x00\x2C\x6F\x61\x64\x65\x72\x09\x00\x76\x11\x0E\x12\x0E\x16\x00"; +const byte version[] = "\x00\x39\x21\x29\x2C\x00\x08\x39\x65\x74\x00\x21\x6E\x6F\x74\x68\x65\x72\x00\x29\x6D\x61\x67\x65\x00\x2C\x6F\x61\x64\x65\x72\x09\x00\x76\x11\x0E\x12\x0E\x17\x00"; char buff[256]; // A block of memory to be used by all. bool done = false; @@ -39,7 +39,7 @@ void process_command_line(int argc, char* argv[]) help(); break; case 'l': - fix_chars(argv[2]); + internal_to_atascii(argv[2], 40); load_image_file(argv[2]); break; case 'u': diff --git a/src/netimage.c b/src/netimage.c index bedd691..96adf54 100644 --- a/src/netimage.c +++ b/src/netimage.c @@ -42,7 +42,7 @@ void stream_image(char* url, char* args[]) if(FN_ERR_OK != network_init()) { show_console(); - cprintf("Failed to initialize network\n\r"); + cputs("Failed to initialize network\n\r"); network_close(url); return; } @@ -50,18 +50,18 @@ void stream_image(char* url, char* args[]) if(FN_ERR_OK != network_open(url, 12, 0)) { show_console(); - cprintf("Failed to open network\n\r"); + cprintf("Failed to open %s\n\r", url); network_close(url); return; } // Send which graphics mode we are in memset(buff, 0, 256); - sprintf(buff, "gfx %d", CURRENT_MODE &= ~GRAPHICS_CONSOLE_EN); - if(FN_ERR_OK != network_write(url, buff, 5)) + sprintf(buff, "gfx %d ", CURRENT_MODE &= ~GRAPHICS_CONSOLE_EN); + if(FN_ERR_OK != network_write(url, buff, 6)) { show_console(); - cprintf("Unable to write graphics mode\n\r"); + cprintf("Unable to write graphics mode \"%s\"\n\r", buff); network_close(url); return; } @@ -71,7 +71,7 @@ void stream_image(char* url, char* args[]) memcpy(buff, "search \"", 8); for(i = 0; i < 8; ++i) { - if(args[i] == 0x0) + if(0x0 == args[i]) break; if(i > 0) diff --git a/src/utility.c b/src/utility.c index 48046f1..5dde2cd 100644 --- a/src/utility.c +++ b/src/utility.c @@ -19,4 +19,32 @@ void pause(const char* message) break; } } -} \ No newline at end of file +} + +void internal_to_atascii(char* buff, byte len) +{ + byte i; + for(i=0;i typedef struct _MemSeg @@ -32,5 +37,6 @@ void* malloc_constrianed(size_t size, size_t fence); size_t allocSegmentedMemory(size_t block_size, size_t num_blocks, size_t boundary, MemSegs* memsegs); void freeSegmentedMemory(MemSegs* memsegs); void printMemSegs(const MemSegs* memsegs); +#endif #endif \ No newline at end of file