0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
Commit Graph

297 Commits

Author SHA1 Message Date
jp9000
8134b8afda libobs/util: Fix bug with get_winver
get_winver is supposed to return a 16bit value in a format equivalent to
0xMMmm (Major minor).  It was returning 0xMM00mm incorrectly instead.
2019-02-07 17:00:46 -08:00
jp9000
e6c719a1dd libobs/util: Fix bug with circlebuf_data
If the index specified is equal to the size of the data, return NULL.
2019-02-07 17:00:46 -08:00
jp9000
2e1a19456a libobs/util: Add get_win_ver_int() func (windows)
Returns the current version number of windows.  The lowest byte is the
minor version number, then the next lowest byte is the major version
number.  E.g. 0x601 for Windows 7, 0x602 for Windows 8, 0x603 for
Windows 8.1, and 0xA00 for Windows 10.
2019-02-07 17:00:46 -08:00
Dmitry-Me
8df42cda8a libobs: Fix scanf type specifiers 2019-02-04 16:02:49 +03:00
jp9000
8f106dc3c1 libobs, UI: Do not log redundant warnings
Reduces log file clutter by not logging certain warning messages that
were already safe/normal/expected failures.
2019-01-12 16:50:55 -08:00
Jim
1e6bfa2eb1
Merge pull request #1572 from craftwar/utf8-fix
libobs: Fix utf-8 bom is not properly skipped
2019-01-04 14:55:57 -08:00
Exeldro
a0a0ca73c1 libobs: Fix circlebuf_pop_back returning front 2018-12-27 09:28:49 +01:00
craftwar
0a6dc398b7 libobs: Fix utf-8 bom is not properly skipped 2018-12-10 07:57:32 +08:00
jp9000
8cb80e1394 libobs/util: Make default val INVALID_HANDLE_VALUE
Certain windows functions may allow 0 as a valid handle value, therefore
INVALID_HANDLE_VALUE is a more appropriate initialization value.

Closes obsproject/obs-studio#1519
2018-12-03 04:32:20 -08:00
Luke Yelavich
5fe5027630 libobs: Truncate thread names on Linux
The pthread_setname_np manpage states:

The thread name is a meaningful C language string, whose length is
restricted to 16 characters, including the terminating null byte ('\0').
2018-09-21 08:44:30 +10:00
Marvin Scholz
31f143e449 libobs: Add CFString utils 2018-09-16 22:41:01 +02:00
jp9000
e8eec22d15 libobs/util: Fix undefined behavior and optimize util_mul64_64
Shifting an integer larger than its bit width can have undefined
behavior.  This not only fixes that issue, but also optimizes the
shift functions.
2018-09-07 17:28:15 -07:00
jp9000
1aeb87ac52 libobs/util: Don't use assert for darray_push_back_array
Instead, just check to see whether array and num are valid, and if they
are not, safely return.
2018-07-18 18:47:44 -07:00
Alex Anderson
7ce217bbc0 libobs: prevent crash from unbounded copy and bfree
Restricts the range of the copy to count number of characters.
Changes function to strip wrapping quotes as intended.
2018-06-19 00:13:55 -07:00
Richard Stanway
834ebbd2d4
libobs: Avoid busy cursor when starting processes
Windows 10 shows a busy cursor when a process is created, this is not
useful for our background processes which have no UI.
2018-05-30 17:25:33 +02:00
jp9000
8fdfdd9dd2 libobs/util: Fix blank config file values being ignored
If a config file value is set to a blank value, the value would not be
set and the default value would be used.  This fixes a bug where the
user would try to remove the replay buffer prefix, only to have the
prefix be added again next time they start the program.
2018-02-27 01:52:25 -08:00
JetMeta
18c1f10488 libobs/util: Cache windows CPU frequency
Caches the frequency of the performance counter.  It was supposed to be
caching it already, but it seems that code was unintentionally not
included.

