Commit graph

156 commits

Author SHA1 Message Date
Gabriel Ravier
564d42dbd2 src: Change from using asprintf-based code to using std::string-based code
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-06-29 18:33:22 +02:00
Gabriel Ravier
32a879ca58 src: Removed MAX_PATH and made the path/string handling better in general (ported over from supportPathsAboveFilenameMax)
Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
2020-06-29 00:14:30 +02:00
Clownacy
4403d10c14 Merge branch 'accurate' into portable 2020-05-04 18:24:23 +01:00
Clownacy
70a3badc0d Cleanup 2020-05-04 18:21:44 +01:00
Clownacy
2f682a102f Merge branch 'accurate' into portable 2020-05-04 18:17:39 +01:00
Clownacy
03250d62a0 Make variables more accurate
This commit changes which variables are static: the Mac (and
presumably the Linux) debug data tells you what variables are static,
by prefixing their names with double_underscores.

The variable names themselves also hint at this: global variables are
prefixed with 'g', and use upper-camelcase, while static variables
use whatever_you_call_this.
2020-05-03 20:28:56 +01:00
Clownacy
16f29f6fb7 Merge branch 'accurate' into portable 2020-04-26 00:56:40 +01:00
Clownacy
43c0b670ab Figured out the mystery values in RestoreSurfaces
They're ASCII characters.
2020-04-26 00:07:45 +01:00
Clownacy
e4e8453ba6 Make some logic more like vanilla 2020-04-25 17:58:19 +01:00
Clownacy
a7f2ec6a5e Safely-handle LockSurface failing
Fixes crash on Wii U at 1280x720 (LockSurface fails there because
CreateSurface fails - maybe it's running out of memory again)
2020-04-23 19:53:33 +01:00
Clownacy
a2cdd9ac18 Allow surfaces to be marked as not-render-targets
The Wii U has a very limited pool of memory for render targets
(32MB), so we should only use it if we have to.

This 'fixes' a bug in the enhanced branch, where if you use 2x
sprites at 854x480, the third line of the text box will be corrupted
(text will appear on the second line instead, and be black instead of
white).

The other renderers haven't been updated for the API change yet.
2020-04-23 13:23:10 +01:00
Clownacy
bfc2d4e326 ...Maybe I should test my fixes before commit 2020-04-21 14:59:05 +01:00
Clownacy
afb3c834a7 Do not draw sprites with backwards/empty RECTs
Previously, each backend had to guard against it, which is messy,
results in duplication, and leaves new backends open to the risk
of not guarding against it (the Wii U GX2 renderer didn't).
2020-04-21 14:54:29 +01:00
Clownacy
b89207b586 Merge branch 'accurate' into portable 2020-04-20 01:17:19 +01:00
Clownacy
93ad3ae7c5 Make font look better at 320x240
This restores some vanilla logic, where at 320x240, the font would
use a slightly larger size, in order to not look terrible.
2020-04-17 14:16:49 +01:00
Clownacy
8f49276d5e Note some not-so-authentic variable names 2020-04-16 14:44:53 +01:00
Clownacy
b83b7f25fc Found the real name for DummiedOutLogFunction..? 2020-04-16 13:47:17 +01:00
Clownacy
c51a074fad Big disgusting backend rework
We need to avoid `WindowsWrapper.h` in the backends whenever we can,
to avoid name collisions (the Wii U homebrew library) defines its own
BOOL/TRUE/FALSE, which really doesn't work with CSE2.
2020-04-13 18:19:39 +01:00
Clownacy
135035bb1a Change 'PlatformBackend' namespace to 'Backend' 2020-04-04 20:31:27 +01:00
Clownacy
4d322be866 Change render backend namespace to RenderBackend_ 2020-04-04 20:24:34 +01:00
Clownacy
c4aa8e28bb More refactoring 2020-04-01 14:57:07 +01:00
Clownacy
5dbca99e19 Extremely horrible terrible nightmare refactoring
Working on ridding CSE2 of its hard SDL2 dependency.

For now, I have a rudimentary GLFW3 backend.
2020-03-31 21:56:10 +01:00
Clownacy
142bca6578 Split SDL2 code from Draw.cpp 2020-03-31 16:11:31 +01:00
Clownacy
b8de1cb5db Merge branch 'accurate' into portable 2020-03-31 14:07:21 +01:00
Clownacy
7820926bfd Remove outdated comments 2020-03-22 15:37:00 +00:00
Clownacy
c34a7fc354 Fix build error 2020-03-22 15:35:59 +00:00
Clownacy
b374a8046c Add some missing global/static variable names
Also from the Mac port.
2020-03-22 15:31:28 +00:00
Clownacy
f6606b7748 Add some missing function names
These were retrieved from the Mac port (v0.0.7), which kept these
functions.

Unfortunately, this port is missing local variable names, so we can't
use it to make InitBack accurate.
2020-03-22 15:31:28 +00:00
Clownacy
cf75cbcad2 Don't embed font in executable
Creating a Japanese build would require 4GB+ of RAM because of this.
It's about time it got removed. It was a silly idea anyway.
2020-03-17 21:14:15 +00:00
Clownacy
2e5e1994c2 Enable debug console prints in non-debug builds 2020-02-03 16:44:52 +00:00
Clownacy
1cffacb72e Added DecodeBitmapFromFile 2020-01-27 00:30:54 +00:00
Clownacy
2ef48bea8a Change DecodeBitmap to use unsigned ints
Why would an image decoder ever return a _negative_ image
width/height?
2020-01-26 23:59:04 +00:00
Clownacy
cccef2b089 Fix memory leaks 2020-01-26 23:54:20 +00:00
Clownacy
5e60c15b1d Add missing sanity check 2020-01-26 23:53:40 +00:00
Clownacy
b650294b8b Change LoadFileToMemory's function signature 2020-01-26 20:06:31 +00:00
Clownacy
cf8977207e Stop using SDL for .bmp decoding
Now it uses stb_image instead
2020-01-26 19:47:50 +00:00
Clownacy
6dac8254e2 Begin merge of Backend_Init/Backend_CreateWindow
OpenGL3+OpenGLES2 backend done so far
2020-01-22 22:19:55 +00:00
Clownacy
be533e2f55 Remove FRAMERATE constant
I don't see the point in it.
2020-01-20 23:54:46 +00:00
Clownacy
d04bd94649 Use SDL_TICKS_PASSED for frame-limiting
This probably works-around overflow
2020-01-20 23:53:41 +00:00
Clownacy
79886f5ae4 Add debug prints for listing SDL2 drivers
These list what video/render/audio backends are available, and which
are currently being used.

SDL2 allows you to choose a specific video/audio driver with the
SDL_VIDEODRIVER and SDL_AUDIODRIVER environment variables,
respectively, but there's no such option for the render driver.
2020-01-20 15:27:05 +00:00
Clownacy
84626ea710 Merge branch 'accurate' into portable 2020-01-07 04:55:16 +00:00
Clownacy
a0eb646a1f Add ability to lock certain parts of a surface
This avoids conditional jumps based on uninitalised memory, and
should be faster, and should be lighter on memory.
2020-01-07 03:52:37 +00:00
Clownacy
58d7a45392 Empty Tags.h
There's no evidence Tags.h contained these variables (if anything, it
appears that Pixel manually declared them in every file that used
them).

gg Pixel
2020-01-06 21:20:17 +00:00
Gabriel Ravier
befb5f7fb5 ScaleAndUploadSurface now doesn't take ownership of the surface it is passed and frees it. This is to correct multiple occurences of use-after-free occuring from use of the passed surface after a call to ScaleAndUploadSurface using it 2020-01-06 18:26:25 +01:00
Clownacy
2e8d3441ed Turns out I'm the stupid one 2020-01-04 19:49:43 +00:00
Clownacy
0ec5d85d56 Merge branch 'accurate' into portable 2019-11-17 18:30:44 +00:00
Clownacy
989013168c Clean-up Draw.cpp 2019-11-15 21:00:29 +00:00
Clownacy
85890ef1e6 Shut up some Clang warnings 2019-10-29 12:14:48 +00:00
Clownacy
c2daebe38a Handle Backend_Init failing
Should really give those render-backend functions a different prefix.
2019-10-27 01:57:09 +00:00
Clownacy
a8cf5e1846 Fix a typo in a comment 2019-10-20 21:08:47 +00:00