Commit graph

2212 commits

Author SHA1 Message Date
393dc44ac2 Added environment variables to toggle different parts of the UI off 2021-04-30 16:03:45 -04:00
Ilari Liusvaara
aa190c9f92 Uncached LRGB->RGB conversion
The new LRGB->RGB conversion is in speed comparable to array lookup,
so instead of precomputing the palette and then looking up values, just
recompute the conversion for each pixel.
2021-02-16 14:56:59 +02:00
Ilari Liusvaara
b0809e58ed Optimize the LRGB->RGB conversion
Turns out the rescaling expression can be expressed in form A*x+B
followed by bitshift for all 217 possible values of x. And while at
it, use templates to merge most of the locolor/hicolor conversion
functions.
2021-02-16 14:56:48 +02:00
Ilari Liusvaara
8d1889c116 Revert initializing globalwrap state
Leave globalwrap state as uninitialized, even if that causes a compile
warning as initializing breaks AVI dumping on Windows. All globalwraps
should have static storage duration anyway, and C++ can not have
uninitialized variables with static storage duration.
2021-02-15 23:31:14 +02:00
Ilari Liusvaara
b642237e96 SNES: Actually make L=0 be full black
Turns out there are three copies of LRGB->RGB routine (two 8-bit and one
16-bit). Merge the 8-bit ones and remove L+1 causing L=0 to be not fully
black. Fixes fade afterimages in Super Mario World.
2021-02-13 14:54:15 +02:00
Ilari Liusvaara
fb28e30fcc Fix Lua register* callback list corruption
Turns out nothing was setting the prev pointer on doubly linked list when
creating callback nodes, so Lua GC'ing any node from the middle corrupted
the list, leading to unregister* intermittently failing to actually
unregister the callback.
2021-02-10 08:46:08 +02:00
Ilari Liusvaara
6fb4e1396d Lua: Delay freeing callback handles if executing
If callback is executing, its callback handle must not be freed as freeing
it would trigger UAF. So if currently running callback is unregistered,
delay freeing the handle until the callback finishes running.
2020-10-15 15:34:06 +03:00
Ilari Liusvaara
dfcba814a9 At least compile with Lua 5.4 2020-09-28 23:40:32 +03:00
Ilari Liusvaara
79c5bacb0c Allow loading raw input from zip file
No good reason not to allow this.
2020-09-28 23:39:36 +03:00
Ilari Liusvaara
48029eb1c8 Builtin r16m dumper
Deals with the usual SNES cases, and some unusual things like split
subframes, but does not deal with things like Super Game Boy.
2020-09-28 23:38:46 +03:00
Ilari Liusvaara
4312be19e5 Fix a few compiler warnings in GCC 9
Apparently GCC 7 is EOL in Debian testing.
2020-06-07 15:45:14 +03:00
Ilari Liusvaara
f537f4943c Lua: Guard against Lua returning non-string error
Turns out that if Lua throws e.g. a table as error, tostring (and
tolstring) returns NULL. And trying to print NULL into message stream
causes it to hang). Guard against tolstring returning NULL, and print
(null) instead of trying to print the NULL pointer.
2020-04-05 20:55:44 +03:00
Ilari Liusvaara
1b582c8fbd Allow just-in-time override of input to be recorded from Lua
This is useful e.g., for implementing .r16m playback.
2020-03-31 18:22:39 +03:00
Ilari Liusvaara
1fe5434797 Adjust SNES luminosity curve to start from zero
The existing luminosity curve does not start from zero, which causes
graphical issues with some games (screens that should be black not being
black).
2020-02-26 06:36:09 +02:00
Ilari Liusvaara
f37bcfbd49 Remove Mac OS support 2019-12-11 21:30:15 +02:00
Ilari Liusvaara
88160be520 Fix crash if selected settings window does not open
If one tries to open a setting window, the emulator grabs the input.
However, if opening the window then fails (most commonly because it is
joystick settings window, and there are no online nor offline gamepads)
the grab needs to be undone because otherwise the grab will point to
freed memory. The destructor would undo it, except failure to open window
triggers exit from constructor by exception, in which case destructor
will not run.

