]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1520b3.zip
authorToni Wilen <twilen@winuae.net>
Sun, 24 Aug 2008 10:48:54 +0000 (13:48 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:42:48 +0000 (21:42 +0200)
bsdsocket.c
filesys.c
include/bsdsocket.h
od-win32/bsdsock.c
od-win32/dinput.c
od-win32/sounddep/sound.c
od-win32/win32.h
od-win32/winuaechangelog.txt

index 5a655375238b73877a8a9fd0f314e705fe9f125e..1fba6c213d3d2c7afd91b22772c03895fb2f7b1d 100755 (executable)
@@ -1485,43 +1485,39 @@ static const char * const funcnames[] = {
 
 static uae_u32 sockfuncvecs[sizeof (sockfuncs) / sizeof (*sockfuncs)];
 
+static uae_u32 res_name, res_id, res_init;
+
+uaecptr bsdlib_startup (uaecptr resaddr)
+{
+    if (res_name == 0 || !currprefs.socket_emu)
+       return resaddr;
+    put_word (resaddr + 0x0, 0x4AFC);
+    put_long (resaddr + 0x2, resaddr);
+    put_long (resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
+    put_word (resaddr + 0xA, 0x8004); /* RTF_AUTOINIT, RT_VERSION */
+    put_word (resaddr + 0xC, 0x0970); /* NT_LIBRARY, RT_PRI */
+    put_long (resaddr + 0xE, res_name);
+    put_long (resaddr + 0x12, res_id);
+    put_long (resaddr + 0x16, res_init);
+    resaddr += 0x1A;
+    return resaddr;
+}
+
 void bsdlib_install (void)
 {
-    uae_u32 resname, resid;
-    uae_u32 begin, end;
-    uae_u32 func_place, data_place, init_place;
     int i;
 
     if (!sockdata) {
-       sockdata = (struct sockd*)xcalloc (sizeof (struct sockd), 1);
+       sockdata = xcalloc (sizeof (struct sockd), 1);
        for (i = 0; i < SOCKPOOLSIZE; i++)
            sockdata->sockpoolids[i] = UNIQUE_ID;
     }
 
-    if (!init_socket_layer ()) {
-       write_log ("bsdsocket initialization failed\n");
+    if (!init_socket_layer ())
        return;
-    }
 
-    resname = ds ("bsdsocket.library");
-    resid = ds ("UAE bsdsocket.library 4.1");
-
-    begin = here ();
-    dw (0x4AFC);               /* RT_MATCHWORD */
-    dl (begin);                        /* RT_MATCHTAG */
-    dl (0);                    /* RT_ENDSKIP */
-    dw (0x8004);               /* RTF_AUTOINIT, RT_VERSION */
-    dw (0x0970);               /* NT_LIBRARY, RT_PRI */
-    dl (resname);              /* RT_NAME */
-    dl (resid);                        /* RT_IDSTRING */
-    dl (here () + 4);          /* RT_INIT */
-    dl (512);
-    func_place = here ();
-    dl (0);
-    data_place = here ();
-    dl (0);
-    init_place = here ();
-    dl (0);
+    res_name = ds ("bsdsocket.library");
+    res_id = ds ("UAE bsdsocket.library 4.1");
 
     for (i = 0; i < (int) (sizeof (sockfuncs) / sizeof (sockfuncs[0])); i++) {
        sockfuncvecs[i] = here ();
@@ -1548,7 +1544,7 @@ void bsdlib_install (void)
     dw (0xCE00);               /* -50 */
     dw (0xC000);               /* INITLONG */
     dw (0x000A);               /* LN_NAME */
-    dl (resname);
+    dl (res_name);
     dw (0xE000);               /* INITBYTE */
     dw (0x000E);               /* LIB_FLAGS */
     dw (0x0600);               /* LIBF_SUMUSED | LIBF_CHANGED */
@@ -1560,25 +1556,15 @@ void bsdlib_install (void)
     dw (0x0001);
     dw (0xC000);
     dw (0x0018);               /* LIB_IDSTRING */
-    dl (resid);
+    dl (res_id);
     dl (0x00000000);           /* end of table */
 
-    end = here ();
-
-    org (begin + 6);           /* Load END value */
-    dl (end);
-
-    org (data_place);
-    dl (datatable);
-
-    org (func_place);
+    res_init = here ();
+    dl (512);
     dl (functable);
-
-    org (init_place);
+    dl (datatable);
     dl (*sockfuncvecs);
 
-    org (end);
-
     write_log ("bsdsocked.library installed\n");
 }
 
index 8de94e8fffd2d6b27a0fee0b4c7b2c90fb1cf208..c62e661201abbd71284d102822edcf6d45809bbd 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -47,6 +47,7 @@
 #include "a2091.h"
 #include "cdtv.h"
 #include "sana2.h"
+#include "bsdsocket.h"
 #include "uaeresource.h"
 
 #define TRACING_ENABLED 0
@@ -4816,6 +4817,9 @@ static uae_u32 REGPARAM2 filesys_diagentry (TrapContext *context)
      * diag entry. */
 
     resaddr = uaeres_startup (resaddr);
+#ifdef BSDSOCKET
+    resaddr = bsdlib_startup (resaddr);
+#endif
 #ifdef SCSIEMU
     resaddr = scsidev_startup (resaddr);
 #endif
index e8e1256922859b7690736fee6ef74315299f264e..f02145f65fab266bf7f035c4f3673cbe98056abe 100755 (executable)
@@ -192,5 +192,6 @@ extern uae_u32 host_vsyslog (void);
 extern uae_u32 host_Dup2Socket (void);
 extern uae_u32 host_gethostname (uae_u32, uae_u32);
 
+extern uaecptr bsdlib_startup (uaecptr);
 extern void bsdlib_install (void);
 extern void bsdlib_reset (void);
index 109fd1430a6d69b709a26aa86484c29f746ff79f..71dc017c26f3f81528758fc09b427d2cf6c30c3b 100755 (executable)
@@ -216,6 +216,7 @@ int init_socket_layer (void)
                                        NULL, NULL, 0, NULL);
                                bsd->hSockThread = THREAD(sock_thread, NULL);
                                if (!bsd->hSockWnd) {
+                                   write_log ("bsdsocket initialization failed\n");
                                    deinit_socket_layer();
                                    return 0;
                                }
index f0e29e944c956f725c25328025de7cc0ecf05158..683241100ef053cb9418e65ce1f00f2599ab2292 100755 (executable)
@@ -74,7 +74,7 @@ struct didata {
     int coop;
 
     int axles;
-    int buttons;
+    int buttons, buttons_real;
     int axismappings[MAX_MAPPINGS];
     char *axisname[MAX_MAPPINGS];
     int axissort[MAX_MAPPINGS];
@@ -377,7 +377,7 @@ static int initialize_catweasel(void)
            did->sortname = my_strdup (tmp);
            sprintf (tmp, "CWMOUSE%d", i);
            did->configname = my_strdup (tmp);
-           did->buttons = 3;
+           did->buttons = did->buttons_real = 3;
            did->axles = 2;
            did->axissort[0] = 0;
            did->axisname[0] = my_strdup ("X-Axis");
@@ -404,7 +404,7 @@ static int initialize_catweasel(void)
            did->sortname = my_strdup (tmp);
            sprintf (tmp, "CWJOY%d", i);
            did->configname = my_strdup (tmp);
-           did->buttons = (catweasel_isjoystick() & 0x80) ? 3 : 1;
+           did->buttons = did->buttons_real =(catweasel_isjoystick() & 0x80) ? 3 : 1;
            did->axles = 2;
            did->axissort[0] = 0;
            did->axisname[0] = my_strdup ("X-Axis");
@@ -674,7 +674,7 @@ static int initialize_rawinput (void)
                    write_log ("bogus number of buttons, ignored\n");
                    continue;
                }
-               did->buttons = rdim->dwNumberOfButtons;
+               did->buttons_real = did->buttons = rdim->dwNumberOfButtons;
                for (j = 0; j < did->buttons; j++) {
                    did->buttonsort[j] = j;
                    sprintf (tmp, "Button %d", j + 1);
@@ -761,6 +761,7 @@ static void initialize_windowsmouse (void)
            did->buttons = 3;
        if (did->buttons > 5)
            did->buttons = 5; /* no non-direcinput support for >5 buttons */
+       did->buttons_real = did->buttons;
        for (j = 0; j < did->buttons; j++) {
            did->buttonsort[j] = j;
            sprintf (tmp, "Button %d", j + 1);
@@ -836,10 +837,8 @@ static void handle_rawinput_2 (RAWINPUT *raw)
                }
            }
            if (rm->usButtonFlags & RI_MOUSE_WHEEL) {
-               int val = (int)rm->usButtonData;
-               int bnum = did->buttons - 2;
-               if (did->axles == 3)
-                   bnum -= 2;
+               int val = (short)rm->usButtonData;
+               int bnum = did->buttons_real;
                setmousestate (num, 2, val, 0);
                if (val < 0)
                    setmousebuttonstate (num, bnum + 0, -1);
index 140d09745103ecf3e54d3f176d538c8d2186218c..735711c8aa5759ecba69637a687911965845f7ec 100755 (executable)
@@ -135,19 +135,10 @@ static void clearbuffer_ds (void)
     memset (buffer, 0, size);
     IDirectSoundBuffer_Unlock (lpDSBsecondary, buffer, size, NULL, 0);
 }
-static void clearbuffer_al (void)
-{
-    int i;
-    for (i = 0; i < AL_BUFFERS; i++) {
-       alSourceUnqueueBuffers (al_Source, 1, &al_Buffers[i]);
-    }
-    alGetError ();
-}
+
 static void clearbuffer (void)
 {
-    if (devicetype == SOUND_DEVICE_AL)
-       clearbuffer_al ();
-    else if (devicetype == SOUND_DEVICE_DS)
+    if (devicetype == SOUND_DEVICE_DS)
        clearbuffer_ds ();
 }
 
@@ -174,7 +165,6 @@ static void pause_audio_al (void)
 {
     waiting_for_buffer = 0;
     alSourcePause (al_Source);
-    clearbuffer ();
 }
 static void resume_audio_al (void)
 {
@@ -538,6 +528,7 @@ static int open_audio_ds (int size)
        goto error;
     }
     IDirectSound_Release (pdsb);
+    clearbuffer ();
 
     return 1;
 
@@ -573,7 +564,6 @@ static int open_sound (void)
        return 0;
 
     set_volume (currprefs.sound_volume, mute);
-    clearbuffer ();
     init_sound_table16 ();
     if (get_audio_amigachannels() == 4)
        sample_handler = sample16ss_handler;
@@ -634,7 +624,6 @@ void pause_sound (void)
        pause_audio_al ();
     else if (devicetype == SOUND_DEVICE_DS)
        pause_audio_ds ();
-    clearbuffer ();
 }
 
 void resume_sound (void)
@@ -643,7 +632,6 @@ void resume_sound (void)
        return;
     if (!have_sound)
        return;
-    clearbuffer ();
     if (devicetype == SOUND_DEVICE_AL)
        resume_audio_al ();
     else if (devicetype == SOUND_DEVICE_DS)
@@ -720,6 +708,8 @@ static int alcheck (int v)
        alGetSourcei (al_Source, AL_BUFFERS_QUEUED, &v2);
        alGetSourcei (al_Source, AL_SOURCE_STATE, &v3);
        write_log ("OpenAL %d: error %d. PROC=%d QUEUE=%d STATE=%d\n", v, err, v1, v2, v3);
+       write_log ("           %d %08x %08x %08x %d %d\n",
+           al_toggle, al_Buffers[al_toggle], al_format, al_bigbuffer, al_bufsize, currprefs.sound_freq);
        return 1;
     }
     return 0;
@@ -760,6 +750,10 @@ static void finish_sound_buffer_al (void)
 
         alSourceUnqueueBuffers (al_Source, 1, &al_Buffers[al_toggle]);
        alGetError ();
+
+//     write_log ("           %d %08x %08x %08x %d %d\n",
+//         al_toggle, al_Buffers[al_toggle], al_format, al_bigbuffer, al_bufsize, currprefs.sound_freq);
+
        alBufferData (al_Buffers[al_toggle], al_format, al_bigbuffer, al_bufsize, currprefs.sound_freq);
        alcheck(4);
        alSourceQueueBuffers (al_Source, 1, &al_Buffers[al_toggle]);
@@ -769,6 +763,7 @@ static void finish_sound_buffer_al (void)
            al_toggle = 0;
 
        alGetSourcei (al_Source, AL_BUFFERS_QUEUED, &v2);
+       alcheck(5);
        alGetSourcei (al_Source, AL_SOURCE_STATE, &v);
        alcheck(3);
        if (v != AL_PLAYING && v2 >= AL_BUFFERS) {
@@ -791,8 +786,10 @@ static void finish_sound_buffer_al (void)
     alcheck(1);
 
     alGetSourcei (al_Source, AL_SOURCE_STATE, &v);
+    alcheck(6);
     if (v == AL_PLAYING) {
        alGetSourcei (al_Source, AL_BYTE_OFFSET, &v);
+       alcheck(7);
        v -= al_offset;
        gui_data.sndbuf = 100 * v / sndbufsize;
        m = gui_data.sndbuf / 100.0;
index 3256499f7d9ec84b5d21e9b0cb507077e7643ed6..5e202e32da9e9a54390e8d89a8073796edf7d7af 100755 (executable)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 1
-#define WINUAEPUBLICBETA 2
-#define WINUAEDATE MAKEBD(2008, 8, 23)
+#define WINUAEBETA 3
+#define WINUAEPUBLICBETA 1
+#define WINUAEDATE MAKEBD(2008, 8, 24)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index 5fd8f568f233a419931595da1f733d7e0b977a51..389fa510feb67828e509429c88642e785ed16f12 100755 (executable)
@@ -1,4 +1,12 @@
 
+Beta 3:
+
+- bsdsocket initialization rewritten, should be more reliable now
+  if uae rom is moved and/or other extra residents enabled
+- OpenAL sound mode problems fixed ("I hope")
+- Raw mouse/"name of mouse" mouse wheel support fixed (always been
+  broken)
+
 Beta 2:
 
 - RTG mode and width set to bigger than resolution (autoscroll)