Closes jp9000/obs-studio#1185
2018-02-19 22:11:55 -08:00
jp9000
b56c33a260 libobs/util: Add THREAD_LOCAL macro
Adds a thread local storage macro to declare thread local storage
independent of platform.
2018-01-03 17:04:02 -08:00
jp9000
9f9cd1fec3 libobs/util: Ignore PRINTFATTR if using SWIG preprocessor
SWIG will fail because it doesn't define _MSC_VER and because it doesn't
know what to do with things like __attribute__.
2018-01-03 17:03:05 -08:00
jp9000
97ec7166b7 libobs/util: Optimize strlist_* functions
When splitting a string in to a string list via stringlist_split, it
would previously allocate memory for each sub-string and again for the
list itself.  This optimizes that function to use a single contiguous
chunk of memory for the sake of access optimization and memory
allocation efficiency.
2018-01-03 17:03:05 -08:00
Richard Stanway
2f577c1b71
libobs: Make get_reg_dword handle missing keys
Previously if the key didn't exist it would return uninitialized stack
memory. Reported at https://obsproject.com/forum/threads/obs-freezes-computer-on-startup-sometimes.78030/#post-330590
2017-12-19 12:04:00 +01:00
jp9000
0497095f97 Fix a number of GCC warnings 2017-12-06 16:42:45 -08:00
jp9000
5d9854ea44 libobs/util: Add funcs to push zeroed data to circlebufs
Adds circlebuf_push_front_zero and circlebuf_push_back_zero to
conveniently push zeroed data to the front/back of the buffer without
having to create an intermediary buffer to accomplish the same thing.
2017-12-02 13:52:40 -08:00
Jim
5f1fd38731 Merge pull request #1047 from RytoEX/log-win10-game-mode
Log Windows 10 Gaming Features (Game Mode)
2017-10-25 11:31:31 -07:00
Ryan Foster
0759eeb5da libobs: Add wrapper function to query Windows registry 2017-10-14 00:31:41 -04:00
Ryan Foster
d6ee57ae83 libobs/util: Fix Windows 10 revision detection
Follow-up to 47aa56b (PR #620). Windows 10 revision detection broke in
Build 15036 (Creators Update) after Revision 296. This aims to further
fix revision detection on Windows 10.
2017-10-08 04:16:48 -04:00
Richard Stanway
27d16f961b
libobs: Restore Windows Vista compatibility
Certain PSAPI functions moved to KERNEL32 after Vista, setting
PSAPI_VERSION 1 uses the old PSAPI exports for compatibility. Vista
support was unintentionally broken by a6318ff.
2017-09-28 13:28:46 +02:00
Jim
b1f2b72628 Merge pull request #929 from RytoEX/nix-sysinfo
Make *nix system info logging more like Windows/Mac
2017-09-12 01:58:49 -07:00
mntone
a6318ffdca libobs/util: Add memory usage functions
Closes jp9000/obs-studio#953
2017-09-12 01:49:11 -07:00
jp9000
8770453c09 libobs/util: Make minor optimization to circlebuf pops
If size is 0 after popping data from the front or back, set the
start/end points to 0 as well to ensure that any subsequent buffer
pushes start from the beginning of the buffer rather than the middle of
the buffer.  Reduces potential unnecessary operations in that case.

Additionally, this fixes a bug with circulebuf_pop_back where if start
position was 0, and all the data was popped off the buffer (equal to the
capacity), the end position would be equal to the original size.  As an
example to replicate the bug, push 5, pop 5, then push 10.  The
start/end points will be invalid.

Closes jp9000/obs-studio#954
2017-06-27 21:25:00 -07:00
Shaolin
cb9f767e45 libobs/plugins/UI: Suppress -Wimplicit-fallthrough introduced by GCC 7
Signed-off-by: Shaolin <admshao@gmail.com>
2017-05-29 21:05:18 -03:00
Ryan Foster
e4a64f0efa libobs/util: Fix *nix CPU core counts
Get logical and physical CPU cores on Linux and FreeBSD, even for
multi-core CPUs.
2017-05-26 00:30:36 -04:00
jp9000
b8355c656c libobs/util: Also remove CR/LF from dstr_depad
Prevents newline characters from being included in things like stream
keys
2017-05-20 11:15:00 -07:00
jp9000
9e466a4697 libobs/util: Add function to get free disk space 2017-05-13 01:21:14 -07:00
fryshorts
0527cb5c15 libobs: Fix os_safe_replace not working linux
Make sure the target file exists before attempting to create a backup.
This will allow for the function to work correctly if the target does
not yet exist.
2017-05-08 19:24:02 +02:00
jp9000
6fc74d69a9 libobs: Add functions to get logical/physical cores 2017-05-06 11:29:27 -07:00
jp9000
2537f9a5e2 libobs/util: Use MoveFileEx with MOVEFILE_REPLACE_EXISTING
Ensures that it will replace an old file if it exists.
2017-05-04 18:44:15 -07:00
jp9000
ac2f792d50 libobs/util: Flush text files when writing
Helps prevent the possibility of an empty file from being written.
2017-05-04 18:24:00 -07:00
jp9000
6d3777129d libobs/util: Use os_safe_replace in safe file writes 2017-05-04 18:23:23 -07:00
jp9000
651d80c0df libobs/util: Add os_safe_replace function
Allows safely/atomically replacing a file and creating a backup of the
original.  The reason for adding this function is because Microsoft
provides a ReplaceFile function which does this in a single call.
2017-05-04 18:21:51 -07:00
jp9000
82d72803d6 libobs/util: Add Get function to BPtr<> 2017-05-04 05:46:29 -07:00
Ryan Foster
be98cee2a0 Fix various typos across multiple modules 2017-04-25 22:39:42 -04:00
jp9000
7fba736df9 libobs/util: Use a mutex with config files 2017-02-21 23:03:18 -08:00
jp9000
5868133587 libobs/util: Fix C++ compilation issue
When the C header circlebuf.h is used from a C++ source file, this
implicit cast from void to uint8_t* will cause an error unless changed
to an explicit cast.
2016-12-23 10:37:03 -08:00
jp9000
eb6d8e10fa libobs/util: Do not ignore deprecation on windows
On MSVC, deprecated types/functions were being completely ignored by the
compiler due to this pragma.  Any plugins/programs that depended on this
would also have this warning disabled due to it being in this file.
This pragma was most likely originally done due to the MSVC warnings for
C-standard functions, which are now ignored via _CRT_SECURE_NO_WARNINGS
on all projects instead.
2016-12-08 03:27:38 -08:00
jp9000
b29d8a44d1 libobs: Fix deprecated macro
There's no need to have two separate macros to declare something as
deprecated.
2016-12-08 03:27:37 -08:00
jp9000
b277000f97 libobs/util: Add function to generate formatted filenames
(Note: This commit also modifies the UI)

Being able to generate file names based upon a specification is useful
for more than just the UI; it can also be useful for things such as the
replay buffer where file names need to be generated on the fly.
2016-12-08 03:27:34 -08:00
jp9000
3aa6b50fbe libobs/util: Add function to get circlebuf data offset
Allows getting pointer to an offset at a specific index within the
circlebuf data.  Useful for iterating through circlebuf data.
2016-12-08 03:27:33 -08:00
Ryan Foster
788a1e22b7 libobs: Refactor check for Windows bitness/arch
Commit aa899c2 (PR #603) added logging for Windows bitness/arch, but it
was a bit incomplete/short-sighted.  It only added that information to
the regular logs.  This commit makes it easier to retrieve that
information for other purposes, like the crash handler.
2016-11-09 12:41:07 -08:00
jp9000
39a91d749c libobs/util: Add Get() function to CoTaskMemPtr 2016-10-23 09:20:54 -07:00