From: Toni Wilen Date: Sun, 24 Aug 2008 10:48:54 +0000 (+0300) Subject: imported winuaesrc1520b3.zip X-Git-Tag: 2100~123 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=7c88404f177c5e4b7bf94ed61ec695c1ec44a780;p=francis%2Fwinuae.git imported winuaesrc1520b3.zip --- diff --git a/bsdsocket.c b/bsdsocket.c index 5a655375..1fba6c21 100755 --- a/bsdsocket.c +++ b/bsdsocket.c @@ -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"); } diff --git a/filesys.c b/filesys.c index 8de94e8f..c62e6612 100755 --- 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 diff --git a/include/bsdsocket.h b/include/bsdsocket.h index e8e12569..f02145f6 100755 --- a/include/bsdsocket.h +++ b/include/bsdsocket.h @@ -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); diff --git a/od-win32/bsdsock.c b/od-win32/bsdsock.c index 109fd143..71dc017c 100755 --- a/od-win32/bsdsock.c +++ b/od-win32/bsdsock.c @@ -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; } diff --git a/od-win32/dinput.c b/od-win32/dinput.c index f0e29e94..68324110 100755 --- a/od-win32/dinput.c +++ b/od-win32/dinput.c @@ -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); diff --git a/od-win32/sounddep/sound.c b/od-win32/sounddep/sound.c index 140d0974..735711c8 100755 --- a/od-win32/sounddep/sound.c +++ b/od-win32/sounddep/sound.c @@ -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; diff --git a/od-win32/win32.h b/od-win32/win32.h index 3256499f..5e202e32 100755 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -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 "" diff --git a/od-win32/winuaechangelog.txt b/od-win32/winuaechangelog.txt index 5fd8f568..389fa510 100755 --- a/od-win32/winuaechangelog.txt +++ b/od-win32/winuaechangelog.txt @@ -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)