Commit graph

2077 commits

Author SHA1 Message Date
Clownacy
f78f6b7105 Split Organya callback data
The function pointer only ever needs to be set once, unlike the
timer. This should avoid any scary race-conditions.
2020-04-18 00:54:24 +01:00
Clownacy
1ad6fdf539 Rename mutex 2020-04-17 23:52:00 +01:00
Clownacy
b06e1e1312 Remove old junk 2020-04-17 23:48:40 +01:00
Clownacy
051d12f434 Stop shouldn't rewind the sound
According to the DirectSound docs, stop doesn't rewind.

https://docs.microsoft.com/en-us/previous-versions/ms817375%28v%3dmsdn.10%29
2020-04-17 23:47:45 +01:00
Clownacy
5bcc0ec393 New way to allocate Wii U voices
The previous method wasn't good enough: we were still maxing-out at
96 (did the Decaf devs misread that as hex? Is that why the
emulator's limit is 150 instead?).

Anyway, this new solution is a little brutish, but I can't think of
anything else that would work: right now, I have the Organya thread
constantly polling a linked-list of the currently-loaded sounds, and
checking if their voices have finished playing or not. If they've
finished, they get freed.

When AudioBackend_PlaySound is called, if checks if the sound's voice
has been freed or not, and reallocates it if it has.

There doesn't seem to be a noticable overhead to this, and it keeps
the number of currently-allocated voices *very* low (from 10 to 20 on
average).
2020-04-17 23:43:17 +01:00
Clownacy
617f7a25d4 Wii U video tweaks and fixes 2020-04-17 23:42:18 +01:00
Clownacy
b123e3743e Clean-up the weird buggy code
I'mma just assume each sound needs their struct preserving for some
reason.
2020-04-17 21:48:34 +01:00
Clownacy
db14899b3e Try to fix Wii U audio hang part 2
I encountered a hang earlier, so the previous attempt obviously
didn't work.
2020-04-17 18:34:26 +01:00
Clownacy
670f49db77 Optimise Wii U video code a little 2020-04-17 18:07:54 +01:00
Clownacy
76e7a6f857 Revert some suspicious code
I'm getting some rare audio hangs. I tried doing some
regression-testing, but it's so random that I'm getting anomalous
results. That said, there were suspicious results around this change
(and also the way `mix_data` is initialised/cleared), so I'm
reverting this for now, and restoring it next time I encounter a
hang.
2020-04-17 16:58:07 +01:00
Clownacy
c2a857d4f5 Flush the screen buffer on Wii U
Weird cache stuff I don't know
2020-04-17 15:51:27 +01:00
Clownacy
d025fecf54 Minor cleanup 2020-04-17 15:47:56 +01:00
Clownacy
274de9e0f9 Replace Liberation Mono with DejaVu Sans Mono
Looks better at 320x240
2020-04-17 14:18:32 +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
24bcbb8dfd Upscale 320x240 to 640x480 on the Wii U
For performance reasons, I'm going to switch to 320x240 for Wii U
builds.
2020-04-17 14:15:59 +01:00
Clownacy
a177f44b88 Clean up Wii U audio backend 2020-04-17 14:15:23 +01:00
Clownacy
9eacc74ee2 Got music working on Wii U! 2020-04-17 01:47:23 +01:00
Clownacy
edc9299007 Fix the game using too many Wii U voices
Now it just allocates channels on-demand, rather than ahead-of-time.
2020-04-16 22:42:33 +01:00
Clownacy
a7ebdb75e5 Added unfinished Wii U audio backend
Currently doesn't produce sound unless you stop Organya from calling
AudioBackend_CreateSound, because it exhausts the Wii U's 150-sound
pool before the SFX get any of them.
2020-04-16 22:19:00 +01:00
Clownacy
6bd4e89f9d Update readme 2020-04-15 22:12:58 +01:00
Clownacy
c38a8aa857 Read files from SD/CSE2-portable on Wii U 2020-04-15 22:12:41 +01:00
Clownacy
763e4a9986 Vertically center screen on Wii U 2020-04-15 22:10:40 +01:00
Clownacy
a983417771 Update Wii U backend 2020-04-15 22:03:59 +01:00
Clownacy
be0c61018b Update SDL2 backend 2020-04-15 22:01:27 +01:00
Clownacy
8524d1e349 Change software renderer backend API 2020-04-15 21:59:23 +01:00
Clownacy
7ca33677f8 Remove some old junk 2020-04-15 21:52:13 +01:00
Clownacy
f2a82d09bd Remove unneeded #include 2020-04-15 20:37:10 +01:00
Clownacy
d7733004d0 Correct a BOOL 2020-04-15 20:32:49 +01:00
Clownacy
0653c20ba4 Merge branch 'accurate' into portable 2020-04-15 20:03:59 +01:00
Clownacy
624adbdab8 Remove junk widescreen code
This doesn't belong in here. Also, this code was overhauled in the
enhanced branch, so this version is useless.
2020-04-15 19:59:13 +01:00
Clownacy
c93ed6a014 Comment-out unused #include 2020-04-15 18:42:02 +01:00
Clownacy
3ffe5a083e Use fixed-size texture format
I recall reading that you should prefer these over the non-fixed size
2020-04-15 16:59:54 +01:00
Clownacy
073e62de46 Software renderer tweaks 2020-04-15 16:57:05 +01:00
Clownacy
aee4ce0866 Merge branch 'accurate' into portable 2020-04-15 03:16:27 +01:00
Clownacy
3a72dd6bee Add Wii U compilation instructions to readme 2020-04-15 02:38:38 +01:00
Clownacy
d9f62453a6 Remove a dead function prototype 2020-04-15 02:20:59 +01:00
Clownacy
b5eefd95f0 Change Wii U input to keyboard emulation
The keyboard API allows me to bind multiple buttons to the direction
keys, unlike the controller API. I probably need to rethink the
controller API at some point.
2020-04-15 02:16:13 +01:00
Clownacy
470a51219e Fix WiiU builds with LTO enabled
For some reason, LTO affects how `ReadVPAD` handles failure, causing
it to spam gamepad button inputs. With proper error-checking, this is
fixed.
2020-04-14 03:50:33 +01:00
Clownacy
38ea875e11 Add new backends to readme 2020-04-14 01:35:18 +01:00
Clownacy
6d53668bed Add Wii U platform backend
With this backend, CSE2 can run on the Wii U.

It's not ideal - it doesn't have its own renderer yet, so it just
uses the software renderer, and it only displays on the gamepad,
because drawing to the TV as well makes the game lag.

Also there's no sound.

Also the lack of input rebinding is annoying.
2020-04-14 00:31:13 +01:00
Clownacy
bcbb06f092 Fix a leftover printf 2020-04-14 00:29:52 +01:00
Clownacy
db0b2d0293 Add option to disable DoConfig
Needed for console ports
2020-04-13 19:10:58 +01:00
Clownacy
f4f85f1f9d Add Null platform backend
Also does absolute nothing.

The point of these things is so it's easier to test out new ports.
For example, with the Null backends and the software renderer, we
don't need to write any code to build for other platforms.

In addition, by having no platform-dependant code, this can be used
to trace crashes. For example, I was having crashes on the Wii U,
despite there being no Wii U-specific code at all - the cause turned
out to be that the executable wasn't stripped, and it had nothing to
do with the code at all.
2020-04-13 18:54:34 +01:00
Clownacy
02f570cec7 Add Null audio backend
Literally doesn't do anything
2020-04-13 18:31:39 +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
fd0733f6e7 Fix GLFW3 not handling exit event while not focussed 2020-04-13 15:32:34 +01:00
Clownacy
8549fa561e Avoid WindowsWrapper.h in controller backend 2020-04-13 14:56:48 +01:00
Clownacy
026fea52ff Untangle Input.cpp from the controller backend 2020-04-13 14:49:07 +01:00
Clownacy
58fc9a392a More cleanup 2020-04-13 13:56:29 +01:00
Clownacy
aa9e486086 Handle WindowBackend_Software_CreateWindow fail
Must have been part of that commit I reverted
2020-04-13 13:49:21 +01:00