Commit Graph

3018 Commits

Author SHA1 Message Date
Lior Halphon 770885440f Minor changes to debugger output 2020-12-12 19:09:53 +02:00
Lior Halphon 4f408eae7c Whoops 2020-12-12 18:13:55 +02:00
Lior Halphon dffc12331b Emulate the delayed NR44 write on the DMG 2020-12-12 18:11:35 +02:00
Lior Halphon 6b30de5fb1 Fixed dark colors on Metal without frame blending 2020-12-12 16:02:46 +02:00
Lior Halphon 7de6194e28 Redo channel 4's timing accurately, emulate NR43 write quirks 2020-12-12 16:02:25 +02:00
Lior Halphon 1baa0446a9 More sweep improvements 2020-12-01 22:37:13 +02:00
Lior Halphon 13bc8679f9 Correct preservation of NRx1's state on pre-CGB models 2020-12-01 14:18:19 +02:00
Lior Halphon 74cf452a48 Further accuracy improvements to sweep; passes Blargg's APU tests again, this time for real 2020-12-01 14:17:35 +02:00
Lior Halphon 0485124076 Redo channel 1 sweep based on DMG schematics; emulates two newly discovered behaviors and also fixes #309 2020-11-28 19:31:25 +02:00
Lior Halphon 67c0e03f3b Fix a window bug in CGB mode, fixes #123 2020-11-22 00:21:19 +02:00
Lior Halphon bbf609f46b Add TGA output option to the tester, closes #310 2020-11-21 21:05:03 +02:00
Lior Halphon 027cecde24 Added debugger "undo" command. Closes #156 2020-11-21 16:19:58 +02:00
Lior Halphon bdd27ce50d IR support in the libretro port 2020-11-21 15:36:21 +02:00
Lior Halphon 1d9ac5ccc3 More accurate IR emulation, simplify API 2020-11-21 00:52:54 +02:00
Lior Halphon b7f3454763 More accurate emulation of the IR port 2020-11-20 22:12:15 +02:00
Lior Halphon cd2310f0a7 Wave RAM reads 0xFF while active on AGBs 2020-11-20 19:39:54 +02:00
Lior Halphon 7fdc58a07e Implement CGB-mode TILE_SEL mixing, fixes cgb-acid-hell and m3_lcdc_tile_sel_change2, closes #308 2020-11-20 16:24:16 +02:00
Lior Halphon c36bdc22f6 More accurate interrupt emulation 2020-11-14 13:55:39 +02:00
Lior Halphon 60b8978762 Local link cable and infrared emulation in the Cocoa port 2020-11-13 23:07:35 +02:00
Lior Halphon 88198e64f4 Minor bug fixes 2020-11-13 23:02:17 +02:00
Tim Allen 67d8586720 hiro: Fix screensaver suspension under GNOME on X11.
On X11, hiro uses the xdg-screensaver helper tool to disable the screensaver,
which detects the screensaver that is running and uses the appropriate
mechanism to communicate with it. The tool's API expects an X11 window ID,
but at least some screensavers ignore it, so it can be set up however. The
GNOME backend *does* care about the window ID, but its expectations are not
documented anywhere, so byuu spent a frustrating few days trying things
at random to get it working, and failing.

It turns out, GNOME does *not* require the window to be mapped, but it *does*
require the window to have a name. Using XStoreName() to name the window fixes
screensaver suspension for me under GNOME 3.38.

Note: while XStoreName is technically deprecated, it's not going to go away
while X11 is still around, and the reason it's deprecated is because it doesn't
include character encoding data. We don't care — no user should ever see the
window name, and it's plain ASCII so it should be fine.

Fixes #102.
2020-11-12 20:56:40 +11:00
Asura 4f7a269ba5 sfc: Report auto joypad polling in the HVBJOY register.
This corrects the reporting bit of HVBJOY to be set during the auto joypad
polling sequence.

This change will fix *SpellCraft - Aspects of Valor*. SpellCraft works by
polling JOY1 nonstop once menus are entered on every scanline, so with incorrect
HVBJOY bit 0 reporting, the game was thinking it was safe to read JOY1 during
the auto joypad polling sequence, so partially shifted in results were being
read back as valid. With this patch, you'll find that the game stops polling
between V:225 H:130 and V:228 H:256, which is the auto polling time range.
Before, it was polling during that time. As a result of this fix, the password
menu can be accessed safely without it closing immediately.

Fixes #86.
2020-11-11 14:49:05 +11:00
John Chadwick c15877a7b7 target-bsnes: Fixes for a couple of input settings bugs.
-   Fixes a bug where the program may crash or display improper buttons
    when changing the selected row during assignment.

    This appears to just be a mistake, accidentally using the 'batched'
    rows instead of the activeMapping row.

-   Fixes a bug where starting multiple assignments without finishing
    one leads to stale "Assigning..." text in some rows.

    This appears to be an oversight. Simply refreshing the mappings
    before starting an assignment fixes this.
