Commit Graph

299 Commits (master)

Author SHA1 Message Date
rodri d87fb23a93 bring games/swar from 1ed sources. 2021-08-26 20:04:59 +00:00
qwx 7048f1ca11 games/opl3: use correct sampling rate
games/dmid uses the same sample rate as the chip for music, but other
applications do not.  opl3 and its older version opl2 (not in 9front)
read an input stream of commands in basically IMF format, something
used in other id Software games and some others, which assumes a
given input sampling rate:  700 Hz for Wolfenstein 3D music, 560 Hz
for Commander Keen, 60 Hz for Ultima 6, etc.

The opl3 emulation on the other hand is not really intended to run at
a sampling rate different that the chip's 49.716 kHz sampling rate.
Previously, we assumed it runs at 44.1 kHz and just used the input
rate as a divisor to get the number of samples per delay tic.

From what I understand, the correct way to use it for accurate
emulation is to run the opl chip emulator at its intended sampling
frequency, then downsample to 44.1 kHz.  This means better output
but more code.  The alternative is to basically do the same as
before rev 8433, except with no buffering, but at accuracy/quality
loss.  This change implements the former and just forks pcmconv to
deal with resampling.
2021-05-05 16:57:19 +02:00
qwx af2f7ea236 games/opl3: don't buffer output and simplify (thanks umbraticus)
this fixes real-time applications.

-n previously specified a rate divisor rather than the rate itself,
which was used for specific applications outside of 9front.  instead,
just set the rate directly, more useful and straightforward.
2021-04-27 09:48:14 +02:00
Sigrid c613382caf remove juke (use play or zuke instead) 2021-04-13 13:25:24 +02:00
cinap_lenrek 958b476499 games/glendy: your complication had a complication (god damn it kemal) 2021-04-02 22:23:40 +02:00
cinap_lenrek 74befadb14 games/glendy: don't use lucida sans in menus by default and bugfix (thanks kemal)
i have found one bug. when i put glenda in a position like this

i somehow win, but the glenda can escape from there.

in addition, i have changed the games manpage to include more info about glendy.
2021-04-02 22:05:15 +02:00
Michael Forney 472958e3e7 games/snes: use 4-point hermite interpolation to resample
This is noticeably better than nearest-neighbor.
2021-02-22 16:12:24 +01:00
Michael Forney 8aff377698 games/snes: use enum constants KON and ENDX instead of their values 2021-02-17 11:20:13 +01:00
Michael Forney 03eeebb97f games/snes: implement DSP echo 2021-02-17 11:20:05 +01:00
Michael Forney f1d29a9d12 games/snes: implement DSP noise
I'm not sure if this LFSR is the same one used by the hardware or is
arbitrary, but it matches the noise sequence used by all other snes
emulators I looked at.
2021-02-17 11:19:50 +01:00
Michael Forney 52b54097bf games/snes: fix BRR decoding with filters 2 and 3
s1 and s2 should store the last and next to last output, but were set
in the wrong order, causing them both to be the last output. This
breaks filters 2 and 3, which both utilize s2.
2021-02-17 11:19:39 +01:00
Michael Forney 415c110b28 games/gb: fix reversed audio channels
The high bits correspond to the left channel, and the low bits to the
right channel.

Reference: https://gbdev.io/pandocs/#sound-control-registers

Tested with pokemon crystal.
2021-02-08 04:58:49 +01:00
Michael Forney e502abe001 games/gb: various HDMA fixes
H-blank DMA should only transfer 16 bytes per h-blank, rather than
waiting for the first h-blank and then transferring the whole size.

HDMAC should read 0xff when the transfer is finished, and 0 in the
high bit when the transfer is ongoing. Also, if 0 is written in the
high bit, the current transfer should be aborted.

Introduce two flags, DMAREADY and DMAHBLANK rather than special
constants 1 and -1. If dma is non-zero, there is an ongoing DMA. If
DMAREADY is set, the next chunk is ready to transfer.

Reference: https://gbdev.io/pandocs/#ff55-hdma5-cgb-mode-only-new-dma-length-mode-start

Tested with pokemon crystal.

What was happening is that when the game was loading N background tiles
into vram (each 16 bytes, so one per h-blank), it did something like
this:
- start an hdma transfer for N+1 tiles
- after the Nth tile is transferred, it would read HDMA5, clear the
high bit, then write it back to abort the transfer.

games/gb would instead transfer all N+1 tiles at once, overwriting one
extra tile with whatever was 1 past the end of the source array, and
then would interpret the cancel request as the start of a new transfer
of 16 bytes, which would copy an additional tile past the end. The end
result is that every transfer would end up copying N+2 tiles instead
of just N, overwriting certain tiles with whatever was after the end
of the source data.
2021-02-08 04:58:41 +01:00
Michael Forney 655170c873 games/gb: fix timer divider for input clock 0
According to [0], input clock 0 should divide by 1024=2¹⁰, not 2¹².
This caused audio to run at quarter-speed in one game I tried.

[0] https://gbdev.io/pandocs/#ff07-tac-timer-control-r-w

