From 1081338af253d128e85303bc6066eeb01b962d99 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 26 Jun 2019 22:13:12 +0200 Subject: [PATCH] - removed a few obsolete definitions from basictypes.h --- src/basictypes.h | 16 ---------------- src/s_sound.cpp | 10 +++++----- src/sound/i_soundinternal.h | 2 +- src/sound/oalsound.cpp | 14 +++++++------- src/win32/i_specialpaths.cpp | 34 ++++++---------------------------- 5 files changed, 19 insertions(+), 57 deletions(-) diff --git a/src/basictypes.h b/src/basictypes.h index fed81fa1c..5a57aa9c9 100644 --- a/src/basictypes.h +++ b/src/basictypes.h @@ -17,19 +17,6 @@ typedef struct _GUID } GUID; #endif -union QWORD_UNION -{ - uint64_t AsOne; - struct - { -#ifdef __BIG_ENDIAN__ - unsigned int Hi, Lo; -#else - unsigned int Lo, Hi; -#endif - }; -}; - // // fixed point, 32bit as 16.16. // @@ -41,9 +28,6 @@ typedef int32_t fixed_t; #define FIXED_MAX (signed)(0x7fffffff) #define FIXED_MIN (signed)(0x80000000) -#define DWORD_MIN ((uint32_t)0) -#define DWORD_MAX ((uint32_t)0xffffffff) - // the last remnants of tables.h #define ANGLE_90 (0x40000000) #define ANGLE_180 (0x80000000) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 762b1db07..f114e1035 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -2084,7 +2084,7 @@ void S_EvictAllChannels() { if (!(chan->ChanFlags & CHAN_ABSTIME)) { - chan->StartTime.AsOne = GSnd ? GSnd->GetPosition(chan) : 0; + chan->StartTime = GSnd ? GSnd->GetPosition(chan) : 0; chan->ChanFlags |= CHAN_ABSTIME; } S_StopChannel(chan); @@ -2414,7 +2414,7 @@ static FSerializer &Serialize(FSerializer &arc, const char *key, FSoundChan &cha ("entchannel", chan.EntChannel) ("priority", chan.Priority) ("nearlimit", chan.NearLimit) - ("starttime", chan.StartTime.AsOne) + ("starttime", chan.StartTime) ("rolloftype", chan.Rolloff.RolloffType) ("rolloffmin", chan.Rolloff.MinDistance) ("rolloffmax", chan.Rolloff.MaxDistance) @@ -2468,10 +2468,10 @@ void S_SerializeSounds(FSerializer &arc) for (unsigned int i = chans.Size(); i-- != 0; ) { // Replace start time with sample position. - uint64_t start = chans[i]->StartTime.AsOne; - chans[i]->StartTime.AsOne = GSnd ? GSnd->GetPosition(chans[i]) : 0; + uint64_t start = chans[i]->StartTime; + chans[i]->StartTime = GSnd ? GSnd->GetPosition(chans[i]) : 0; arc(nullptr, *chans[i]); - chans[i]->StartTime.AsOne = start; + chans[i]->StartTime = start; } arc.EndArray(); } diff --git a/src/sound/i_soundinternal.h b/src/sound/i_soundinternal.h index a0661baf0..6c926b431 100644 --- a/src/sound/i_soundinternal.h +++ b/src/sound/i_soundinternal.h @@ -101,7 +101,7 @@ struct SoundHandle struct FISoundChannel { void *SysChannel; // Channel information from the system interface. - QWORD_UNION StartTime; // Sound start time in DSP clocks. + uint64_t StartTime; // Sound start time in DSP clocks. // The sound interface doesn't use these directly but it needs to pass them to a // callback that can't be passed a sound channel pointer diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 2d23faceb..7369020e0 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -1602,17 +1602,17 @@ FISoundChannel *OpenALSoundRenderer::StartSound(SoundHandle sfx, float vol, int else alSourcef(source, AL_PITCH, PITCH(pitch)); - if(!reuse_chan || reuse_chan->StartTime.AsOne == 0) + if(!reuse_chan || reuse_chan->StartTime == 0) alSourcef(source, AL_SEC_OFFSET, 0.f); else { if((chanflags&SNDF_ABSTIME)) - alSourcei(source, AL_SAMPLE_OFFSET, reuse_chan->StartTime.Lo); + alSourcei(source, AL_SAMPLE_OFFSET, ALint(reuse_chan->StartTime)); else { float offset = std::chrono::duration_cast>( std::chrono::steady_clock::now().time_since_epoch() - - std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime.AsOne) + std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime) ).count(); if(offset > 0.f) alSourcef(source, AL_SEC_OFFSET, offset); } @@ -1813,17 +1813,17 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener else alSourcef(source, AL_PITCH, PITCH(pitch)); - if(!reuse_chan || reuse_chan->StartTime.AsOne == 0) + if(!reuse_chan || reuse_chan->StartTime == 0) alSourcef(source, AL_SEC_OFFSET, 0.f); else { if((chanflags&SNDF_ABSTIME)) - alSourcei(source, AL_SAMPLE_OFFSET, reuse_chan->StartTime.Lo); + alSourcei(source, AL_SAMPLE_OFFSET, ALint(reuse_chan->StartTime)); else { float offset = std::chrono::duration_cast>( std::chrono::steady_clock::now().time_since_epoch() - - std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime.AsOne) + std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime) ).count(); if(offset > 0.f) alSourcef(source, AL_SEC_OFFSET, offset); } @@ -2220,7 +2220,7 @@ void OpenALSoundRenderer::MarkStartTime(FISoundChannel *chan) { // FIXME: Get current time (preferably from the audio clock, but the system // time will have to do) - chan->StartTime.AsOne = std::chrono::steady_clock::now().time_since_epoch().count(); + chan->StartTime = std::chrono::steady_clock::now().time_since_epoch().count(); } float OpenALSoundRenderer::GetAudibility(FISoundChannel *chan) diff --git a/src/win32/i_specialpaths.cpp b/src/win32/i_specialpaths.cpp index 00631645c..dcc1ab6d9 100644 --- a/src/win32/i_specialpaths.cpp +++ b/src/win32/i_specialpaths.cpp @@ -101,36 +101,14 @@ bool UseKnownFolders() bool GetKnownFolder(int shell_folder, REFKNOWNFOLDERID known_folder, bool create, FString &path) { - // SHGetKnownFolderPath knows about more folders than SHGetFolderPath, but is - // new to Vista, hence the reason we support both. - if (!SHGetKnownFolderPath) + PWSTR wpath; + if (FAILED(SHGetKnownFolderPath(known_folder, create ? KF_FLAG_CREATE : 0, NULL, &wpath))) { - if (shell_folder < 0) - { // Not supported by SHGetFolderPath - return false; - } - if (create) - { - shell_folder |= CSIDL_FLAG_CREATE; - } - if (FAILED(SHGetFolderPathW(NULL, shell_folder, NULL, 0, pathstr))) - { - return false; - } - path = pathstr; - return true; - } - else - { - PWSTR wpath; - if (FAILED(SHGetKnownFolderPath(known_folder, create ? KF_FLAG_CREATE : 0, NULL, &wpath))) - { - return false; - } - path = wpath; - CoTaskMemFree(wpath); - return true; + return false; } + path = wpath; + CoTaskMemFree(wpath); + return true; } //===========================================================================