2020-11-11 14:48:32 +11:00
Ghislain Antony Vaillant 083406f404 Missing install and uninstall steps 2020-11-10 22:13:16 +11:00
Ghislain Antony Vaillant 868fff9c06 Install icons to default theme
See the [Icon Theme Specification](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html)
2020-11-10 18:03:44 +11:00
Ghislain Antony Vaillant 7a1d16bb3b Use XDG base directories 2020-11-10 17:59:14 +11:00
Sintendo d29677b778 target-bsnes: Only suppress screensavers when active
This commit reworks when the screensaver suppression kicks in.

Previously, bsnes would only engage screensaver suppression once, on
application launch. Now that the option is exposed and can be toggled at
any time, we have to be a little more clever.

Additionally, screensaver suppression is now only engaged while
emulation is active, because it doesn't make much sense otherwise.
2020-11-09 20:25:35 +11:00
Sintendo dba608a808 target-bsnes: Expose screensaver supression in UI
The setting already existed and could be changed by manually editing the
configuration file, but wasn't exposed in the UI. This commit adds the
corresponding check box.
2020-11-09 20:25:35 +11:00
Sintendo 0a9d15a978 hiro/cocoa: Implement Application::setScreenSaver
Based on code from Dolphin and SDL2.

908d6f8fa0/Source/Core/UICommon/UICommon.cpp (L416)
cf1c192936/src/video/cocoa/SDL_cocoaevents.m (L514)
2020-11-09 20:25:35 +11:00
Tim Allen f78502e131 Add a skeleton for bsnes user documentation.
As I was doing the research for #51, I figured I should write down what I
learned before I forgot it, and if I was going to do that, I might as well
write it down in Markdown so we can make a website from it.
2020-11-07 23:45:20 +11:00
Tim Allen a2571fe106 target-bsnes: Patch up broken recent-game entries.
In f09c45f, we fixed native file picker dialogs, so they would correctly set the
"option" field to Auto when loading games, instead of leaving it set to an empty
string which effectively forced NTSC mode. However, this wouldn't fix up the old
entries in the Recent Games menu, so we will patch them up if we encounter them.
2020-11-07 23:44:03 +11:00
Tim Allen 33cb7eb106 Add some documentation about what's in various bsnes directories. 2020-11-07 23:43:38 +11:00
Moonchild 09100f5d88 correctly set O_NONBLOCK in OSS 2020-11-06 21:34:39 +11:00
John Chadwick d4e1c34d0b Fix EXHIROM-RAM-* board mappings.
It is unclear why these addresses were added to the mapping. Removing
these two mappings brings behavior inline with SNES9x:

https://github.com/snes9xgit/snes9x/blob/master/memmap.cpp#L2812
2020-11-06 15:04:28 +11:00
Tim Allen 216bcee66b nall: Support all the names endian.h provides on common platforms.
Also, moved the snippet that includes endian.h beneath the "Endian detection"
header, since I think it fits more neatly there.

Fixes #77.
2020-11-04 15:50:23 +11:00
asuramaru 6b38388a67 I have added comments to clarify the unknown behaviors that remain.
Specifically, we don't know what happens when reading from 4016-4017 or 4218-421f, or when writing to 4016 or 4200, during the auto joypad polling sequence.
Presumably, nothing good.
2020-10-29 15:24:40 +11:00
Asura 42f9e68fb2 Update timing.cpp
I have updated the comment to reflect the new stepOnce() name, instead of the older step() name.
2020-10-29 15:24:40 +11:00
asuramaru 39c37ec2d1 Fix SNES auto-joypad polling
anomie's notes indicate that polling begins between cycles 32.5-95.5, but his
notes were slightly off. 32.5-95.5 is referring to the PPU dot clock. If you
multiply by 4 you get the cycle count, 130-382. It's pretty clear that in
256-cycle units, that would need to be 130-384 or you'd have no event when it
lands on cycle 384. Jonas Quinn confirmed that with his testing in any case.

I chose to split the cycle range in half and run things every 128 clocks. So
that reduces us to 32.5-64.0, or 130 to 256 + 258-384. The reason I chose 128
over 256 was so I could emulate the time it takes to perform the joypad
latching. I don't believe you can set the controller latch to 1 and then 0
immediately. It needs time to let the controllers see this happening and then
release the latch, and time to let that take effect. Polling the controllers is
only one operation so it makes sense that happens once every 256 cycles, which
is why I have the (counter&1) test for that.

Think about it this way: we know the polling sequence takes 4224 cycles, and
4224/256 is 16.5. Isn't that a little strange to have half a cycle? But if we
consider the latching is actually twice as fast, then it's 2x128 + 16x256. If we
run on a 128-clock counter, it becomes 2x128 + 16x2x128, or 34 total states. But
now since we don't actually poll on the second half of each 16x2x256 states, we
don't need to bother running the event there, so we can stop at 33 instead of 34
and it's the same thing. And by doing that, it turns our polling duration into
4224 cycles, just like we've observed.