Bug reported on IRC.
2019-06-24 22:16:15 +03:00
Ilari Liusvaara
d4003f9d6c Squash some warnings in GCC 7.x
Not all warnings were squashed, some seem impossible to sanely fix,
e.g. warnings about not using some function that is used in another
compilation unit, or C++17 changing name mangling of some things.
2019-04-29 21:44:41 +03:00
Ilari Liusvaara
436b1d183d Remove partial exception specifiers
These are deprecated in newer C++ versions.
2019-01-30 19:26:21 +02:00
Ilari Liusvaara
da27ae0ce3 lsnes rr2-β24 2018-12-31 21:07:40 +02:00
Ilari Liusvaara
05cf036201 movie.get_last_movie()
This only works with movies loaded from files (e.g. not newly created
movies or movies downloaded via HTTP).
2018-11-25 18:55:16 +02:00
Ilari Liusvaara
5b03d319b6 Fix bogus ROM type mismatch when using --rom 2018-07-19 14:19:33 +03:00
Ilari Liusvaara
7d9b3e93ec Track all window size changes while in fullscreen 2018-01-08 04:24:45 +02:00
Ilari Liusvaara
3dee7b756a Delay committing fullscreen until seeing window size change
Hopefully gets rid of race condition in fullscreening the emulator.
2018-01-08 01:51:43 +02:00
Ilari Liusvaara
323db52b6b Add <functional> to files that use std::function 2017-10-26 04:41:20 +03:00
Ilari Liusvaara
f49b82c989 Bus fixes: Reading of CPU MMIO registers does not update MDR
Also fixes controller timings to be more realistic.
2017-10-25 14:22:19 +03:00
Ilari Liusvaara
6fd18bd0f0 Make wrapper for boost::lexical_cast
This makes it easier to eventually get rid of boost::lexical_cast.
2017-10-25 14:11:43 +03:00
Ilari Liusvaara
b5f3e543d8 De-header SNES games with headers submultiple of 512 bytes correctly 2017-08-30 19:06:51 +03:00
Ilari Liusvaara
4c6338888d Save: Fix issues with adding an extension if missing
- The code should search for the last '.', not the first.
- Case-insensitively compare the extensions.
2017-08-08 09:48:53 +03:00
Rodrigo A. do Amaral
9318e4de94 Lua (d)bitmap: add hflip and vflip functions 2017-07-14 06:07:03 +03:00
Ilari Liusvaara
298610752b Specialize (D)BITMAP:sample_texture when s is power of two 2017-07-13 20:27:38 +03:00
Ilari Liusvaara
f85cdab6c5 Linear transformed texture sampling for (d)bitmap 2017-07-13 15:44:52 +03:00
Ilari Liusvaara
dd18168993 Fix few uninitialized variables and a stack smash in AVI dumper
- Fix uninitialized closed flag in avi_worker
- Fix uninitialized stream parameters in avi_writer
- Fix stack smash in AVI write_pkt (the padding is only 2 bytes, don't
  write an u32 into it!)
2017-05-29 17:32:09 +03:00
Ilari Liusvaara
7be5215c08 When redrawing screen, read the last written frame
This should fix the bug with loadstates, where wrong screenshot was
displayed in certain race condition.
2017-05-23 11:11:32 +03:00
Ilari Liusvaara
8ac8304824 Lua: Fix type confusion between signed and unsigned
This bug seemed to cause all hell to break lose with negative numbers
2017-04-18 19:25:07 +03:00
Ilari Liusvaara
c2e40c4cd3 Support uncompressing ZIP compression method 12 (bzip2) 2017-02-05 17:15:57 +02:00
Ilari Liusvaara
669381821e PIX_FMT_* constants are deprecated, use AV_PIX_FMT_* instead 2017-01-24 16:28:57 +02:00
Ilari Liusvaara
c5d441c6b0 Fix crash if text containing \n is printed at nonzero x 2016-09-18 23:00:13 +03:00
Ilari Liusvaara
5544b9ba12 Don't try to enter loadstate with loadstate already in progress 2016-08-09 18:59:25 +03:00
Ilari Liusvaara
4c9bb20270 Fix crash if mouse_x or mouse_y are hooked
Turns out framebuffer draw recalibrates mouse_x and mouse_y, which then
calls into hook. Which is no-no, because framebuffer draw runs in GUI
thread, and hooks must run in game thread.
2016-07-23 11:16:34 +03:00
Ilari Liusvaara
eb6ff6c38b Virtualize audio system for instances 2016-04-17 10:14:05 +03:00
Ilari Liusvaara
7903ba1fda Small cleanup: move up some lsnes_instance stuff 2016-04-16 10:51:02 +03:00
Ilari Liusvaara
40ac5d56e3 Some new hotkeys
- Flush slotinfo cache
- Reload current ROM
- Close current ROM
- Increase speed
- Decrease speed
2016-04-15 12:50:15 +03:00
Ilari Liusvaara
a3f1d7c8a4 Lua Add getters for various paths 2016-04-15 09:18:48 +03:00
Ilari Liusvaara
d287f64c14 Allow modifying button to be autofire/autohold/typed 2016-04-14 20:22:13 +03:00
Ilari Liusvaara
62ee8b0039 Don't try to uninstall handlers for active core
Should stop the Gambatte/Bsnes SGB core from crashing on exit.
2016-01-01 08:01:16 +02:00
Ilari Liusvaara
05ad5b9da1 Fix "empty path points to root" bug
Unset paths are supposed to point to the current directory, not the
root.
2016-01-01 07:57:48 +02:00
Ilari Liusvaara
019fbc2646 bsnes: Add Lua function to dump 2bpp sprites (and allow 4-color palettes) 2015-12-29 03:01:46 +02:00
Ilari Liusvaara
3da2e26e1b Add bit.fextract, bit.bfields 2015-12-24 21:26:12 +02:00
Ilari Liusvaara
610685db0f Fix Valgrind warning about uninitialized variable 2015-12-15 04:17:53 +02:00
Ilari Liusvaara
6a580bb332 Add regex sanity checks on startup and add --sanity-check 2015-12-15 04:17:11 +02:00