1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-06 19:50:22 +00:00
Commit graph

92 commits

Author SHA1 Message Date
Samuel Gomes 8c61cac457 Merge branch 'filesystem-refactor-and-update' of https://github.com/a740g/QB64pe into filesystem-refactor-and-update 2023-12-28 00:10:52 +05:30
Roland Heyder 2d9018ca85 Add missing changes
ideally these should have been part of the 1st commit
2023-12-14 00:30:03 +01:00
Samuel Gomes 48539861f3 Repace fixdir() with filepath_fix_directory() 2023-12-10 11:15:41 +05:30
Samuel Gomes 0e251eb8e8 Consolidate all filesystem related functions to it's own translation unit 2023-12-10 01:16:29 +05:30
SteveMcNeill 64ba64f0bd rename math.h to extended_math.h 2023-10-31 08:45:10 -04:00
SteveMcNeill 01163fb9e9 Create math.h
Move the extended math functions out of libqb and qbx, and place them inside math.h.

Correct the formula for _ARCSEC and _ARCCSC.
2023-10-31 08:34:19 -04:00
SteveMcNeill 9854955d99 Add Support for optional paramter for an image handle to CLS 2023-10-18 08:01:12 -04:00
Matthew Kilgore d64221afda Use correct math functions from std::
With the removal of `using namespace std;` we inadvertently started
using some of the global math.h versions of these functions, which take
different types and resulting in computation errors.

The fix is to prefix all these functions with std:: so that we go back
to using the std:: versions.
2023-10-07 02:05:13 -04:00
Samuel Gomes 3f16e3c9d1 Add volume, panning & waveform support for SOUND 2023-06-10 02:24:05 +05:30
Samuel Gomes e4b36ca8ad Add font load-from-memory support 2023-04-20 09:23:13 +05:30
Samuel Gomes d974c0b9a8 Tidy up font code 2023-04-04 17:51:17 +05:30
Samuel Gomes 6dd651f7cd Replace MinGW intrinsic zlib with miniz 2023-03-19 02:28:05 +05:30
Samuel Gomes e79537e624
Merge branch 'main' into image-load-from-memory-support 2023-02-13 16:24:36 +05:30
Matthew Kilgore d4ed371681 Stopped timers don't trigger on TIMER ON
If a timer expires while stopped, it should trigger when TIMER ON is
run. Instead, on QB64 it triggers randomly after the TIMER ON happens.

The basic issue is that `qbevent` needs to be set to trigger the timer,
but TIMER ON doesn't do that. The regular timer logic that does that
already set it when the timer expired while sleeping, so it won't set it
again. The simplest solution is to just alway set qbevent = 1 when TIMER
ON is done. It's slightly less efficent but doesn't hurt to set it even
when there are no timers that expired.

Fixes: #293
2023-02-12 21:27:25 -05:00
Matthew Kilgore 924472f5d6 Fix timers not firing at the start of the program
Timer's were not firing at the right time if they were started shortly
after the program started, instead they would fire at twice the interval
time (and then work correctly after that).

The issue was a mistaken assumption about `time_now`, with the idea that
if `last_time == 0` then `time_now` will be large enough such that the
interval check will pass. This is wrong because in most cases `time_now`
starts at zero at program start, so when `last_time == 0` it will take
one full interval of the timer before `time_now` is large enough for the
interval check to pass (at which point the timer is initialized and runs
normally).

This simply refactors the timer logic so that `last_time == 0` is
checked first, rather than if the interval has expired. This doesn't
change how the normal logic works, but ensures that the value of
`time_now` does not matter for initializing a timer.

Fixes: #273
2023-02-12 21:27:25 -05:00
Samuel Gomes f0f0a9a420 Overload _LOADIMAGE to allow strings as the 2nd parameter 2023-01-11 16:18:43 +05:30
Matthew Kilgore f21ce09e2d Replace time() with std::chrono, fix startup delay
Currently main() includes logic that is intended to sync time() with
GetTicks() for the purpose of using GetTicks() to get millisecond
accuracy with time(), which only has second accuracy. Unfortunately, the
'syncing' up of these time sources results in an average of a half
second delay in starting a QB64-PE program.

This logic is easly replaced with std::chrono, which provides a real
time clock which is also millisecond accurate. That removes the need to
use time() and GetTicks() together to get millisecond accuracy, and
means the delay syncing them is no longer necessary.

I also separated most of the "delay" and "time" related functions into
datetime.cpp, and included the new std::chrono code into that file.

Since I needed to call some of the rounding functions in datetime.cpp I
also moved that stuff out into its own .cpp and header files to clean
things up a bit.

Fixes: #282
2023-01-08 20:24:25 -05:00
Matt Kilgore 8185234792
Merge branch 'main' into fix-glut-init-logic 2022-11-26 22:42:46 -05:00
Roland Heyder ec6e648007 Simplify #include
Solving #119
2022-11-27 00:11:04 +01:00
Matthew Kilgore d2aa572a94 Fix GLUT initialization logic
The current GLUT initialization logic is flawed because it allows the
QB64 code portion of the program to start on a separate thread at the
same time that the GLUT code is starting. This results in a race where
some commands won't work for a brief period at the beginning of the
program (with "won't work" being very inconsistent, some return invalid
values, some have a chance at seg faulting).

The same issue also leads to us adding many `while (!window_exists)`
checks in an attempt to solve this race for some of the commands.
Unfortunately this solution is very inconsistently applied leading to
some deadlock situations, and really it's a silly solution when this
race is entirely our creation anyway.

To fix this, the logic was changed such that we perform all of the GLUT
initialization besides calling `glutMainLoop()` before we ever start the
thread that runs the actual QB64 code. By doing it this way we ensure
that the GLUT initialization has already taken place before the code
runs and thus the race is gone.