Fixes #61.
2020-10-29 15:24:40 +11:00
jsd1982 9d262ed113 nall: fix bad memory access pattern in string.format 2020-10-28 18:35:28 +11:00
Tim Allen ac37afd153 Use byuu.org/bsnes as the official homepage.
Previously, we didn't have control of byuu.org and it wasn't obvious what we
should do about hosting. Now we can update byuu.org, though, we should continue
using it as the authoritative source information.

Fixes #2.
2020-10-27 23:21:19 +11:00
Tim Allen f09c45f3e4 Fix region auto-detection when using native file dialogs.
hiro has two confusingly-named file-picker dialogs. "BrowserDialog" is the
custom dialog built entirely with hiro widgets, "BrowserWindow" is a wrapper
around the native file-picker. bsnes is built for BrowserDialog, but if you tick
"Use native file picker" in the Emulator options, when it needs a file it will
construct a BrowserDialog, copy the relevant config options across to a new
BrowserWindow and invoke that.

Unfortunately, BrowserDialog and BrowserWindow have different capabilities.
Specifically, BrowserDialog includes an "options" list which bsnes uses to let
the user override region detection when loading a game. BrowserWindow has no
such widget. Thus, when using a BrowserDialog the options list worked as intended,
but when using a BrowserWindow the options list was never initialised and no
option was ever chosen. As a result, when opening a game with the native file-
picker, bsnes always used NTSC emulation mode, instead of auto-detecting.

Previously, constructing a BrowserDialog and calling setOptions would leave the
BrowserDialog in an inconsistent state (with no option selected). This was OK if
you immediately displayed the dialog to the user (this would complete the
initialisation and choose a default), but bsnes also used BrowserDialog as an
*interface* typee, to represent the parameters and results of a file-picker
operation that was implemented elsewhere. For this use-case, the inconsistent
state caused problems.

Therefore, BrowserDialog has been changed:

  - setting the list of options always chooses a default, maintaining the
    invariant that `.options()` always returns one of the available options.
  - The internal BrowserDialogWindow class now takes a reference to a Response
    object, instead of constructing one from scratch and having to duplicate
    the "set .option to a reasonable value" code.

Fixes #44.
2020-10-27 23:20:56 +11:00
Tim Allen 090b79b3be Strip whitespace and empty lines from the cheat editor.
Previously, bsnes would turn the cheat text into a list of cheats by splitting
on '\n', producing an empty "cheat" after the last line of the editor:

    "7e0003=00\n".split("\n") -> ["7e0003=00", ""]

That empty "cheat" is not a valid cheat, so the result would be marked invalid.
Teaching bsnes to silently skip empty lines worked, but it would preserve
multiple blank lines between two cheats, which was silly.

Now we iterate over all the lines of the cheat editor, putting valid codes in a
new vector, and setting a flag for invalid codes.

Fixes #63.
2020-10-21 16:39:39 +11:00
John Chadwick 968e6b5feb Implement GitHub Actions Based CI.
This is lightly adapted from the implementation in Higan. For more
information, see that PR in higan-emu/higan#118.

The main difference is that we only compile one binary here, and
packaging is similar to (but adapted from) packaging byuu.
2020-10-19 17:37:02 +11:00
Tim Allen 1f943663b8 C89 requires __STDC__ to be defined, but not __STDC_VERSION__
gcc defines it anyway, but clang doesn't.

Fixes #22.
2020-10-17 10:46:43 +11:00
Lior Halphon 03cbab2f85
Windows is no longer officially supported in the standalone builds 2020-10-15 19:21:37 +03:00
Lior Halphon 1936dd7f67
Merge pull request #304 from JL2210/rgbds-link
Update RGBDS links in README and build-faq
2020-10-14 01:22:21 +03:00
James Larrowe 6e0c09f78c Update RGBDS links in README and build-faq
The repo's owner has changed twice since this link was used;
once from bentley to the neutral rednex organization, and then
from rednex to gbdev
2020-10-13 18:19:29 -04:00
Tim Allen e866a909dc Apply bsnes' customisations back on top of the upstream SameBoy source.
This includes changes to SameBoy (updating the README to be clear about
provenance, and adding a GNUmakefile to integrate with bsnes' build system),
updates the SameBoy version number in the about box, and adds SameBoy to the
list of subtrees updated by update-subtrees.sh.
2020-10-12 18:40:44 +11:00
Tim Allen ec18efcb04 Add 'bsnes/gb/' from commit '919a88ec23f8011dd0389a4abceb62b3d0c83e00'
git-subtree-dir: bsnes/gb
git-subtree-mainline: 844e23d0f4
git-subtree-split: 919a88ec23
2020-10-12 16:43:40 +11:00
Tim Allen 844e23d0f4 Remove old SameBoy snapshot. 2020-10-12 16:41:26 +11:00