Commit graph

811 commits

Author SHA1 Message Date
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
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
f37bcfbd49 Remove Mac OS support 2019-12-11 21:30:15 +02: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
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
323db52b6b Add <functional> to files that use std::function 2017-10-26 04:41:20 +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
Rodrigo A. do Amaral
9318e4de94 Lua (d)bitmap: add hflip and vflip functions 2017-07-14 06:07:03 +03:00
Ilari Liusvaara
f85cdab6c5 Linear transformed texture sampling for (d)bitmap 2017-07-13 15:44:52 +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
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
d287f64c14 Allow modifying button to be autofire/autohold/typed 2016-04-14 20:22:13 +03: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
6a580bb332 Add regex sanity checks on startup and add --sanity-check 2015-12-15 04:17:11 +02:00
Ilari Liusvaara
918dc6db7b Fix gamepad reset
Don't create duplicate keys for gamepads during reset (causing those
keys to stop working) and properly offline all buttons and axes in
gamepad that is offlined.
2015-08-01 00:25:37 +03:00
Ilari Liusvaara
6d1a67719b Add movie.subframe_to_frame 2015-07-03 22:24:47 +03:00
Ilari Liusvaara
4a4c71acf4 ss_int24_t and ss_uint24_t are integers
Fixes memory.readhword pushing the result as a float instead of integer.
2015-06-27 02:45:43 +03:00
Ilari Liusvaara
859d60513f Merge some common drawing code between bitmaps and tilemaps 2015-06-23 14:46:14 +03:00
Ilari Liusvaara
7ada70888f Cleanup bitmap and tilemap rendering a bit 2015-06-23 14:32:59 +03:00
Ilari Liusvaara
0b3743e258 Lua: CUSTOMFONT:dump(): Dump font to file
This can be used in conjuction with edit() method for editing fonts and
then dumping those back into file.
2015-06-11 05:31:23 +03:00
Ilari Liusvaara
d86f713aa4 Eliminate sloppy types from headers
This should give identical layouts on all platforms (modulo 32/64 bit)
2015-06-07 12:49:19 +03:00
Ilari Liusvaara
1c48e0ab06 Fix multiple problems with text drawing
- Fix the background to be of correct size
- Fix pre/post error in gui.text() positioning
- Fix pre/post error in custom font rendering, leading to crap pixels
2015-06-04 02:01:43 +03:00
Ilari Liusvaara
2da23de987 Small whitespace cleanup 2015-05-27 23:08:54 +03:00
Ilari Liusvaara
0d83c3aba6 Rework how memory tracking works
Also adds a few new tracking categories, like movie storage
2015-05-27 17:59:00 +03:00
Ilari Liusvaara
0960e967ea Memory tracker: Add tracking of render objects 2015-05-27 16:28:01 +03:00
Ilari Liusvaara
c2a7eed9d8 Clean up system font drawing
Refactor font reading to fewer places
2015-05-27 15:38:22 +03:00
Ilari Liusvaara
1dd19faaeb Make git diff --check happier 2015-05-27 11:14:56 +03:00
Ilari Liusvaara
0c0156647b Redo text rendering (adds halo support to gui.text())
Now gui.text() and friends support halos. Also fixes a bug with partially
opaque halos in CUSTOMFONT rendering.
2015-05-27 10:44:50 +03:00
Ilari Liusvaara
56deafcd4a Framework for memory usage tracking
Adds tracking for Lua VM and ROM images. The rest comes later.
2015-05-26 13:16:09 +03:00
Ilari Liusvaara
82a7c255a4 Lua: Memory usage limit
This allows limiting memory usage by Lua, which might very well be useful,
given the behaviour of accumulating garbage in memory if one does not
garbage-collect.
2015-05-25 23:44:51 +03:00
Ilari Liusvaara
478472e883 Have only one main Lua function trampoline
This makes it easier to have special modes when Lua functions are running
later...
2015-05-25 21:16:45 +03:00
Ilari Liusvaara
04d7e60fe1 Fix race between killing object and drawing object
Previously, it was possible to draw and kill object queue at the same
time, possibly leading to crashes from accessing object state after
destroying it. Fix this.
2015-05-14 19:20:21 +03:00
Ilari Liusvaara
eeaf3706d8 Add dedicated method for resetting to poweron state
This speeds up "rewind to beginning" operation.
2015-04-27 10:03:28 +03:00
Ilari Liusvaara
17efbec1a6 Clean up dynamic state handling a bit 2015-04-25 15:51:18 +03:00
Ilari Liusvaara
39286f820a Refactor unsafe rewinding a bit now that state is its own subobject 2015-04-25 13:18:37 +03:00
Ilari Liusvaara
653f44e353 Refactor dynamic state to its own subobject
This is meant as base for further refactoring
2015-04-14 15:39:50 +03:00
Ilari Liusvaara
a45baf5559 Mark the core methods that should be idempotent as const 2015-04-14 13:06:13 +03:00
Ilari Liusvaara
3571fb3e08 Refer to loaded ROM imagesets as handles 2015-04-14 12:34:19 +03:00
Ilari Liusvaara
b7aedc6cd9 Internally refactor loaded ROM imageset out of loaded ROM code 2015-04-14 11:25:10 +03:00