snd: better snd_disable dox

ia32: fix comments and fix EBP warning
wdbg: fix bug if exception locus is unavailable
wdetect: store full DS driver path (-> version reported correctly)

This was SVN commit r2491.
This commit is contained in:
janwas 2005-07-20 00:54:39 +00:00
parent e7946ad774
commit 1d69845cee
5 changed files with 57 additions and 43 deletions

View File

@ -1760,12 +1760,17 @@ static inline int snd_init()
}
// call before first snd_open if all sound is to be disabled.
// this is a quick'n dirty way of speeding up startup during development -
// the caller's sound code need not be touched.
// (temporarily) disable all sound output. because it causes future snd_open
// calls to immediately abort before they demand-initialize OpenAL,
// startup is sped up considerably (500..1000ms). therefore, this must be
// called before the first snd_open to have any effect; otherwise, the
// cat will already be out of the bag and we debug_warn of it.
//
// can call later to reactivate sound; all settings ever set will be applied,
// and subsequent sound load / play requests will work.
// rationale: this is a quick'n dirty way of speeding up startup during
// development without having to change the game's sound code.
//
// can later be called to reactivate sound; all settings ever changed
// will be applied and subsequent sound load / play requests will work.
int snd_disable(bool disabled)
{
snd_disabled = disabled;

View File

@ -201,12 +201,17 @@ extern int snd_set_loop(Handle hs, bool loop);
// sound engine
//
// call before first snd_open if all sound is to be disabled.
// this is a quick'n dirty way of speeding up startup during development -
// the caller's sound code need not be touched.
// (temporarily) disable all sound output. because it causes future snd_open
// calls to immediately abort before they demand-initialize OpenAL,
// startup is sped up considerably (500..1000ms). therefore, this must be
// called before the first snd_open to have any effect; otherwise, the
// cat will already be out of the bag and we debug_warn of it.
//
// can call later to reactivate sound; all settings ever set will be applied,
// and subsequent sound load / play requests will work.
// rationale: this is a quick'n dirty way of speeding up startup during
// development without having to change the game's sound code.
//
// can later be called to reactivate sound; all settings ever changed
// will be applied and subsequent sound load / play requests will work.
extern int snd_disable(bool disabled);
// perform housekeeping (e.g. streaming); call once a frame.

View File

@ -170,19 +170,19 @@ static void cpuid()
{
__asm
{
pushad ; save ebx, esi, edi, ebp
; ICC7: pusha is the 16-bit form!
pushad ;// save ebx, esi, edi, ebp
;// ICC7: pusha is the 16-bit form!
; make sure CPUID is supported
;// make sure CPUID is supported
pushfd
or byte ptr [esp+2], 32
popfd
pushfd
pop eax
shr eax, 22 ; bit 21 toggled?
shr eax, 22 ;// bit 21 toggled?
jnc no_cpuid
; get vendor string
;// get vendor string
xor eax, eax
cpuid
mov edi, offset vendor_str
@ -192,9 +192,9 @@ __asm
stosd
xchg eax, ecx
stosd
; (already 0 terminated)
;// (already 0 terminated)
; get CPU signature and std feature bits
;// get CPU signature and std feature bits
push 1
pop eax
cpuid
@ -202,30 +202,30 @@ __asm
mov [caps+4], edx
movzx edx, al
shr edx, 4
mov [model], edx ; eax[7:4]
mov [model], edx ;// eax[7:4]
movzx edx, ah
and edx, 0x0f
mov [family], edx ; eax[11:8]
mov [family], edx ;// eax[11:8]
shr eax, 20
and eax, 0x0f
mov [ext_family], eax ; eax[23:20]
mov [ext_family], eax ;// eax[23:20]
; make sure CPUID ext functions are supported
;// make sure CPUID ext functions are supported
mov esi, 0x80000000
mov eax, esi
cpuid
mov [max_ext_func], eax
cmp eax, esi ; max ext <= 0x80000000?
jbe no_ext_funcs ; yes - no ext funcs at all
lea esi, [esi+4] ; esi = 0x80000004
cmp eax, esi ; max ext < 0x80000004?
jb no_brand_str ; yes - brand string not available, skip
cmp eax, esi ;// max ext <= 0x80000000?
jbe no_ext_funcs ;// yes - no ext funcs at all
lea esi, [esi+4] ;// esi = 0x80000004
cmp eax, esi ;// max ext < 0x80000004?
jb no_brand_str ;// yes - brand string not available, skip
; get CPU brand string (>= Athlon XP, P4)
;// get CPU brand string (>= Athlon XP, P4)
mov edi, offset cpu_type
push -2
pop ebp ; loop counter: [-2, 0]
$1: lea eax, [ebp+esi] ; 0x80000002 .. 4
pop esi ;// loop counter: [-2, 0]
$1: lea eax, [0x80000004+esi] ;// 0x80000002 .. 4
cpuid
stosd
xchg eax, ebx
@ -234,16 +234,16 @@ $1: lea eax, [ebp+esi] ; 0x80000002 .. 4
stosd
xchg eax, edx
stosd
inc ebp
inc esi
jle $1
; (already 0 terminated)
;// (already 0 terminated)
mov [have_brand_string], ebp ; ebp = 1 = true
mov [have_brand_string], esi ;// esi = 1 = true
no_brand_str:
; get extended feature flags
lea eax, [esi-3] ; 0x80000001
;// get extended feature flags
mov eax, [0x80000001]
cpuid
mov [caps+8], ecx
mov [caps+12], edx

View File

@ -1022,11 +1022,11 @@ LONG WINAPI wdbg_exception_filter(EXCEPTION_POINTERS* ep)
const wchar_t* description = get_exception_description(ep);
const wchar_t* locus = get_exception_locus (ep);
wchar_t func_name[DBG_SYMBOL_LEN]; char file[DBG_FILE_LEN] = {0}; int line = 0; wchar_t fmt[50];
wchar_t fmt[50]; wchar_t func_name[DBG_SYMBOL_LEN] = L"?"; char file[DBG_FILE_LEN] = "?"; int line = 0;
swprintf(fmt, ARRAY_SIZE(fmt), L"%%%ds (%%%dh[^:]:%%d)", DBG_SYMBOL_LEN, DBG_FILE_LEN);
// bake in the string limits (future-proof)
if(swscanf(locus, fmt, func_name, file, &line) != 3)
debug_warn("error extracting file/line from exception locus");
(void)swscanf(locus, fmt, func_name, file, &line);
// don't care if all 3 fields were filled (they default to "?")
wchar_t buf[500];
const wchar_t* msg_fmt =

View File

@ -207,10 +207,12 @@ static int dll_list_add(const char* name)
// some driver names are stored in the registry without .dll extension.
// if necessary, copy to new buffer and add it there.
// note: do not change extension if present; some drivers have a
// ".sys" extension, so always appending ".dll" is incorrect.
char buf[MAX_PATH];
const char* dll_name = name;
const char* ext = strrchr(name, '.');
if(!ext || stricmp(ext, ".dll") != 0)
if(!ext)
{
snprintf(buf, ARRAY_SIZE(buf), "%s.dll", name);
dll_name = buf;
@ -437,9 +439,9 @@ static void add_oal_dlls_in_dir(const char* dir, DllSet* dlls)
}
// DS3D driver name; filled by ds_enum, used by win_get_snd_info.
// DS3D driver path; filled by ds_enum, used by win_get_snd_info.
// side effect: remains zeroed if there's no sound card installed.
static char ds_drv_name[MAX_PATH+1];
static char ds_drv_path[MAX_PATH+1];
// store sound card name and path to DirectSound driver.
// called for each DirectSound driver, but aborts after first valid driver.
@ -453,7 +455,9 @@ static BOOL CALLBACK ds_enum(void* guid, const char* description, const char* mo
return TRUE; // continue calling
strcpy_s(snd_card, SND_CARD_LEN, description);
strcpy_s(ds_drv_name, ARRAY_SIZE(ds_drv_name), module);
snprintf(ds_drv_path, ARRAY_SIZE(ds_drv_path), "%s\\drivers\\%s", win_sys_dir, module);
// note: this directory is not in LoadLibrary's search list,
// so we have to give the full pathname.
// we assume the first "driver name" (sound card) is the one we want;
// stick with that and stop calling.
@ -469,7 +473,7 @@ int win_get_snd_info()
// there are apparently no sound card/drivers installed; so indicate.
// (the code below would fail and not produce reasonable output)
if(ds_drv_name[0] == '\0')
if(ds_drv_path[0] == '\0')
{
strcpy_s(snd_card, SND_CARD_LEN, "(none)");
strcpy_s(snd_drv_ver, SND_DRV_VER_LEN, "(none)");
@ -479,7 +483,7 @@ int win_get_snd_info()
// find all DLLs related to OpenAL, retrieve their versions,
// and store in snd_drv_ver string.
dll_list_init(snd_drv_ver, SND_DRV_VER_LEN);
dll_list_add(ds_drv_name);
dll_list_add(ds_drv_path);
std::set<std::string> dlls; // ensures uniqueness
add_oal_dlls_in_dir(win_exe_dir, &dlls);
add_oal_dlls_in_dir(win_sys_dir, &dlls);