Mighty Max
Members+-
Posts
23 -
Joined
-
Last visited
Mighty Max's Achievements
Newbie (1/14)
0
Reputation
-
As the end user, you don't have to care about this lib. It is build in to the projects that take advantage of it by the developer.
-
I've been a soldier myself. And in the last days i've thought about if i would be able to commit suicide in order vanish the reason for war. I came to the conclusion that the war didn't start because of the soldiers. It has no sense at all to try and free them that way. It's named because it is a excuse. Indeed. I'm living and learning with several muslims in a small german city, visiting the local university. It's not only a get along, it's a friendship. Alltho if you get told - on both sides of the conflict - from the child-age on that the neighbours are bad, you don't rethink about the reason why you don't like your neighbours when you are old enought to do so.
-
Libanon is member of the UN since 1945. Israel since 1949. In the UN charta it clearly states: If it is any time, then for the other UN states to take actions against these two members. Unfortunally i'm thinking it is too late to have any effect. As a post somewhere above shows, the ppl have allready build up a deep hate, where the actual reason for this conflict doesn't matter anymore and both only claim that the last action they took is only an response to the opponents action. I may a pessimist here, but the last strikes are only a outview on what is to expect: A war that leaves (at least) two totally destructed and from the rest of the world abandoned countries in the long term.
-
I have noe stripped everything off, and just did the network code to accept an incoming connection. #include <nds.h> #include <malloc.h> #include <string.h> #include <nds/arm9/console.h> //basic print funcionality #include <stdio.h> extern "C" { #include <dswifi9.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <errno.h> void *sgIP_malloc(int size) { return malloc(size); } void sgIP_free(void * ptr) { free(ptr); } // sgIP_dbgprint only needed in debug version void sgIP_dbgprint(char * txt, ...) { } }; // wifi timer function, to update internals of sgIP void Timer_50ms(void) { Wifi_Timer(50); } // notification function to send fifo message to arm7 void arm9_synctoarm7() { // send fifo message REG_IPC_FIFO_TX=0x87654321; } // interrupt handler to receive fifo messages from arm7 void arm9_fifo() { // check incoming fifo messages u32 value = REG_IPC_FIFO_RX; if(value == 0x87654321) Wifi_Sync(); } void InitNetwork(void) { REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; u32 Wifi_pass = Wifi_Init(WIFIINIT_OPTION_USELED); REG_IPC_FIFO_TX=0x12345678; REG_IPC_FIFO_TX=Wifi_pass; TIMER0_CR = 0; irqSet(IRQ_TIMER0, Timer_50ms); irqEnable(IRQ_TIMER0); irqSet(IRQ_FIFO_NOT_EMPTY, arm9_fifo); irqEnable(IRQ_FIFO_NOT_EMPTY); REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ; Wifi_SetSyncHandler(arm9_synctoarm7); TIMER0_DATA = -6553; // 6553.1 * 256 cycles = ~50ms; TIMER0_CR = 0x00C2; // enable, irq, 1/256 clock }; int main(void) { WAIT_CR = 0xE800; powerON(POWER_ALL_2D); powerOFF(POWER_SWAP_LCDS); irqInit(); irqEnable(IRQ_VBLANK); //enable vram and map it to the right places vramSetMainBanks( VRAM_A_MAIN_BG_0x6000000, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD ); //set the video mode videoSetMode( MODE_0_2D | DISPLAY_BG0_ACTIVE //turn on background 0 ); // black backdrop BG_PALETTE[0]=RGB15(0,0,0); BG0_CR = BG_MAP_BASE(31);//use bg0 for the text BG_PALETTE[255] = RGB15(31,31,31);//by default font rendered with color 255 //consoleInit() is a lot more flexible but this gets you up and running quick consoleInitDefault((u16*)SCREEN_BASE_BLOCK(31), (u16*)CHAR_BASE_BLOCK(0), 16); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); iprintf("Starting Wifi\n"); InitNetwork(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); Wifi_EnableWifi(); Wifi_ScanMode(); iprintf("Searching default AP\n"); // wait for "default" AP to show up in the known AP list bool connect=false; while (!connect) { int APs = Wifi_GetNumAP(); int i; iprintf("\x1b[2;0HAPs:\n"); for (i=0;i<APs;i++) { Wifi_AccessPoint wap; Wifi_GetAPData(i,&wap); iprintf(wap.ssid); iprintf(" -\n"); if (strcmp(wap.ssid,"default")==0) { // we are on local lan, only one net available no routin // we dont need no gateway & snm then therefor Wifi_SetIP(0x0A00000A,0,0,0,0); Wifi_ConnectAP(&wap,0,0,0); connect = true; }; }; }; iprintf("connecting to AP ... "); while (Wifi_AssocStatus()!=ASSOCSTATUS_ASSOCIATED) { }; iprintf("associated\n"); Wifi_SetIP(0x0A00000A,0,0,0,0); int listensock = 0; listensock = socket(AF_INET,SOCK_STREAM,0); sockaddr_in sa; sa.sin_family = AF_INET; sa.sin_addr.s_addr = 0; // any sa.sin_port = htons (8668); sa.sin_zero[0] = 0; sa.sin_zero[1] = 0; sa.sin_zero[2] = 0; sa.sin_zero[3] = 0; sa.sin_zero[4] = 0; sa.sin_zero[5] = 0; sa.sin_zero[6] = 0; sa.sin_zero[7] = 0; int blockmode = 1; ioctl(listensock,FIONBIO,&blockmode); if (bind(listensock,(sockaddr *)&sa,sizeof(sa))) { // bind failed iprintf("bind failed\n"); }; if (listen(listensock,1)) { // bind failed iprintf("listen failed\n"); }; sa.sin_family = 0; sa.sin_addr.s_addr = 0; sa.sin_port = 0; sa.sin_zero[0] = 0; sa.sin_zero[1] = 0; sa.sin_zero[2] = 0; sa.sin_zero[3] = 0; sa.sin_zero[4] = 0; sa.sin_zero[5] = 0; sa.sin_zero[6] = 0; sa.sin_zero[7] = 0; int dummy = sizeof(sa); int newsock; iprintf("checking for incomin connections\n"); while (1) { errno = 0; int newsock = accept(listensock,(sockaddr *)&sa,&dummy); if(newsock>0) break; if(errno!=EWOULDBLOCK) { // handle a more "fatal" error iprintf("[FATAL]\n"); }; }; iprintf("Success!\n"); while (1); } The arm7 code is the same as in wifi_example1. No positive result either. A telnet to 10.0.0.10 port 8668 here (IP: 0x0A00000A) cant connect. The PC has ip 10.0.0.16, and is associated in to the same AP.
-
I know i can do other things in this loop too, but not return to the calling function which i need to. It is a timer based in the gui. staying in there means the gui stopping to respond to other events. And i do so. The calls are allready embedded in a big loop, that handles drawing of the gui & sending events to the seperate handler. One of them is the timer which does the above. Problem is it just never notice any incoming connection. It's not that i see a EWOULDBLOCK and stop asking, but there never returns anything else on continously accept() calls.
-
The socket is kept open between the accept tries. Only on leaving the menu the socket is shut down. The routine displays the "11" as errno in the corresponding menu elements each run through. I have just checked that this socket isn't reinitialized. It's only created once. I need the accept be non-blocking tho, as i allow the server to edit the gamesettings while waiting for the connections. Ok select() would be the next choice here and i'll try if that solves my problems. :edit: After setting listensock to blocking mode and using select() before using accept() gets me nowhere either. select() does not signal an incoming connection. If i just call accept() in blocking mode, it just never returns.
-
I don't know if this is the official way, but i did it that way: - download & make the libs - copy the libwifi* to your libnds lib folder - copy the content of the includes folder into the libnds include folder - edit your makefiles, add -ldswifi9/7 to the LIBS var in your makefile
-
Heya, i must be doing something wrong, and i can't seem to find my error. I hope someone might help me here Set up: I am using Devkit R18 still. DsWifi Libs are build from CVS i last updated at 18:00 today. The NDS got the ip 10.0.0.17, the gateway 10.0.0.2 and the SNM 255.0.0.0 The WiFi lib works great when i connect to a remote (pushing some data to a PHP script) but the incoming connection from my PC via telnet does not work, it times out & no accept() call succeeds. The code to check for a connection is periodical called (500ms) and only returns error 11 (try again later) The code: if (listensock==0) { listensock = socket(AF_INET,SOCK_STREAM,0); sockaddr_in sa; sa.sin_family = AF_INET; sa.sin_addr.s_addr = 0; // any sa.sin_port = htons (8668); sa.sin_zero[0] = 0; sa.sin_zero[1] = 0; sa.sin_zero[2] = 0; sa.sin_zero[3] = 0; sa.sin_zero[4] = 0; sa.sin_zero[5] = 0; sa.sin_zero[6] = 0; sa.sin_zero[7] = 0; int blockmode = 1; ioctl(listensock,FIONBIO,&blockmode); if (bind(listensock,(sockaddr *)&sa,sizeof(sa))) { createLayer[2]->GetElementByName("clientlist")->AddTextToList("bind failed",0); }; listen(listensock,1); }; if (listensock) { sockaddr_in sa; sa.sin_family = 0; sa.sin_addr.s_addr = 0; sa.sin_port = 0; sa.sin_zero[0] = 0; sa.sin_zero[1] = 0; sa.sin_zero[2] = 0; sa.sin_zero[3] = 0; sa.sin_zero[4] = 0; sa.sin_zero[5] = 0; sa.sin_zero[6] = 0; sa.sin_zero[7] = 0; int dummy = sizeof(sa); errno = 0; int clientSock = accept(listensock,(sockaddr *)&sa,&dummy); if ((accept>0) && (errno==0)){ createLayer[2]->GetElementByName("clientlist")->AddTextToList("[Slot Taken]",0); } else { // allways returns 11, not accepting any incoming connection char errtext[6]; sprintf(errtext,"%d",errno); createLayer[0]->GetElementByName("maplist")->AddTextToList(errtext,0); }; }; The telnet output (german) C:\WINDOWS\system32>telnet 10.0.0.17 8668 Verbindungsaufbau zu 10.0.0.17...Es konnte keine Verbindung mit dem Host hergest ellt werden, auf Port 8668: Verbinden fehlgeschlagen Which just means: Could not create connection to host on port 8668 Anyone got any suggestions? Or sees my error?
-
This should be resolved if you just swap the positions on your list, or?
-
Hmm? Midi 1.0-HW Datarate is 31.25kBits/sec. Even if the lib would be extreme timewasting and reducing the wifi speed 50x, there should still be enough place to stream your midi data.
-
Chism FAT drvier and Dualis r19.1 & 20
Mighty Max replied to alekmaul's topic in DS Emulators [/pc/ds]
As you mentioned on IRC that you can't tell if it isn't some sideeffekt through the interlacing read&writes etc... i updated my sources to read the whole.lst in one buffer and manually go through the lines. That works just fine on Dualis. Proof: All images loaded -
Chism FAT drvier and Dualis r19.1 & 20
Mighty Max replied to alekmaul's topic in DS Emulators [/pc/ds]
I got another error with Chishm's Fat driver on dualis. (Its related to the crash i told you on IRC, mic) I added a log-write to what bitmaps i am reading, and the result was not what i expected on dualis. (I added HW and dualis results at the end) // all images LPORDEREDLIST bitmaps = 0; void LoadImages(void) { #define LOGME FAT_FILE *lst = FAT_fopen("bmp.lst","r"); #ifdef LOGME FAT_FILE *log = FAT_fopen("bmp.log","w+"); #endif if (lst==0) return; bitmaps = new ORDEREDLIST(); char *line = new char[100]; while (!FAT_feof(lst)) { FAT_fgets(&line[0],100,lst); #ifdef LOGME FAT_fputs("Read line:",log); FAT_fputs(line,log); FAT_fputs("\n",log); #endif int id,flag,r,g,b; char bmpname[100]; if ((line[0]>32) && (line[0]!='#')) { sscanf(&line[0],"%d %s %d %d %d %d",&id,&bmpname[0],&flag,&r,&g,&b); LPBITMAP tmp = new BITMAP(bmpname); if (flag & 1) tmp->ApplyKeycolor(RGB15(r >> 3,g >> 3,b >> 3)); bitmaps->AddEntry(id,tmp); #ifdef LOGME FAT_fputs("Bitmap load\n",log); } else { FAT_fputs("It's a comment\n",log); #endif }; }; delete line; FAT_fclose(lst); FAT_fclose(log); }; That results in this log.txt on dualis: http://mightymax.org/Dualis_BMP.log and on hardware: http://mightymax.org/HW_BMP.log The original bmp.lst file both tests used is http://mightymax.org/bmp.lst -
Just wanted to let you know, that i found the problem, and it was not the fault of the lib. It just increased the chance that this error fatals due to the timing of the irq's. Turned out that running recursively through the sorted trees would take up more stack then beeing available. That was no problem as long no IRQ happened, but when it did, part of this too big stack was overwritten (IRQ stack is just blow SVC stack) so the parameters passed to new/malloc were not the correct ones, therefor it failed. *trying to look innocent* Mighty Max
-
Heya, i got a lil' wish SgStair, I got a structure, that excessive calls new & delete in my main program. This works fine. However as soon as I initialize the ARM9 side of the Wifi lib, These calls fail once of about 300 cycles. I have put in a memory monitor and noticed that as soon I activate Wifi, the allocated bytes alternate between two values (x and x+8 ), so i assume that you are freeing and allocating 8Bytes regulary, while the DS isnt receiving/sending anything. (Wifi_EnableWifi() wasn't called) As this isnt much, could you change that behaviour to have these 8 Bytes allocated the whole time, so that there is less chance that the irq'd malloc/new interfere with allocs in the main()? You can test that behaviour yourself. http://mightymax.org/unnamed_strat.html is loosing its units occasionally when this error occures (It cant add the unit back to the sorted tree). Commenting out the call to InitNetwork (see below) fixes this issue. void InitNetwork(void) { REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; u32 Wifi_pass = Wifi_Init(WIFIINIT_OPTION_USELED); REG_IPC_FIFO_TX=0x12345678; REG_IPC_FIFO_TX=Wifi_pass; TIMER0_CR = 0; irqSet(IRQ_TIMER0, Timer_50ms); irqEnable(IRQ_TIMER0); irqSet(IRQ_FIFO_NOT_EMPTY, arm9_fifo); irqEnable(IRQ_FIFO_NOT_EMPTY); REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ; Wifi_SetSyncHandler(arm9_synctoarm7); TIMER0_DATA = -6553; // 6553.1 * 256 cycles = ~50ms; TIMER0_CR = 0x00C2; // enable, irq, 1/256 clock };
-
Chism FAT drvier and Dualis r19.1 & 20
Mighty Max replied to alekmaul's topic in DS Emulators [/pc/ds]
The latest release seems to have the seek problem fixed. Looks like it was the faulty div.