Things get a bit more interesting with $SCREENHIDE, because that simply
delays the execution of the GLUT initialization indefinitely until
_ScreenShow is done. This was previously very buggy since some commands
rely on FreeGLUT being up and will simply hang the entire program if
run. Other commands have logic to catch this and simply return zero.

The above issue is solved with the `NEEDS_GLUT()` and `OPTIONAL_GLUT()`
macros. Both of them simply check if the GLUT initialization has taken
place and exit the current function if it has not. The difference
between the two is that `NEEDS_GLUT()` throws an 'illegal function call'
error while `OPTIONAL_GLUT()` simply exits with no error. The choice of
behavior of each function was based upon its previous behavior - if it
checked `screen_hide` and exited with no error previously, then
`OPTIONAL_GLUT()` was used. If it deadlocked or similar then
`NEEDS_GLUT()` was used (so instead of deadlocking, it now produces an
error). In this way, programs can now never get stuck due to the use of
`$SCREENHIDE` and all the commands have consistent behavior that can be
relied upon.

Fixes: #234
2022-11-26 01:33:32 -05:00
Matthew Kilgore 12c9c35db5 Add _StatusCode command for HTTP handles
The _StatusCode command returns the status code on the HTTP response
when given a HTTP handle from _OpenClient().
2022-11-20 04:04:02 -05:00
Samuel Gomes 93e58baa1d Common dialogs support 2022-10-23 12:57:02 +05:30
Samuel Gomes f49f8bdf06 Implement _SNDPLAYCOPY enhancement #185 2022-10-05 02:33:44 +05:30
Samuel Gomes f99eb27717 Remove all _SHR & _SHL changes 2022-09-01 16:15:42 +05:30
Samuel Gomes 2ed17f6198 Add _ROR & _ROL support. Fix issues with _SHR & _SHL 2022-09-01 06:51:06 +05:30
Roland Heyder e68582b6f2 Step 7: Rename qb64.exe to qb64pe.exe
- Includes related LNX/OSX files
- Excludes mentions in the help (*.txt) files
2022-08-11 18:07:57 +02:00
Matthew Kilgore 1aa8d7a42f Run clang-format on ./internal/c/*cpp files 2022-05-06 13:20:30 -04:00
Roland Heyder ce3c459dad Implements the _Bin$ function
Usage is analog to the legacy OCT$ and HEX$ functions.
2021-10-14 00:17:35 +02:00
FellippeHeitor 8d9cd83f6a Prevent errors when doing internal lbound/ubound checks 2021-09-30 22:40:57 -03:00
FellippeHeitor 5cab1880b5 Uses GetLogicalDrives() in Windows (file dialogs). Closes #183 2021-09-21 02:54:41 -03:00
FellippeHeitor 3e498df414 Fixes watching/sending values for _BIT arrays. 2021-09-20 22:04:24 -03:00
FellippeHeitor 7ba11565a5 Adds GetBytes so it's easier to add data to the packet ($DEBUG). 2021-09-03 00:03:28 -03:00
FellippeHeitor 9aa166e4de Checks for array's lbound and ubound before fetching data. 2021-08-19 19:10:51 -03:00
FellippeHeitor cca1593f79 Switches focus to IDE automatically when breakpoint is reached.
Windows-only.
2021-08-12 23:00:43 -03:00
FellippeHeitor 0bbc60e73e Allows reading program_stop without using _Exit. 2021-08-04 21:12:33 -03:00
FellippeHeitor 01a3c56685 Allows setting any length string variables from the IDE. 2021-08-03 00:36:21 -03:00
Fellippe Heitor 7e5710a364 Allows _MK$/_CV to deal with _OFFSET
_UNSIGNED _OFFSET too.
2021-07-28 14:26:32 -03:00
FellippeHeitor 231e28c79b Adds method to allow closing the connection with the IDE.
In order to allow $DEBUG to work with programs that call CLEAR, the connection handle used to connect to the IDE is locked by default and cannot be CLOSEd. With this change, the debuggee itself can now unlock the handle and close the link.
2021-07-22 00:18:34 -03:00
Fellippe Heitor ee4b611056 Adds _EnvironCount 2021-07-17 12:15:00 -03:00
Fellippe Heitor ae887507c2 On error, report back to the IDE. ($DEBUG) 2021-07-16 23:18:46 -03:00
FellippeHeitor af454940e4 Adds TIMER ON control over the debuggee. 2021-07-15 01:13:50 -03:00
Luke Ceddia 0f3909d955
Revert "Prevent zombie processes with Shell _Dontwait"
This reverts commit a94b738407.
It turns out that change stops the SHELL function returning the
child exit code, which is worse than having zombie processes.
2021-07-13 16:20:32 +10:00
Luke Ceddia a94b738407
Prevent zombie processes with Shell _Dontwait 2021-07-13 13:08:27 +10:00
Fellippe Heitor 7b853bf9f2 First attempt at implementing Step. 2021-07-11 12:55:49 -03:00
Fellippe Heitor b59aa4d7af Begins prototyping a $DEBUG metacommand. 2021-07-09 08:08:49 -03:00
Luke Ceddia bf32a6a0fc
Explicitly set x87 fpu to extended precision mode 2021-06-17 23:51:08 +10:00
Luke Ceddia c62568008d
Add _ERRORMESSAGE$ 2021-01-17 23:54:15 +11:00
FellippeHeitor bd54eb0f39 Attempts at implementing _MEMSOUND 2020-12-31 01:40:54 -03:00
FellippeHeitor ac268c740b Simplifies usage of zlib across platforms. 2020-01-18 18:48:10 -03:00
FellippeHeitor 51710ddcd3 Renames zlib's folder so it can be updated without the hassle later on. 2020-01-02 23:00:51 -03:00