Tested with zelda: oracle of seasons, and dr. mario
---
2021-02-08 04:58:02 +01:00
Alex Musolino 32a5ff9658 games/mix: fix decoding of shift instructions 2020-11-28 23:03:44 +10:30
Alex Musolino 2619be4d4d games/mix: fix SLAX and SRAX instructions (thanks nicolagi)
MIX shift instructions shift by bytes not bits.
2020-11-28 23:02:28 +10:30
Alex Musolino 2a907fd459 games/mix: fix implementation of MOVE instruction (thanks nicolagi)
Plan 9 memcpy(2) uses the same implementation as memmove(2) to handle
overlapping ranges.  Hovewer, the MIX MOVE instruction, as described
in TAOCP, specifically does not do this.  It copies words one at a
time starting from the lowest address.

This change also expands the address validation to check that all
addresses within the source and destination ranges are valid before
proceeding.
2020-11-27 11:19:49 +10:30
Sigrid dfbf774bbb games/nes: workaround for truncated chr 2020-10-15 10:30:40 +02:00
Ori Bernstein 3873eb06d9 games/4s: increase thread size (thanks majiru)
It seems like on amd64, we're overflowing the stack.
Let's not do that.
2020-09-13 11:21:21 -07:00
cinap_lenrek ac88ce4f7f make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.

The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.

Most code just cares about the error, so test for
the -1 error value only.
2020-05-02 17:32:01 +02:00
cinap_lenrek 57741d473f games/playlistfs: open /proc/n/ctl OWRITE, not ORDWR 2020-03-08 13:13:25 +01:00
aiju 6f80913ac7 add v8e 2020-01-22 13:09:09 +00:00
cinap_lenrek 8b79ad59f1 games/turtle: do exit instead of crash in redraw() when there where no lines drawn 2019-11-03 15:20:57 +01:00
aiju 528936156f add games/linden and turtle to mkfile 2019-11-03 13:54:26 +00:00
aiju ae61eb9381 add games/linden and games/turtle 2019-11-03 13:49:23 +00:00
cinap_lenrek 5a934b56f5 wadfs: avoid comma operator after PBIT32() macros 2019-05-07 21:49:49 +02:00
aiju 7a8e875668 games/md: fix mkfile 2018-11-20 09:22:04 +00:00
aiju 99d2e68a6a games/md: use cpu.c from blit 2018-11-20 09:20:46 +00:00
aiju af810c9871 games/blit: clean up cpu.c and make it pass tests 2018-11-20 09:18:20 +00:00
aiju fbfa249c63 games/c64: make keyboard table more readable 2018-11-17 09:48:46 +00:00
qwx f5c6a870bf doom: fix music for patch wads
revert last change, which used games/wadfs to expose genmidi and music lumps.
replacements from patch wads were never seen that way.  instead, write genmidi
and music lumps to /tmp and play them from there.
2018-10-21 00:11:39 +02:00
aiju 921b75a909 games/gb: when the LCD is turned off, reset ppuy and ppustate to 0, fixes bug in dragon warriors iii reported by mischief 2018-10-11 16:25:11 +00:00
qwx 55e0fd6031 dmid: add support for midi streams
tested with a usb midi keyboard and a midi->usb adaptor
2018-08-31 18:01:21 +02:00
qwx a8644d01c3 add games/dpic and games/todpic 2018-07-25 05:02:46 +02:00
qwx f4b9f0304d dmid: better fnumber calculation and fix fine tuning for 2nd voice 2018-07-21 05:05:53 +02:00
qwx e7b1c1aad8 doom: use wadfs to expose music lumps
launch wadfs after detecting main wad, exposing GENMIDI and music lumps
under /mnt/wad.  /bin/dmus can then use them directly, and wadfs doesn't
need to be started manually.
2018-07-15 06:31:45 +02:00
qwx 96e511d736 add games/dmid and games/opl3 2018-07-12 09:33:33 +02:00
qwx 4e04e03142 midi: properly skip sysex messages
this fixes playing any midi files containing such messages
example: prince of persia midis from vgmpf wiki
2018-07-10 23:26:17 +02:00
aiju ac891003ea games/mines: add missing checks for UseGhost 2018-07-03 07:22:19 +00:00
qwx deae5c854b mus: fix note volume and channel selection; simplify
- fix overwriting channel 10 with channel 9
- fix using channel volume instead of last volume when setting note
  (fixes d_doom and others)
- remove useless state
2018-06-26 10:35:23 +02:00
qwx 0da9e3a7f5 gba: handle 8bit writes to vram
ignore 8bit writes to obj and oam, and duplicate bits for bg and palette
memory, as per gbatek.

thanks aiju for helping with the implementation.
2018-06-22 14:49:18 +02:00
qwx e4b842056c emulators ui: don't drink and code 2018-06-13 14:14:25 +02:00
qwx 09c6120444 emulators ui: add option for fixed factor scaling and bound scale vertically 2018-06-13 14:05:19 +02:00
aiju 9fbce3b1b4 games/gb: attempt at fixing sprite priority 2018-06-13 09:52:41 +00:00
aiju 5d202d3456 games/gb: fix mbc5 register addressing (fixes warioland3 gamebreaking bug) 2018-06-13 09:26:55 +00:00
qwx 198f10bb25 snes: fix input botch 2 2018-06-09 07:12:43 +02:00
qwx 54ac2c2871 snes: fix input botch 2018-06-09 07:08:43 +02:00
qwx 50b36c5112 doom: don't set repl if scale is 1 2018-05-31 05:11:33 +02:00
qwx f1eb657db0 emulators ui: don't call flushmouse twice 2018-05-29 05:28:31 +02:00
qwx c83a6f9c00 emulators ui: fix input botch and typo 2018-05-14 20:49:08 +02:00