Compare commits

...

1286 commits

Author SHA1 Message Date
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
Ilari Liusvaara
fa3e5b6751 Nuke last remains of boost::regex from outside string.cpp 2015-12-11 19:42:35 +02:00
Ilari Liusvaara
813449ac1b Fix compilation with Lua 5.1
Apparently Lua 5.1 doesn't have LUA_OK (0).
2015-11-05 00:22:11 +02:00
Ilari Liusvaara
ff697846d1 Fix crash if loading type0 PNG without tRNS chunk 2015-10-26 21:38:36 +02:00
Ilari Liusvaara
476f79f14a Fix disassembly of SNES BRL instruction 2015-10-26 21:20:25 +02:00
Ilari Liusvaara
e9e00fd881 Fix help for +tangent/-tangent to be less obscure 2015-10-04 05:31:11 +03:00
Ilari Liusvaara
51bbbd1772 When loading gamepaks, use #1 as MSU-1 base only if system has BIOS 2015-09-07 21:01:15 +03:00
Ilari Liusvaara
1834c61dfb Fix MSU-1 bug where write to MSU1BASE+4 is mirred to MSUBASE+5 2015-09-07 20:52:01 +03:00
Ilari Liusvaara
5ab3b133a4 Fix bsnes compilation for GCC 5.X 2015-08-08 11:13:39 +03: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
97ba0292d6 Fix crash on loading invalid PNG files
(Just a divide by zero)
2015-07-25 17:23:59 +03:00
Ilari Liusvaara
d8048863e8 movie::frame_subframes: Gracefully handle invalid frame numbers
Doesn't fix cache invalidation errors tho.
2015-07-04 12:18:11 +03:00
Ilari Liusvaara
6d1a67719b Add movie.subframe_to_frame 2015-07-03 22:24:47 +03:00
Ilari Liusvaara
5e73a844a9 Fix do_load_rom() in readonly case 2015-06-29 20:56:04 +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
957738035f Use standard bitmap composition for rendered text bitmaps 2015-06-24 12:54:45 +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
250679f656 Merge remote-tracking branch 'origin/master' 2015-06-23 13:46:21 +03:00
Ilari Liusvaara
2e609624fa Remove bogus comments in gui-tilemap.cpp
size_t can't overrun as a pointer.
2015-06-23 13:45:47 +03:00
Ilari Liusvaara
daa5ca41e9 Close the ROM on quit to avoid crashes 2015-06-21 09:12:03 +03:00
Ilari Liusvaara
4a4004d3f8 Fix build breakage on Win32 2015-06-16 21:23:14 +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
73e0232176 Don't crash on trying to create 0x0 bitmap or tilemap 2015-06-10 19:20:44 +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
52073af3ac Fix load preserving movie displaying wrong screenshot 2015-06-05 01:06:53 +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
c5b368ab3f Lua: get_directory_contents & get_file_type
Useful for reading contents of directories
2015-06-02 08:38:55 +03:00
Ilari Liusvaara
1056f4b4b2 Don't overflow buffers if bsnes goes bonkers
The test state I got by corrupting savestate still crashes however.
2015-05-31 23:45:02 +03:00
Ilari Liusvaara
80867950f3 lsnes rr2-β23 2015-05-28 12:41:52 +03:00
Ilari Liusvaara
88a00a2a84 Some new TODOs 2015-05-28 12:37:40 +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
8bca9ce614 Remove TODO list entry now done 2015-05-27 10:49:58 +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
6a2d7f9aa2 Use master state for trampolines
Fixes memory corruption if any Lua function creates a trampoline
2015-05-25 22:31: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
f06eb401c4 font rendering: Use ranges for bounding instead of buggy routine
This fixes the drawing junk problem if character is drawn off top or
off left.
2015-05-20 08:51:14 +03:00
Ilari Liusvaara
f04379b03c Actually kill objects using palette about to be GC'd 2015-05-14 20:37:23 +03:00
Ilari Liusvaara
a8bc4a2cf8 Small rendering speedups
Pass the object pins as references instead of values. Saves about
150 CPU cycles per value for me.
2015-05-14 20:04:41 +03:00
Ilari Liusvaara
ae71090387 Fix a compiler warning
The warning is false, init of spd can't be avoided if is_string=false.
2015-05-14 19:53:33 +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
15ff9e0cc8 Don't leak open file descriptors to loaded ROMs 2015-05-09 19:16:44 +03:00
Ilari Liusvaara
8a794244be Fix typo in Lua reference 2015-05-08 01:10:12 +03:00
Ilari Liusvaara
10eb0dbd22 Add description of PALETTE:get() 2015-05-03 02:24:11 +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
9aa8578e74 Circle coordinates can go negative and thus must be signed
Fixes the bug where only one fourth of circle was drawn.
2015-04-27 08:20:26 +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
4d3d483a34 A bit of code cleanup 2015-04-14 12:40:57 +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
Ilari Liusvaara
1bf49d532d Move NULL core code to its own file 2015-04-14 10:27:35 +03:00
Ilari Liusvaara
a6b7391da5 Refactor loaded_rom to make public fields private 2015-04-14 10:21:31 +03:00
Ilari Liusvaara
8af9dda77f Fix speed going out of whack after doing unsafe rewind 2015-04-12 23:10:57 +03:00
Ilari Liusvaara
a1b96d75da Split overly large loaded_rom constructor 2015-04-11 20:31:23 +03:00
Ilari Liusvaara
2842b76907 Add load-rom command
This is not really complete: There are three ROM load modes, this is just
one of those.
2015-04-11 06:01:20 +03:00
Ilari Liusvaara
c51cfe9099 Add back reload-rom and close-rom
These commands have seemingly gotten lost somewhere
2015-04-11 04:37:39 +03:00
Ilari Liusvaara
71d649c487 Remove some unnecressary casts 2015-04-10 23:01:07 +03:00
Ilari Liusvaara
ae3cb19a03 SNES: Functions for messing with clockrate (for debugging games) 2015-04-09 04:18:59 +03:00
Ilari Liusvaara
f2169b725f Don't callback to Lua in inconsistent state when loading a new ROM 2015-04-09 04:18:05 +03:00
Ilari Liusvaara
046bc221ef Lua: movie.get_game_info 2015-04-04 22:22:33 +03:00
Ilari Liusvaara
5f0d5dcdb0 Wxwidgets: Fix some compile errors in window-fileupload.cpp 2015-04-04 00:52:48 +03:00
Ilari Liusvaara
3eb7585947 Wxwidgets: Fix some compile errors in editor-memorywatch.cpp 2015-04-04 00:24:49 +03:00
Ilari Liusvaara
d7744e00e7 Wxwidgets: Fix § 2015-03-23 19:31:54 +02:00
Ilari Liusvaara
52dff27f3e Wxwidgets: Add keycode entries for å, ä and ö
Allows these keys to be used as bindings, hotkeys or controller keys
2015-03-21 17:33:10 +02:00
Ilari Liusvaara
93875839b9 bit.(r)flagdecode: Fix unicode in on/off strings 2015-03-11 03:18:49 +02:00
Ilari Liusvaara
929155f14d Fix typo in resolve_filename documentation 2015-03-10 22:40:13 +02:00
Ilari Liusvaara
63b59e35f7 Lua: Don't run class destructor if constructor failed 2015-03-04 22:34:03 +02:00
Ilari Liusvaara
aade7a9fb8 Fix race condition in do_mix_tsc()
The lock needs to protect count from concurrent update. Especially since
if double increment happens in the wrong place, the routine starts
scribbling memory until whole thing crashes.
2015-03-04 21:48:14 +02:00
Ilari Liusvaara
fd65e1e435 Fix hostendian memory watches 2015-02-27 19:02:43 +02:00
Ilari Liusvaara
8e95c54d68 Throw mic in to entropy pool 2015-02-27 19:02:25 +02:00
Ilari Liusvaara
e3fc1ed5fa Make gitlinks for bsnes and gambatte
HTTP Code 418...
2015-02-14 10:05:52 +02:00
Ilari Liusvaara
94170ec2d5 wxwidgets: exit-fullscreen to forcibly exit fullscreen mode 2015-02-14 01:45:43 +02:00
Ilari Liusvaara
ea78fecb1b Force a repaint when becoming fullscreen
Fixes game screen when fullscreen is entered with game pauses
2015-02-14 01:25:17 +02:00
Ilari Liusvaara
19b12b1215 Lua: movie.get_rom_info() 2015-02-13 22:49:43 +02:00
Ilari Liusvaara
4e70e95e7f Lua: movie.rom_loaded() 2015-02-13 22:18:44 +02:00
Ilari Liusvaara
8967f3a261 Lua: input.controller_info(): Don't crash with out-of-range port 2015-02-13 22:01:26 +02:00
Ilari Liusvaara
7ece85f0c6 Fix movie length being wrong for imported binary tracks 2015-02-13 08:55:53 +02:00
Ilari Liusvaara
5f8f8af25f Implicitly redirect cmdhelp includes to corresponding JSON files
This should help with the superfluous building due to cmdhelp.
2015-02-12 21:56:19 +02:00
Ilari Liusvaara
c86f10376a Force game panel to window size in fullscreen mode
This should fix fullscreen mode on Win32.

Also properly letterbox the screen when in fullscreen mode
2015-02-12 16:11:12 +02:00
Ilari Liusvaara
791684edc3 wxwidgets: Hide dumper called "NULL"
This is not working dumper (it is meant for PGO using lsnes-dumpavi),
so don't show it.
2015-02-12 13:16:56 +02:00
Ilari Liusvaara
ff1004d7fa If initsram/initstate points to LSS file, pull the matching member 2015-02-12 01:40:36 +02:00
Ilari Liusvaara
bdcf21a4e1 Movie editor: Fix unnamed branch to show properly in select branch 2015-02-12 00:38:07 +02:00
Ilari Liusvaara
95ec8a8ba7 Lua: add gui.get_runmode() 2015-02-11 21:24:06 +02:00
Ilari Liusvaara
5c0f57448c Add a internal TODO list 2015-02-08 18:11:51 +02:00
Ilari Liusvaara
773e84cfd7 Movie editor: Don't lock up on trying to display error messages 2015-02-08 18:02:33 +02:00
Ilari Liusvaara
44aa95cc57 Switch to std::regex by default 2015-02-07 15:32:34 +02:00
Ilari Liusvaara
54cbe456b4 Move all regex matching to library/string.cpp
This is in preparation to having an option to use std::regex. Also should
fix a few bugs with trace log.
2015-02-07 14:37:18 +02:00
Ilari Liusvaara
94b603c9f2 Fix some compilation errors on Mac OS X 2015-02-04 21:28:25 +02:00
Ilari Liusvaara
1cb702bd5e NULL video dumper
Might be useful for abusing dumpavi for running emulation without UI
and to have autoexit.
2015-02-02 22:00:23 +02:00
Ilari Liusvaara
7c7ee6637d Fix scaling-related crashes
Turns out libswscale scribbles past end of buffer, so allocate some extra
scratch space.
2015-01-31 01:38:57 +02:00
Ilari Liusvaara
5f0b9e3315 Fix race condition in makefile 2015-01-31 01:37:22 +02:00
Ilari Liusvaara
58e4ad1b94 Show error instead silently failing tangent positive edge
If there is no file to save the stream to, tangent positive edge used to
silently fail. Fix it to show error message.
2015-01-30 20:18:18 +02:00
Ilari Liusvaara
2312324824 Only exit poll advance on poll to non-00 control 2015-01-30 19:45:46 +02:00
Ilari Liusvaara
8d5783536a Fix CUSTOMFONT text positioning
Coordinate system is supposed to be relative to game area, not draw
area.
2015-01-30 09:42:35 +02:00
Ilari Liusvaara
6e80331962 Remember video settings 2015-01-30 02:30:47 +02:00
Ilari Liusvaara
538128686a Remember volume settings across restarts 2015-01-30 02:16:08 +02:00
Ilari Liusvaara
d507a05237 keymapper: Verify gamepad config write before committing 2015-01-30 01:54:28 +02:00
Ilari Liusvaara
b3c0fc76f9 Makefile: Build cmdhelp before anything else
This should hopefully reduce strange rebuilding going on with cmdhelp
2015-01-28 17:06:51 +02:00
Ilari Liusvaara
7584121717 Add $LSNES_NO_SOUND_IN to disable sound input
It seems that sound input sometimes causes crashes and lockups on
start-up.
2015-01-28 17:01:30 +02:00
Ilari Liusvaara
792bb0867e Lua: Don't lua_error() out of context with pending dtors
That likely would cause memory leaks. Also make a commit in order to
tell apart rr2-β22b1 from rr2-β22.
2015-01-28 13:07:50 +02:00
Ilari Liusvaara
43e2ce5906 lsnes rr2-β22 2015-01-24 17:14:01 +02:00
Ilari Liusvaara
d4c6bd3bbd bsnes: Support IRQ/NMI tracing 2015-01-24 16:48:40 +02:00
Ilari Liusvaara
162a57c950 bsnes: DMA tracing 2015-01-20 10:36:22 +02:00
Ilari Liusvaara
2f9782fd9c Fix bad download crashing the emulator
Turns out the way download timer was stopped was buggy and crashed the
emulator in some cases (especially if download failed or couln't be
loaded).

Abuse the focus timer to clean up download timers, so to avoid timer
stopping and cleaning up itself.
2015-01-19 12:28:02 +02:00
Ilari Liusvaara
8403744ba6 Pluginmanager: Autocreate directory instead of crashing
Pluginmanager was crashing the emulator if opened without autoload
directory existing. Fix it to create the directory (and not crash the
emulator if this fails).
2015-01-19 06:27:10 +02:00
Ilari Liusvaara
0346a1ea3e Readd rule for font.cpp.dep in different way
Turns out Win32 build broke from removing font.cpp.dep
2015-01-17 09:37:38 +02:00
Ilari Liusvaara
94732b0bc4 Remove target for font.cpp.dep
This was causing build failures
2015-01-17 09:26:12 +02:00
Ilari Liusvaara
d09d301849 Add commands and Lua functions to manipulate running speed 2015-01-17 09:25:50 +02:00
Ilari Liusvaara
ac51bf61e8 Clean up all build helper programs on make clean 2015-01-16 05:45:05 +02:00
Ilari Liusvaara
201d65116a Fix compile error with Lua 5.1 2015-01-14 03:29:06 +02:00
Ilari Liusvaara
346ea41e0d Fix Win32 build 2015-01-13 22:49:32 +02:00
Ilari Liusvaara
680be72a8f Add wide (64 bits) versions of bit functions if Lua 5.3 is used 2015-01-06 19:20:25 +02:00
Ilari Liusvaara
71b57756ca Cleanup Lua multiversion support 2015-01-06 08:13:10 +02:00
Ilari Liusvaara
f4c1bc6e84 Lua 5.3 support 2015-01-06 05:19:39 +02:00
Ilari Liusvaara
50fd1b6b5f Don't let one unload currently used core (crashes the emulator) 2015-01-06 02:55:03 +02:00
Ilari Liusvaara
aff0370e35 Show error from Lua if parsing Lua expression fails 2015-01-03 02:24:38 +02:00
Ilari Liusvaara
667f7df3c1 Don't use arbitrary garbage as amount of samples to squash 2015-01-02 02:37:03 +02:00
Ilari Liusvaara
f68459ac53 Ignore some build helper programs, now that the .exe rule doesn't cover those 2015-01-01 21:47:47 +02:00
Ilari Liusvaara
696cab4862 Fattest? Really? 2015-01-01 21:42:26 +02:00
Ilari Liusvaara
82b7c8d5e2 Use $DOT_EXECUTABLE_SUFFIX instead of hardcoding .exe 2015-01-01 21:41:39 +02:00
Ilari Liusvaara
16da5396aa Remove some utilities that should not be there anymore 2015-01-01 21:26:37 +02:00
Ilari Liusvaara
0e844d4720 Libao: Don't crash on quit 2015-01-01 21:09:09 +02:00
Ilari Liusvaara
9c484d819e Update the default build options
Remove references to SDL, which hasn't been supported for a while, make
bsnes default to compat and switch to std::thread by default
2015-01-01 20:34:02 +02:00
Ilari Liusvaara
4262be0b93 Exit immediately on double fault 2014-12-31 00:11:57 +02:00
Ilari Liusvaara
37d587da21 Fix some valgrind warnings 2014-12-30 23:59:17 +02:00
Ilari Liusvaara
5dedb34943 Lua: PALETTE:get() 2014-12-20 06:38:47 +02:00
Ilari Liusvaara
b074cb2e31 Fix some nondeterminism (probably wouldn't cause desyncs) 2014-12-19 18:12:43 +02:00
Ilari Liusvaara
0ae6981b5c Redraw framebuffer when entering break pause
Fixes memory watches with tracelogging.
2014-12-13 00:10:34 +02:00
Ilari Liusvaara
dc0a6e1282 Portaudio: Don't blacklist ALSA default/sysdefault for input 2014-12-11 08:50:27 +02:00
Ilari Liusvaara
386405aace Oops from previous commit 2014-12-11 08:21:32 +02:00
Ilari Liusvaara
0ea814c0c3 wxwidgets: Add some missing conversions for string arguments 2014-12-11 08:18:49 +02:00
Ilari Liusvaara
03a57aa421 runuifun: Allow marking cb routine to run once at a time 2014-12-10 08:55:02 +02:00
Ilari Liusvaara
4d86f19837 Add the UI thread checking code
Might still have some false positives.
2014-12-09 16:46:50 +02:00
Ilari Liusvaara
0e29ab43eb Memory editor: Squash another wrong-thread bug
This appears if ROM is loaded for any reason while memory editor is open.
2014-12-09 16:36:59 +02:00
Ilari Liusvaara
a98208c284 Squash some wrong-thread bugs 2014-12-09 13:33:28 +02:00
Ilari Liusvaara
4b44f8ee10 If project switch loads savestate, mark position at point of save 2014-12-04 22:21:41 +02:00
Ilari Liusvaara
b6349a0980 Fix error message if trying to load ROM with project active 2014-12-04 09:58:01 +02:00
Ilari Liusvaara
03de099aae Fix most hotkeys to show up in configuration (were missing due to errant !) 2014-12-03 08:50:52 +02:00
Ilari Liusvaara
8e6eb72351 Wxwidgets: Fix loading ROM from commandline 2014-11-28 18:51:28 +02:00
Ilari Liusvaara
d19d0e8945 Music playback: Guard against crazy pcmpos
Previously crazy pcmpos values could cause division by zero or signed
overflows.
2014-11-27 19:31:01 +02:00
Ilari Liusvaara
3146ec5352 Tracelogger: Unregister the frame callback even on hard kill
Fixes memory corruption if ROM is reloaded and then tracelogger window
is closed.
2014-11-27 16:44:58 +02:00
Ilari Liusvaara
60f9d3b217 bsnes: Add hcounter/vcounter registers 2014-11-24 12:42:29 +02:00
Ilari Liusvaara
514984671d Don't try to unregister killed debug CBs 2014-11-24 11:26:47 +02:00
Ilari Liusvaara
9fdd0bdd38 Tweak format of command help files and do some further command cleanup 2014-11-18 16:19:01 +02:00
Ilari Liusvaara
028a51066c Show VMA relative hex address when dumping debug hook list 2014-11-18 07:43:05 +02:00
Ilari Liusvaara
4ab23cfeb4 Remove unused function 2014-11-17 21:39:47 +02:00
Ilari Liusvaara
5ddf119ef0 Reinitialize gamepads command and fix EVDEV going bonkers on gamepad suddenly disconnecting 2014-11-17 20:12:20 +02:00
Ilari Liusvaara
c68048d029 Module unloading: Small further cleanup 2014-11-17 18:52:27 +02:00
Ilari Liusvaara
15c57d7a8c Module unloading: Small cleanup 2014-11-17 18:48:13 +02:00
Ilari Liusvaara
3b2298180a Allow binding commands to class instance 2014-11-17 15:55:14 +02:00
Ilari Liusvaara
5ee7962cb9 Rudimentary library unloading support
Rather easy to crash the emulator with this, but...
2014-11-17 15:10:13 +02:00
Ilari Liusvaara
fb6d998d43 Memory watch fixes
- Fix editing existing watch
- Fix saving watch on rename in project context
2014-11-16 04:28:14 +02:00
Ilari Liusvaara
fe8b1166d4 Don't try to do controller runtime codegen on X32, it won't work 2014-11-14 16:05:19 +02:00
Ilari Liusvaara
42fef3336f gambatte fixes: Properly save MBC3 without RTC 2014-11-12 11:01:07 +02:00
Ilari Liusvaara
5cfa21b622 Add missing file 2014-11-12 10:40:26 +02:00
Ilari Liusvaara
b9131f852a Show error dialog if project switch fails 2014-11-12 00:12:42 +02:00
Ilari Liusvaara
b218c1aaa0 Allow memory watch to read registers 2014-11-11 20:56:54 +02:00
Ilari Liusvaara
c330c9c42a Fix crash if canceling load of other project 2014-11-11 18:54:02 +02:00
Ilari Liusvaara
212d554ad1 Split audioapi to core interface and driver interface parts 2014-11-10 19:52:10 +02:00
Ilari Liusvaara
e2589db8b7 Rename token_iterator_foreach to token_iterator::foreach 2014-11-10 16:54:18 +02:00
Ilari Liusvaara
b0c08d3a9f Make workthread a class in top namespace and move some stuff under it 2014-11-10 16:26:16 +02:00
Ilari Liusvaara
3c2b0402b2 Refactor memory_region{,_direct} to be subclasses of memory_space 2014-11-10 16:19:27 +02:00
Ilari Liusvaara
b5ed0f73b1 Refactor library GC to its own namespace 2014-11-10 16:06:04 +02:00
Ilari Liusvaara
9a69dc3511 Namespace library port-controller stuff 2014-11-10 05:13:34 +02:00
Ilari Liusvaara
6639ab0437 Refactor controller runtime code generation 2014-11-10 02:53:58 +02:00
Ilari Liusvaara
d32b1697a6 Music: Use all PSID LSIDs as implicit entrypoints (not just the first) 2014-11-05 19:34:57 +02:00
Ilari Liusvaara
0f51ad0b16 C interface: render_text (version bump to v2)
Bump C interface version to 2, in order to add render_text (render text
to bitmap, using system font
2014-11-02 15:01:57 +02:00
Ilari Liusvaara
1dd52cc68b Wxwidgets: --library=<filename> 2014-11-01 11:16:27 +02:00
Ilari Liusvaara
35f027fabf Library: Don't fail link without library support 2014-11-01 11:16:11 +02:00
Ilari Liusvaara
50215d8c01 Print messages about loaded libraries 2014-10-31 23:24:23 +02:00
Ilari Liusvaara
4318618a8f Lua: memory.action_flags
At least these can be used to get state of bsnes layer hide options
without using any bsnes lua...
2014-10-31 12:41:02 +02:00
Ilari Liusvaara
4c5b582796 Oggopus: Complain about single-dpage streams with bad granulepos 2014-10-19 02:40:07 +03:00
Ilari Liusvaara
a00d357bef Remember sound devices 2014-10-19 02:37:55 +03:00
Ilari Liusvaara
25d4f27a9b Remember sound device over sound restart 2014-10-19 02:21:06 +03:00
Ilari Liusvaara
ebb3676505 Fix jukebox slot select 2014-10-19 02:06:12 +03:00
Ilari Liusvaara
b91a6ad5f4 Add few extra sound commands
- Change playback device
- Change record device
- Show devices
- Reset audio driver (I am surprised this doesn't crash the emu)
2014-10-19 00:04:35 +03:00
Ilari Liusvaara
0a51f53abc Don't overdraw in outside draw
If skipping screen area and running out of draw window, don't draw any
more pixels in this line, instead skip to next line.
2014-10-17 23:50:20 +03:00
Ilari Liusvaara
833866cb1a Add -pthread to flags
Modern versions of binutils/gcc seem to need it or one gets undefined
references
2014-09-11 22:11:58 +03:00
Ilari Liusvaara
7893ed36e8 Fix emulator going out of whack after project load 2014-09-11 14:12:35 +03:00
Ilari Liusvaara
e3508934cd Commentary: Fix gain on oggopus export 2014-08-30 00:11:04 +03:00
Ilari Liusvaara
bf32d095a6 Small whitespace cleanup 2014-08-09 17:31:53 +03:00
Ilari Liusvaara
b7d0fe9eb1 Opus: Support some newly added stuff 2014-08-09 17:31:38 +03:00
Ilari Liusvaara
2087db93e2 25519: Add valgrind test mode 2014-08-09 17:30:55 +03:00
Ilari Liusvaara
5c84507e22 Revert "Remove Lua 5.1 support"
This reverts commit c87c5de458.
2014-08-08 04:04:14 +03:00
Ilari Liusvaara
72b5050a27 Lua: Initialize some variables in address.cpp to make GCC happy 2014-07-29 02:34:32 +03:00
Ilari Liusvaara
70b9d95c44 Fix some accidentially mistyped variables in makefile 2014-07-03 16:26:53 +03:00
Ilari Liusvaara
e4d6f3839b Fix loading lz images with 128 or more colors 2014-06-21 21:08:49 +03:00
Ilari Liusvaara
32d14ecfc0 Fix compilation on Mac OS X 2014-06-20 19:27:24 +03:00
Ilari Liusvaara
351d0d0282 Fix memory.writeregion 2014-06-16 12:39:22 +03:00
Ilari Liusvaara
f0233fb7f2 Fix build on GCC 4.9
Seems like GCC 4.9 likes to warn about unused functions:

- Remove unused function linintr_solve()
- Remove unused function endian_char()
- Remove unused function implode()
- Remove unused copy of function read_active_macros()
- Remove unused function format_type()
- Make function seemingly poking some stuff in int24.cpp global (never called)
- Remove unused data numbers_l
- Remove unused data numbers_u
- Remove unused function print_decimals()
- Remove unused function format_float_base()
- Remove unused function substr()
- Remove unused function get_levelsize()
- Remove unused function default_headersize()
- Remove unused function get_button_name()
- Remove unused function get_axis_name()
- Remove unused function pick_volume()
- Remove unused function UI_controller_index_by_logical()
- Remove unused function movie_path()
­ Remove unused function clear_clipboard()
- Remove unused function string_pad()
2014-06-16 12:39:14 +03:00
Ilari Liusvaara
e8fd0a29a4 bsnes: Fix on_latch in alttimings mode 2014-06-15 22:06:29 +03:00
Ilari Liusvaara
4a005292d7 Use UI_in_project_context() in branchesmenu.cpp 2014-06-09 18:45:47 +03:00
Ilari Liusvaara
c3982c8902 Clean up instance usage in editor-voicesub.cpp 2014-06-09 18:43:19 +03:00
Ilari Liusvaara
a2f4ba6dfd Clean up use of project->moviepath/otherpath 2014-06-09 18:39:30 +03:00
Ilari Liusvaara
b13e9ef12c Clean up window-fileupload.cpp 2014-06-09 18:24:00 +03:00
Ilari Liusvaara
99356caf71 Fix updating statusbar on save slot change 2014-06-09 11:09:39 +03:00
Ilari Liusvaara
3d3160c965 Cleanup some symbols 2014-06-09 02:10:15 +03:00
Ilari Liusvaara
b6dac6c1ed Factor updating status to its own class 2014-06-09 02:05:56 +03:00
Ilari Liusvaara
b8b4233255 Make class for emulator run mode 2014-06-09 01:10:29 +03:00
Ilari Liusvaara
4afda2550e Refactor save jukebox handling into its own class 2014-06-08 15:13:01 +03:00
Ilari Liusvaara
ae17d41df4 Privatefy loaded_rom rtype, region and orig_region 2014-06-08 14:24:57 +03:00
Ilari Liusvaara
301198e98f Instancefy currently loaded ROM 2014-06-08 04:15:01 +03:00
Ilari Liusvaara
7914d0bd70 Make some static variables in audioapi functions fields of audioapi class 2014-06-07 17:37:17 +03:00
Ilari Liusvaara
8f54db2902 Instancefy audioapi core (but not driver) stuff 2014-06-07 17:33:03 +03:00
Ilari Liusvaara
a2fed56d69 Cleanup unused boost includes 2014-06-07 15:37:14 +03:00
Ilari Liusvaara
f62caa4b08 Some non-instance variables cleanup 2014-06-07 15:27:06 +03:00
Ilari Liusvaara
63dfbd59d6 Make render queue scratch variables instance variables 2014-06-07 03:24:33 +03:00
Ilari Liusvaara
0631826095 Make some arrow magic constants in gui-arrow.cpp const 2014-06-07 03:20:48 +03:00
Ilari Liusvaara
c87c5de458 Remove Lua 5.1 support 2014-06-06 16:09:43 +03:00
Ilari Liusvaara
99577e806a Actually don't start if sysrc.lua is bad 2014-06-06 15:53:38 +03:00
Ilari Liusvaara
b021e7b5af read_lua_fragment: Don't duplicate the script infinite number of times 2014-06-06 15:51:53 +03:00
Ilari Liusvaara
7f271989d9 When panicing, show last message (as it is presumably related) 2014-06-06 15:38:56 +03:00
Ilari Liusvaara
a30c8f0890 Don't crash if exiting on panic 2014-06-06 15:30:57 +03:00
Ilari Liusvaara
14a0862342 Instancefy lua core stuff
This should fix crashes on startup on Win32
2014-06-06 15:03:16 +03:00
Ilari Liusvaara
b8c72344c1 lua::state::reset(): Use get instead of get_soft 2014-06-05 00:08:44 +03:00
Ilari Liusvaara
fc8484f984 Kill emulation_thread, nothing uses it 2014-06-04 19:37:32 +03:00
Ilari Liusvaara
bf00f42e0a Lua: Memory address object 2014-06-03 11:33:53 +03:00
Ilari Liusvaara
5d27f23cb2 Make some values const, remove some unused stuff 2014-06-03 03:52:13 +03:00
Ilari Liusvaara
5f4924debc Refactor slotcache to be instance variable 2014-06-03 03:15:00 +03:00
Ilari Liusvaara
c34db9ef74 Fix warnings from valgrind 2014-06-03 01:16:31 +03:00
Ilari Liusvaara
888afe8bcb Use helper class to simplify per-instance external vars 2014-06-03 01:16:16 +03:00
Ilari Liusvaara
bf0ca9b2f9 Do not use CORE() multiple times in the same function, it is pointless 2014-06-03 00:08:46 +03:00
Ilari Liusvaara
7e22f32429 Push instance vars out of keyboard/mouse driver code 2014-06-02 15:28:48 +03:00
Ilari Liusvaara
86da0775e0 Push instances up out from settings window code 2014-06-02 14:48:51 +03:00
Ilari Liusvaara
e6e3c71925 Eliminate settings_tab::call_window_fit(), nothing uses it 2014-06-02 11:43:50 +03:00
Ilari Liusvaara
6ba5fdfca8 More sweeping instance variables up 2014-06-02 11:41:41 +03:00
Ilari Liusvaara
2e36040731 Fix repainting status panel 2014-06-02 11:11:45 +03:00
Ilari Liusvaara
c634a74cf9 Sweep instance variables upward in UI code 2014-06-02 11:08:37 +03:00
Ilari Liusvaara
c3b1031498 Remove direct emulation thread references from keyboard.cpp 2014-05-31 22:34:43 +03:00
Ilari Liusvaara
77abaa2d98 Get rid of direct references from dumpmenu.cpp to emulation thread 2014-05-31 22:16:15 +03:00
Ilari Liusvaara
aa7e15aa27 Cleanup direct emulation thread references in editor-authors.cpp 2014-05-31 21:48:57 +03:00
Ilari Liusvaara
a2f6ba2b6f Use variable obtained earlier for current branch 2014-05-31 18:22:43 +03:00
Ilari Liusvaara
d7c6cd1905 Get rid of direct references to emulation thread in branchesmenu.cpp 2014-05-31 18:16:05 +03:00
Ilari Liusvaara
6bad138d8b Instancefy base mmio stuff 2014-05-31 17:16:45 +03:00
Ilari Liusvaara
f89ecc3870 More include cleanups 2014-05-31 16:56:48 +03:00
Ilari Liusvaara
9baba2cc99 Remove unused load_rom_from_commandline 2014-05-31 16:18:41 +03:00
Ilari Liusvaara
4829c852ad Move action_update to be via dispatch 2014-05-31 14:16:18 +03:00
Ilari Liusvaara
cf21744d00 Instancefy dispatch stuff 2014-05-31 13:58:17 +03:00
Ilari Liusvaara
f036ccd02d Refactor video dump framedrop handling 2014-05-31 09:23:47 +03:00
Ilari Liusvaara
5266f96cfd Move render_video_hud and killed_audio_length to master dumper class 2014-05-31 09:10:04 +03:00
Ilari Liusvaara
11f231b9ee Some #include cleanup 2014-05-28 20:58:17 +03:00
Ilari Liusvaara
3d1d920fff Factor message stream stuff to its own files 2014-05-28 20:31:08 +03:00
Ilari Liusvaara
cfc18e9e91 Combine some small headers together 2014-05-28 20:11:09 +03:00
Ilari Liusvaara
205b8eccdf Make helper class for instance member allocation / deallocation 2014-05-28 19:14:08 +03:00
Ilari Liusvaara
ed7496cc88 Instancefy button manager stuff 2014-05-28 18:24:54 +03:00
Ilari Liusvaara
a6a110bac9 Rewrite basic video dumping framework 2014-05-28 13:51:24 +03:00
Ilari Liusvaara
88a526d9cd Remove unused dump_region_map() 2014-05-24 14:19:30 +03:00
Ilari Liusvaara
ee59859dd3 Properly handle deletes if those behave oddly on some platform 2014-05-24 14:08:08 +03:00
Ilari Liusvaara
0a0cd049b1 Make instance vars to be pointers
This saves compilation time by reducing number of deps.
2014-05-24 14:05:04 +03:00
Ilari Liusvaara
1b2bd60455 Factor queue stuff to its own file 2014-05-24 12:05:38 +03:00
Ilari Liusvaara
f3c081da1e Do some more stuff missed in last commit 2014-05-24 11:56:48 +03:00
Ilari Liusvaara
7b4eadbe3e Make various instance stuff to take references to other instance objs 2014-05-24 11:39:36 +03:00
Ilari Liusvaara
878100b52c Instancefy framebuffer stuff 2014-05-23 20:14:12 +03:00
Ilari Liusvaara
52864d3aaa Instancefy framerate stuff 2014-05-23 19:43:03 +03:00
Ilari Liusvaara
95d1b5130f Move some debug stuff to be in class scope 2014-05-23 18:11:06 +03:00
Ilari Liusvaara
16663f7786 Some more optimization, some test code for this thing 2014-05-23 11:49:50 +03:00
Ilari Liusvaara
c5372a4826 Some optimizations & fixes 2014-05-23 04:21:00 +03:00
Ilari Liusvaara
f20d522c4c Remove broken crap 2014-05-22 21:04:51 +03:00
Ilari Liusvaara
2d811d2b4e Faster arithmetic modulo 2^255-19 on 64-bit
Cuts the time to compute DHF from ~760k to ~360k cycles.
2014-05-22 14:03:12 +03:00
Ilari Liusvaara
adb1b29c67 Refactor debugging into instance object 2014-05-21 18:32:17 +03:00
Ilari Liusvaara
c5a31e85d8 Add some test commands 2014-05-19 16:52:55 +03:00
Ilari Liusvaara
f2de04266e Fix all sort of Windows stupidities
- Using _export as method name is no-no on certain bad OS
- Don't re-declare certain defines involved in brain-dead linking
  shit
- Actually build crandom::arch_get_tsc/arch_get_random on Win32
2014-05-19 13:35:33 +03:00
Ilari Liusvaara
7f586e55b6 Make the emulator harder to imporperly quit 2014-05-19 13:09:16 +03:00
Ilari Liusvaara
7fb5407541 Don't corrupt memory when trying to GC various items on exit 2014-05-19 12:43:04 +03:00
Ilari Liusvaara
7834906157 Gambatte: Fix execute breaks on bus and IOAMHRAM 2014-05-19 12:21:34 +03:00
Ilari Liusvaara
606ce072a7 Gambatte: Fix bus write breaks 2014-05-19 12:17:28 +03:00
Ilari Liusvaara
b6b5243abe run in emu thread: Throw exceptions over thread switches 2014-05-18 19:58:56 +03:00
Ilari Liusvaara
2ffe0066c9 Get rid of most absolute refs to lsnes_instance in src/core 2014-05-18 12:57:58 +03:00
Ilari Liusvaara
0b8e2f0a6b Don't crash on exit with voice track loaded 2014-05-18 12:37:33 +03:00
Ilari Liusvaara
8b027be798 Instancefy project state 2014-05-18 12:34:22 +03:00
Ilari Liusvaara
57d3b99ecd Introduce run_show_error() and use it to clean up some code 2014-05-18 03:28:48 +03:00
Ilari Liusvaara
3066892e69 Make main controllers state a instance variable 2014-05-18 02:20:23 +03:00
Ilari Liusvaara
ff996c05b6 Instancefy cart mappings 2014-05-18 01:58:05 +03:00
Ilari Liusvaara
e6f1ea51b1 Instancefy internal emulation thread execution queue 2014-05-18 01:39:53 +03:00
Ilari Liusvaara
51bb860c85 Instancefy next rrdata 2014-05-18 00:55:11 +03:00
Ilari Liusvaara
b1fbb804c8 Instancefy alias binds management 2014-05-18 00:38:58 +03:00
Ilari Liusvaara
aad393c4ba Don't crash if trying to select key without keys (shouldn't happen) 2014-05-15 21:08:30 +03:00
Ilari Liusvaara
e21ced3adb Change some terms in UI 2014-05-15 18:55:57 +03:00
Ilari Liusvaara
2f7089da5f Move rename_overwrite from zip:: to directory:: 2014-05-15 17:54:54 +03:00
Ilari Liusvaara
927467b6ec Move directory stuff to dedicated namespace 2014-05-15 17:47:11 +03:00
Ilari Liusvaara
436b5c4238 Toggle sound mute command/hotkey 2014-05-15 02:33:29 +03:00
Ilari Liusvaara
9bcdcdcb13 Fix keyboard:⌨️:all_keys and all_modifiers 2014-05-15 02:31:16 +03:00
Ilari Liusvaara
3a61504580 Scope listener base classes inside respective master classes 2014-05-14 17:00:34 +03:00
Ilari Liusvaara
986640b6ba controller_frame_vector: Use object instead of lambda for notify 2014-05-14 16:49:25 +03:00
Ilari Liusvaara
b601b18bf6 lua.hpp: Forward-declare keyboard::key 2014-05-14 16:21:03 +03:00
Ilari Liusvaara
29ee02309b Move lua-framebuffer to lua namespace 2014-05-14 11:50:59 +03:00
Ilari Liusvaara
9f7c5523d7 Namespacify mathexpr 2014-05-14 11:43:25 +03:00
Ilari Liusvaara
3a85ccc506 Move memorywatch stuff to dedicated namespace 2014-05-14 10:50:49 +03:00
Ilari Liusvaara
6c9d34123d Rename some classes 2014-05-13 18:43:05 +03:00
Ilari Liusvaara
670f92c3f8 Kill off register-queue 2014-05-13 16:32:53 +03:00
Ilari Liusvaara
1cd3e3d004 Lua.cpp: Don't call unregister callbacks if nothing get unreg'd 2014-05-13 16:31:07 +03:00
Ilari Liusvaara
04575a789b settingvar.cpp: Get rid of register_queue 2014-05-13 16:30:35 +03:00
Ilari Liusvaara
a77c6a4df6 Lua.cpp: Get rid of register-queue 2014-05-13 16:13:09 +03:00
Ilari Liusvaara
ba3446697e keyboard-mapper.cpp: Get rid of register_queue 2014-05-13 15:30:16 +03:00
Ilari Liusvaara
f41142ea16 keyboard.cpp: Get rid of register_queue 2014-05-13 14:51:09 +03:00
Ilari Liusvaara
3ca96fb1b0 Reduce dependicies between header files 2014-05-13 13:42:07 +03:00
Ilari Liusvaara
d47959b618 Kill command::set::get_commands()
Nothing uses it
2014-05-13 12:31:34 +03:00
Ilari Liusvaara
6f35061747 Setting sets 2014-05-13 09:06:14 +03:00
Ilari Liusvaara
66839ba82f Initialize fdset before polling on it 2014-05-12 23:57:11 +03:00
Ilari Liusvaara
30d7196cd4 Listener object is better than 3 lambdas + handle 2014-05-12 23:44:12 +03:00
Ilari Liusvaara
d2334af286 EVDEV: Select on joysticks
This should improve response times to gamepads
2014-05-12 22:22:40 +03:00
Ilari Liusvaara
ab9c568062 Inverse binding sets 2014-05-12 20:37:04 +03:00
Ilari Liusvaara
8851cec1cc Fix valgrind warnings in inthread.cpp 2014-05-12 20:37:04 +03:00
Ilari Liusvaara
4eb217e766 Delete some unused fields 2014-05-12 20:11:02 +03:00
Ilari Liusvaara
8eb23a34ca Use recursive locks to deal with the locking mess in command::* 2014-05-12 19:08:45 +03:00
Ilari Liusvaara
7f8fd7b393 Simplify command::* memory management 2014-05-12 15:48:08 +03:00
Ilari Liusvaara
f4c6c6e322 Command sets WIP 2014-05-11 20:01:26 +03:00
Ilari Liusvaara
635e1fac44 Move lsnes_kbd and lsnes_mapper to be instance vars 2014-05-11 15:29:27 +03:00
Ilari Liusvaara
6ced0ce890 Split random number functions from misc.cpp to dedicated file 2014-05-10 15:17:12 +03:00
Ilari Liusvaara
04ba635f1a Instancefy emustatus.cpp stuff 2014-05-10 14:48:08 +03:00
Ilari Liusvaara
21dbab5a77 Instancefy multitrack.cpp stuff 2014-05-10 14:36:54 +03:00
Ilari Liusvaara
97ecbe06f0 Kill unused generic_controller_name() 2014-05-10 14:18:33 +03:00
Ilari Liusvaara
4099291b35 Instancefy mbranch.cpp stuff 2014-05-10 14:11:24 +03:00
Ilari Liusvaara
3e4c03d114 Clean up some uses of lsnes_instance 2014-05-10 13:55:07 +03:00
Ilari Liusvaara
ee0d0089dc Instancefy subtitles.cpp stuff 2014-05-10 13:36:00 +03:00
Ilari Liusvaara
4be906fa36 Instancefy inthread.cpp stuff 2014-05-10 13:12:42 +03:00
Ilari Liusvaara
6f65559571 Get rid of lsnes_vset[foo] 2014-05-10 12:15:57 +03:00
Ilari Liusvaara
b57e6d5eda lsnes_vsetc -> lsnes_instance.setcache 2014-05-10 11:54:15 +03:00
Ilari Liusvaara
d95f247e9f lsnes_memorywatch -> lsnes_instance.mwatch 2014-05-10 11:41:08 +03:00
Ilari Liusvaara
ee6b522395 lsnes_lua_state -> lsnes_instance.lua 2014-05-10 11:32:48 +03:00
Ilari Liusvaara
5ee9514791 Don't extern lsnes_lua_state, it is only used in one file 2014-05-10 11:28:11 +03:00
Ilari Liusvaara
c84a8125c9 lsnes_memory -> lsnes_instance.memory 2014-05-10 11:22:31 +03:00
Ilari Liusvaara
dcd9bec1fc movb -> lsnes_instance.mlogic 2014-05-10 11:09:28 +03:00
Ilari Liusvaara
46feccd206 Remove unused variable and some commented out debug code 2014-05-10 10:33:38 +03:00
Ilari Liusvaara
e9e9fd4394 Zeroize: Don't crash if size=0 2014-05-08 18:33:33 +03:00
Ilari Liusvaara
4e29357123 Lua: memory.getregisters() 2014-05-06 20:42:22 +03:00
Ilari Liusvaara
24af115b47 lsnes rr2-β21 2014-05-04 19:27:03 +03:00
Ilari Liusvaara
c961f78f03 Use urandom / rtlgenrandom
Simplify the mess of random number generation.

Also, even if rtlgenrandom is officially documented as don't use, if
it gets changed/removed, if this emulator works is the least of your
worries (Microsoft just broke all backward compatibility).
2014-05-04 19:08:25 +03:00
Ilari Liusvaara
40d5f30d1c TAS input keyboard support 2014-05-04 19:06:05 +03:00
Ilari Liusvaara
965cc73bfa Some Win32 build fixes 2014-05-04 18:55:15 +03:00
Ilari Liusvaara
6af073792a Tweak the RNG a bit 2014-05-03 20:45:14 +03:00
Ilari Liusvaara
ffcdc987bd If loading ROM with multiple candidates, prompt before adding to recentrom 2014-05-03 08:27:18 +03:00
Ilari Liusvaara
579c20988a Fix loading states with movie-ahead without ROM 2014-05-01 19:28:14 +03:00
Ilari Liusvaara
192d876e96 Movie editor: Insert multiple lines at once 2014-05-01 19:18:36 +03:00
Ilari Liusvaara
9ccd279646 Movie editor: Draw clear / fix current column 2014-05-01 19:06:42 +03:00
Ilari Liusvaara
45388e8ee2 Support configurable URI shorthands 2014-05-01 13:56:33 +03:00
Ilari Liusvaara
7f0da4d4eb Trace logger: Don't double free trace hooks
Trying to free already freed hook should do nothing, but still don't
do that.
2014-05-01 12:32:46 +03:00
Ilari Liusvaara
3b5ccbaf36 lsnes-dumpavi: Support downloading movies 2014-05-01 09:26:16 +03:00
Ilari Liusvaara
7534bf66d9 Fix potential crash on exit 2014-05-01 09:09:10 +03:00
Ilari Liusvaara
499e85fbab Trace logger: Allow deleting lines / clearing 2014-05-01 04:27:47 +03:00
Ilari Liusvaara
e10a2fcfe5 Trace logger (Window): Show start of frame 2014-05-01 04:12:15 +03:00
Ilari Liusvaara
6fc0cf9cf6 Fix SA1 open bus 2014-04-30 00:26:29 +03:00
Ilari Liusvaara
be838db972 Lua: Fix some includes 2014-04-29 08:29:33 +03:00
Ilari Liusvaara
175a080382 Autodetect followed by undefined with multiple choices: Ask user 2014-04-26 20:55:42 +03:00
Ilari Liusvaara
f4102dc311 Memory peek/poke: Accept and show relative addresses 2014-04-26 20:20:23 +03:00
Ilari Liusvaara
a3c81eec0c Wipe all sorts of potentially sensitive stuff after use 2014-04-24 17:06:22 +03:00
Ilari Liusvaara
a0d293a7b6 Use curl-config instead of -lcurl 2014-04-22 04:08:44 +03:00
Ilari Liusvaara
4560782668 moviefile::get_movie_length: Use milliseconds, not nanoseconds
The fractional division should still be exact (but rounds up).
2014-04-21 21:46:29 +03:00
Ilari Liusvaara
c594082dfa Lua: Deprecate global addresses
These are a frequent source of bugs in Lua scripts, so deprecate those.
2014-04-21 16:16:55 +03:00
Ilari Liusvaara
ceed4f622f Merge multiple versions of get_read_address() into one 2014-04-21 15:54:36 +03:00
Ilari Liusvaara
acb0c481a5 Memory search: Resolve memory area if possible 2014-04-21 15:51:08 +03:00
Ilari Liusvaara
ebf7a1e90e SNES: Pseudo-registers hcounter and vcounter 2014-04-18 21:19:43 +03:00
Ilari Liusvaara
91f63c4d63 SNES: SA1 registers for memory.getregister/setregister 2014-04-18 19:38:20 +03:00
Ilari Liusvaara
2e8c828f05 ZMBV full search mode
This is pretty much unusuably slow, but useful if one really wants
to compress the dump.
2014-04-18 19:31:15 +03:00
Ilari Liusvaara
dffb2d614b Recognize SA1IRAM for purposes of breakpoints 2014-04-16 18:35:11 +03:00
Ilari Liusvaara
2e4d9098cd SA1 tracing support + memorywatch/search SA1 IRAM 2014-04-14 21:23:41 +03:00
Ilari Liusvaara
602166c5d3 Advance macros after frame is complete, not before frame starts 2014-04-14 15:03:26 +03:00
Ilari Liusvaara
4ffdbdd695 Fix macros getting frame duplicated after loadstate 2014-04-13 21:50:11 +03:00
Ilari Liusvaara
119fefedd4 Select slot hotkeys 2014-04-12 20:22:11 +03:00
Ilari Liusvaara
4c952beb3b Use open/read/write/close for binary saves instead of iostreams 2014-04-10 22:51:42 +03:00
Ilari Liusvaara
0e0989b568 Don't use -Werror
Good idea for debugging, dad idea in source code...
2014-04-06 16:58:40 +03:00
Ilari Liusvaara
3752a3f8a2 src/lua/gui-bitmap.cpp Initialize spal to avoid compiler warning
The variable can't really be used uninitialized, because it is only
used if src_p is true, and the same variable causes it to be initialized.
2014-04-06 16:49:19 +03:00
Ilari Liusvaara
d7daa8963c c-interface: Add some translation templates 2014-04-06 16:42:58 +03:00
Ilari Liusvaara
f2e1930909 Lua: (D)BITMAP:draw_clip, (D)BITMAP:draw_outside, TILEMAP:draw_outside 2014-04-03 00:59:05 +03:00
Ilari Liusvaara
ff45e27d5e Lua: gui.solidrectangle 2014-04-02 15:27:58 +03:00
Ilari Liusvaara
154abcb8d7 Numeric range class, obsolete clip_range. 2014-04-02 15:18:33 +03:00
Ilari Liusvaara
d533647560 Delete the now-unused emulator_status stuff 2014-04-02 08:43:25 +03:00
Ilari Liusvaara
3bd8f21369 lsnes rr2-β20 2014-04-01 14:35:07 +03:00
Ilari Liusvaara
12c9a5fdfb Don't update statusbar fast outside paint event
Turns out spamming wxStatusBar::SetStatusText() outside paint event
causes wxWidgets to livelock.
2014-04-01 14:25:11 +03:00
Ilari Liusvaara
5f5e709cb1 Coalesce UI events. 2014-04-01 13:28:16 +03:00
Ilari Liusvaara
b14bc7a3a7 Add option to emulate fucked up GBC timings 2014-04-01 12:35:07 +03:00
Ilari Liusvaara
9754bbc5f4 Fix bug in printing MSU-1 track playback messages 2014-04-01 02:47:52 +03:00
Ilari Liusvaara
9e0277636f Fix typo in changelog 2014-04-01 00:36:26 +03:00
Ilari Liusvaara
f4d7b6cf73 lsnes rr2-β19 2014-04-01 00:18:14 +03:00
Ilari Liusvaara
5cc3661437 Refactor emulator status reporting (and fix the statusbar doesn't update bug) 2014-04-01 00:13:36 +03:00
Ilari Liusvaara
47b5e9b6be SNES: Support VRAM, OAM, CGRAM and APURAM breakpoints 2014-03-31 20:20:21 +03:00
Ilari Liusvaara
d210680315 Use overcommit in memory compares 2014-03-31 14:47:25 +03:00
Ilari Liusvaara
59300d2339 Fix printing of tilemaps and compare objects 2014-03-31 14:47:01 +03:00
Ilari Liusvaara
5745859815 Fix compare objects 2014-03-31 14:46:17 +03:00
Ilari Liusvaara
5d0fb0f39a Error out creating too large bitmaps / tilemaps instead of corrupting memory 2014-03-31 14:15:24 +03:00
Ilari Liusvaara
7ba7fc24f6 Use overcommit for palettes, bitmaps, dbitmaps and tilemaps
This makes the large size of these objects visible to Lua, hopefully
allowing Lua GC to make better decisions.
2014-03-31 12:42:33 +03:00
Ilari Liusvaara
e0827ce54f Add base support for Lua object overcommit 2014-03-31 11:31:25 +03:00
Ilari Liusvaara
2498bad58d Autosave settings immediately after closing settings 2014-03-30 21:20:21 +03:00
Ilari Liusvaara
7a1e20e9db Lua: bit.mul32 2014-03-30 00:40:37 +02:00
Ilari Liusvaara
4a027d5f4e Make compiler more anal and fix what comes up
Probably got multiple Lua crash bugs...
2014-03-29 20:43:58 +02:00
Ilari Liusvaara
c50c458bd1 Work around compiler warning on -2^63 written as constant 2014-03-29 17:36:43 +02:00
Ilari Liusvaara
7d4a8b3742 Don't crash if trying to load movie with unknown sysregion 2014-03-29 17:21:51 +02:00
Ilari Liusvaara
c9777bba18 Fix the 0 movie length bug 2014-03-29 17:21:50 +02:00
Ilari Liusvaara
b367334238 Only update emulator status from within update_movie_state() 2014-03-28 12:36:21 +02:00
Ilari Liusvaara
b0503ad245 Make redraw_framebuffer call update_movie_state(); 2014-03-28 11:44:21 +02:00
Ilari Liusvaara
1b844492c7 Lua: bit.test, bit.testn, string.hex, string.lpad, string.rpad 2014-03-27 11:58:54 +02:00
Ilari Liusvaara
45ab432c61 Tweak description of bit.multidiv 2014-03-27 10:48:12 +02:00
Ilari Liusvaara
80d4f30ee2 Lua: bit.multidiv 2014-03-27 01:29:03 +02:00
Ilari Liusvaara
5562a2fc2c Lua: string.regex 2014-03-27 01:11:27 +02:00
Ilari Liusvaara
bc6b3adc6c Small tweak to previous (convert multiplication to bitshift) 2014-03-26 13:00:52 +02:00
Ilari Liusvaara
39d2ecaa62 Refactor triple buffering logic to its own file 2014-03-26 12:27:17 +02:00
Ilari Liusvaara
debb6dd421 GB: Fix tracelogger not to screw up breaks 2014-03-24 14:15:52 +02:00
Ilari Liusvaara
2592a724bc GB: Fix read/write of A, PC and CycleCounter when executing 2014-03-24 14:03:01 +02:00
Ilari Liusvaara
3ab62196fd Fix loading memory watches on project change 2014-03-24 13:26:04 +02:00
Ilari Liusvaara
efa7a3bb4e Initialize project active_branch/next_branch
Fixes a crash when creating a new project
2014-03-24 11:22:16 +02:00
Ilari Liusvaara
97f72c2952 Gambatte: Mark system bus as I/O special
Otherwise memory search will try to read BUS+FF00, which will deadlock
the emulator...
2014-03-24 11:03:57 +02:00
Ilari Liusvaara
99475b2a0b Lock/Unlock multiple locks at once function / class 2014-03-23 10:28:33 +02:00
Ilari Liusvaara
32f2e2ce81 Refactor streamcompress.hpp 2014-03-23 09:56:22 +02:00
Ilari Liusvaara
4f0e636b9b Refactor workthread.hpp and threadtypes.hpp (renamed to threads.hpp)
Also rename all variables and fields named "mutex" (gdb does not like
that name).
2014-03-23 09:45:42 +02:00
Ilari Liusvaara
2823958ffb Fix another potential dtor order crash 2014-03-22 13:49:56 +02:00
Ilari Liusvaara
896b7144b8 Fix potential dtor ordering crash in file hasher 2014-03-22 13:37:45 +02:00
Ilari Liusvaara
5a0ccb1401 Free some more memory before quitting 2014-03-22 13:28:53 +02:00
Ilari Liusvaara
9a1895eaea Fix some memory leak complaints from Valgrind 2014-03-22 13:11:51 +02:00
Ilari Liusvaara
e1c890de1d Speed up font init
regex() is slow, use normal string manipulation functions. Cuts the time
to initialize fonts (which is about 75% of the startup time) to about
20% of what it was.
2014-03-22 12:17:13 +02:00
Ilari Liusvaara
b7cf3921e0 Some missing string conversions and headers 2014-03-21 14:50:13 +02:00
Ilari Liusvaara
92465b929f Move one #ifdef BSNES_HAS_DEBUGGER to the proper place 2014-03-21 14:12:31 +02:00
Ilari Liusvaara
a26de8a081 lsnes rr2-β18 2014-03-19 18:23:57 +02:00
Ilari Liusvaara
57992947ae Optimize movie.find_frame()
The new version is about 6x faster.
2014-03-19 18:21:36 +02:00
Ilari Liusvaara
1436aa7d3d Make setting/unsetting non-bus breaks much faster.
The new code seems to be about 400x faster, at least in some cases...
2014-03-17 14:26:50 +02:00
Ilari Liusvaara
f73e59688c SNES: Fix disassembly of long offsets 2014-03-16 19:38:16 +02:00
Ilari Liusvaara
7f511cd1f7 Allow bsnes tracelogger to trace execution in controller registers 2014-03-16 16:54:43 +02:00
Ilari Liusvaara
2325e501b3 Lua: Get lag count function 2014-03-15 15:24:07 +02:00
Ilari Liusvaara
34aa56d429 Fix deleting executing breakpoint 2014-03-11 14:56:51 +02:00
Ilari Liusvaara
4556e01edf Don't double-close audio output
Fixes an error in Valgrind and error on switching sound devices.
2014-03-09 02:14:26 +02:00
Ilari Liusvaara
cfbccd9518 Correctly show axes as disabled even if offline 2014-03-09 02:07:24 +02:00
Ilari Liusvaara
2af2a30e6a Force some configuration windows to be larger 2014-03-09 02:04:07 +02:00
Ilari Liusvaara
6e93d2c786 Add JSON linter utility
This might be handy for debugging bad JSON.
2014-03-08 13:59:54 +02:00
Ilari Liusvaara
d6cfb451b7 Tweak new movie dialog layout a bit 2014-03-08 00:12:12 +02:00
Ilari Liusvaara
8226514183 Fix mouse electronics test 2014-03-07 02:09:50 +02:00
Ilari Liusvaara
a0ac5a3b84 Fix compilation on Mac OS X 2014-03-06 13:11:05 +02:00
Ilari Liusvaara
432185f37d Fix core callbacks being undefined if loading ROM from cmdline 2014-03-06 10:29:48 +02:00
Ilari Liusvaara
455d43b2ba C interface: Check for value != 0, not for control != 0 for lag check 2014-03-02 02:21:27 +02:00
Ilari Liusvaara
89f31f328b C interface: Fix lag counting without LSNES_CORE_CAP1_PFLAG 2014-03-02 00:56:29 +02:00
Ilari Liusvaara
e44468f426 bsnes core: Raise bus breaks against correct address 2014-02-28 23:35:13 +02:00
Ilari Liusvaara
8a430a657e lsnes rr2-β17 2014-02-28 15:49:09 +02:00
Ilari Liusvaara
aa420b8297 Fix exact core matching when loading projects 2014-02-28 05:38:29 +02:00
Ilari Liusvaara
1d72c3c4f8 C interface 2014-02-27 22:45:44 +02:00
Ilari Liusvaara
76c9599369 New projects menu 2014-02-25 04:03:55 +02:00
Ilari Liusvaara
08b41877a3 Recentfiles object: named object 2014-02-25 04:03:52 +02:00
Ilari Liusvaara
defb1cba72 Don't crash if recentfiles line fails to deserialize 2014-02-25 04:02:54 +02:00
Ilari Liusvaara
960fd4f892 Move library recentfiles to its own namespace 2014-02-25 04:02:54 +02:00
Ilari Liusvaara
733881d232 Fix system plugins not getting loaded if user plugin enum failed 2014-02-25 04:02:53 +02:00
Ilari Liusvaara
fc95e85126 Pass dummy object parameter to do_unregister
This allows getting rid of proxy objects
2014-02-23 07:07:20 +02:00
Ilari Liusvaara
1994af1d09 Tracelogger: Breakpoints 2014-02-22 21:31:13 +02:00
Ilari Liusvaara
bad1141c65 Memory search: Fix display of unsigned dword and signed qword 2014-02-22 12:50:25 +02:00
Ilari Liusvaara
bb40d868f6 Properly set Read-Only mode if rewinding 2014-02-22 12:03:32 +02:00
Ilari Liusvaara
75d15409f9 Wxwidgets: --unpause to auto-unpause on start 2014-02-18 20:26:50 +02:00
Ilari Liusvaara
02749cc650 Some cleanup 2014-02-18 20:26:50 +02:00
Ilari Liusvaara
c685319f88 Lua: Clean up region bounds computation 2014-02-18 20:26:50 +02:00
Ilari Liusvaara
c1699a0c8c Lua: Fix gui.repaint() when paused 2014-02-16 12:33:36 +02:00
Ilari Liusvaara
fa8b07b4d8 bsnes: redump sprite/palette functions 2014-02-16 01:22:59 +02:00
Ilari Liusvaara
0f6bf458d8 wxwidgets: Allow entering fullscreen mode from commandline 2014-02-16 01:06:17 +02:00
Ilari Liusvaara
89b8cd91f4 Lua: Run startup scripts after amode has been initialized
This fixes using unpause-emulator in startup script
2014-02-16 00:39:29 +02:00
Ilari Liusvaara
9bd1791701 Lua: Don't run Lua until the emulator has fully started up 2014-02-15 13:51:39 +02:00
Ilari Liusvaara
ccc7fa2fba Show dialog if loading ROM/movie from command line fails 2014-02-15 12:23:46 +02:00
Ilari Liusvaara
8438774606 Some tweaks to Lua docs 2014-02-15 12:23:46 +02:00
Ilari Liusvaara
ef1f61a6e7 Lua: COMPARE_OBJ: Check strided memory block for modifications 2014-02-14 22:22:45 +02:00
Ilari Liusvaara
b53979bcd1 Makefile: platclean: Only clean emulation files 2014-02-14 10:17:27 +02:00
Ilari Liusvaara
9b05adcf35 lsnes rr2-β16 2014-02-14 10:07:22 +02:00
Ilari Liusvaara
d1176cbf9e Lua: memory2: More functions corresponding to memory.* 2014-02-13 13:48:01 +02:00
Ilari Liusvaara
a8fa742a36 Lua: Cleanup & fix memory hash / storecmp functions 2014-02-13 02:35:11 +02:00
Ilari Liusvaara
ee254e311e Fix parsing of #nnnnnn color notation 2014-02-12 22:55:44 +02:00
Ilari Liusvaara
f35e68a11a Trace logger / disassembler GUI 2014-02-12 15:57:33 +02:00
Ilari Liusvaara
17d27a2a9a Lua docs: Replace "vma" by "memory area" or "marea" 2014-02-11 12:33:46 +02:00
Ilari Liusvaara
0e0ca079fa Lua: memory.hash_region(), memory.store(), memory.storecmp() 2014-02-10 21:25:25 +02:00
Ilari Liusvaara
783d20f690 Don't use framebuffer palettes 2014-02-10 00:07:31 +02:00
Ilari Liusvaara
c22040dac8 Hex editor: Properly erase past-the-end chars for non-mod16 regions 2014-02-09 00:00:06 +02:00
Ilari Liusvaara
6341415723 Gambatte: Some Trace/Disassemble fixes 2014-02-08 01:05:04 +02:00
Ilari Liusvaara
799549530a Fix kill_hooks() 2014-02-08 01:04:41 +02:00
Ilari Liusvaara
6ebc1563eb Upload: Drop the system select, it isn't usable 2014-02-07 04:22:27 +02:00
Ilari Liusvaara
18ca96bda8 Don't crash if exiting with trace log active 2014-02-06 12:39:46 +02:00
Ilari Liusvaara
a52f1a5afa File upload: More usable game name selection 2014-02-05 16:50:41 +02:00
Ilari Liusvaara
89aab3b1db Cleanup lua code by introducing lua::functions 2014-02-05 13:27:51 +02:00
Ilari Liusvaara
8bae3615ab Load some legacy memory watches
Doesn't support anything fancy, just what old memory watch system
recognized as a watch (not an expression).
2014-02-05 03:23:51 +02:00
Ilari Liusvaara
ef140f3324 moviefile.cpp is friggin' large, split it up 2014-02-05 01:11:21 +02:00
Ilari Liusvaara
a50cadb1a8 Support multi-branch movies 2014-02-04 21:16:38 +02:00
Ilari Liusvaara
3e92462a3d Dynamically allocate moviefile, rrdata and movie structures 2014-02-02 18:35:36 +02:00
Ilari Liusvaara
aa6579b10c Upload: Don't send empty fields
Those things seem to cause failures...
2014-02-01 18:26:02 +02:00
Ilari Liusvaara
369d604254 Fix initram handling with rewind to start type actions 2014-02-01 17:48:04 +02:00
Ilari Liusvaara
ceb35eb72c Back movie data off movie file structure 2014-02-01 17:35:22 +02:00
Ilari Liusvaara
d9b70e893d Gambatte: New patch: Optional crash on SIGILL, fix MBC3 2014-02-01 13:19:13 +02:00
Ilari Liusvaara
3e8eed0ac1 Make git diff --check happy 2014-01-31 06:26:04 +02:00
Ilari Liusvaara
137656ce0c wxwidgets: Use text render panel in messages window
The text render panel is much more predictable than using system fonts,
especially on Windows.
2014-01-31 06:04:42 +02:00
Ilari Liusvaara
a2407c4e79 Refactor some generic reading/writing routines out of moviefile.cpp 2014-01-31 05:20:52 +02:00
Ilari Liusvaara
2e4502896f Fix some exception specifier mismatches 2014-01-30 12:36:02 +02:00
Ilari Liusvaara
8670a7b01d Lua: bit.compose, bit.binary_{ld,st}_*, bit.quotent 2014-01-30 02:34:49 +02:00
Ilari Liusvaara
9a9f58d747 lua_func_callback isn't used anymore, remove it 2014-01-30 00:44:42 +02:00
Ilari Liusvaara
a2a8fad24e Lua: Get rid of unneeded subclasses of lua::function 2014-01-30 00:19:08 +02:00
Ilari Liusvaara
1fd5a490bf Lua: Convert some functions to static-only classes 2014-01-29 14:50:40 +02:00
Ilari Liusvaara
02eed4668c Lua: Support __pairs for classes 2014-01-29 14:50:40 +02:00
Ilari Liusvaara
67ed92de33 Lua: all_classes() 2014-01-29 12:57:42 +02:00
Ilari Liusvaara
85d78e2632 Lua: Give the print method as pointer instead of assuming T::print 2014-01-29 11:32:52 +02:00
Ilari Liusvaara
5f6b59b766 Make reference to certain library conditional
Useful if the relevant code gets pulled out into another project
2014-01-29 00:22:56 +02:00
Ilari Liusvaara
cb5a9898be PRNG: Don't try to access element -1 of array in some cases 2014-01-28 14:41:48 +02:00
Ilari Liusvaara
53d7bbd633 Lua: Make class methods take lua::parameters 2014-01-28 14:38:25 +02:00
Ilari Liusvaara
59113ed24d Lua: Convert some core-specific stuff and kill lua::fnptr 2014-01-28 14:26:00 +02:00
Ilari Liusvaara
75838b9212 Lua: Refactor the two remaining files to use multiarg 2014-01-28 14:09:58 +02:00
Ilari Liusvaara
598ecc6542 Lua: Multiarg refactoring for a few more files 2014-01-28 13:13:05 +02:00
Ilari Liusvaara
ebb1779e29 Lua: Use multiarg for rest of gui-* stuff 2014-01-28 12:28:35 +02:00
Ilari Liusvaara
d4a7b65df8 Lua: Use multiarg in some more files 2014-01-28 03:24:33 +02:00
Ilari Liusvaara
a848e9d154 Lua: use multi-argument parsing for more files 2014-01-28 01:01:46 +02:00
Ilari Liusvaara
53d82395c0 Lua: Use multi-argument parsing in some more places 2014-01-27 11:14:37 +02:00
Ilari Liusvaara
bb6bf9ca26 Lua: Multi-argument parsing and unify color parsing 2014-01-27 11:00:34 +02:00
Ilari Liusvaara
ccb6d4b4be Lua: More refactoring 2014-01-27 00:27:38 +02:00
Ilari Liusvaara
1800453c4f Lua: More conversion to lua::parameters 2014-01-26 19:10:52 +02:00
Ilari Liusvaara
b7ea7bb2c7 Lua: cleanup some more files 2014-01-26 17:42:22 +02:00
Ilari Liusvaara
82a1ce3c9c Lua: Some fixes related to sysrc.lua
- Detect syntax errors in sysrc.lua and abort compile
- Print special errors for parse errors on sysrc.lua (if above fails).
- Print errors from sysrc.lua specially.
2014-01-26 17:10:22 +02:00
Ilari Liusvaara
d5e75bbb61 Lua: Refactor some documentation 2014-01-25 17:43:22 +02:00
Ilari Liusvaara
eb820c442e Lua: Table of classes 2014-01-25 17:41:49 +02:00
Ilari Liusvaara
16ed1f9e7f Lua: Cleanup gui-rqueue.cpp 2014-01-25 17:41:49 +02:00
Ilari Liusvaara
764abbaeaf Lua: Cleanup hostmemory and use static method for TILEMAP ctor 2014-01-25 16:44:36 +02:00
Ilari Liusvaara
bdca062ba8 Lua: Make static constructor methods for MMAP_STRUCT and ZIPWRITER 2014-01-25 16:30:35 +02:00
Ilari Liusvaara
676dfe7ac8 Lua: Refactor classes
- Support static methods for classes
- Allow Lua to enumerate static and class methods
- Support dynamic class lookup
- Support class groups (in style of function groups)
2014-01-25 16:30:25 +02:00
Ilari Liusvaara
94114f1e2e Lua: Refactor lots of stuff
- Split lua-base.hpp into number of files.
- New Lua function parameters parser.
- Convert some Lua code files in order to test the stuff
2014-01-25 12:51:13 +02:00
Ilari Liusvaara
4caf44e057 Lua: identify_class 2014-01-23 14:45:30 +02:00
Ilari Liusvaara
fa9971c2a0 Lua: Autogenerate sysrc.cpp from sysrc.lua 2014-01-23 14:26:33 +02:00
Ilari Liusvaara
b54a776f13 Lua: Scaling blits, color priority blits, Porter-Duff blits 2014-01-22 19:18:03 +02:00
Ilari Liusvaara
1da06a7675 Lua: Byte order swapping
Not that with memory2.* one needs that very much...
2014-01-20 19:50:28 +02:00
Ilari Liusvaara
156a23782a Rename ERROR to FAILED in evaluation status
This avoids a name conflict.
2014-01-20 17:37:33 +02:00
Ilari Liusvaara
ce0c625072 Lua interface to iconv(3), string.byteU and string.charU 2014-01-20 12:59:02 +02:00
Ilari Liusvaara
2bc837dbf5 Allow loading empty font and editing font after loading 2014-01-19 16:15:41 +02:00
Ilari Liusvaara
91c765a0a7 Slot branches 2014-01-18 11:50:19 +02:00
Ilari Liusvaara
4bb75bc30e Lua: gui.set_video_scale() 2014-01-17 22:19:50 +02:00
Ilari Liusvaara
56c15a59a3 Fix lockup if exiting emulator with project active 2014-01-17 20:01:32 +02:00
Ilari Liusvaara
dffe0de67e Optimize controller_frame_vector::compatible() 2014-01-16 12:55:40 +02:00
Ilari Liusvaara
31ff9a4b8f Move main movie compatiblity checking to controller_frame_vector 2014-01-16 12:21:29 +02:00
Ilari Liusvaara
a727d47a0c Clean up internal name used to designate a save slot
Also write code to translate old configs.
2014-01-14 21:14:12 +02:00
Ilari Liusvaara
a9bc132e20 Make frame count controller_frame_vector property 2014-01-14 20:43:56 +02:00
Ilari Liusvaara
26c0d38955 Allow -mt prefix for host boost
This is useful for building on Mac OS X
2014-01-14 11:53:19 +02:00
Ilari Liusvaara
65267f8ebd Fix core selection among multiple candidates for downloaded movies 2014-01-12 13:12:49 +02:00
Ilari Liusvaara
0a41e8d901 More advanced memory watches 2014-01-10 12:12:14 +02:00
Ilari Liusvaara
c0faaf1fce Fix typo in macosx platform makefile 2014-01-09 12:11:50 +02:00
Ilari Liusvaara
2e0f2a359a PNG screenshots are bugged again... 2014-01-06 01:37:41 +02:00
Ilari Liusvaara
57c2adb511 lsnes rr2-β15 2014-01-05 16:05:43 +02:00
Ilari Liusvaara
af4cab15ce lsnes rr1-Δ18ε3 2014-01-05 15:54:28 +02:00
Ilari Liusvaara
e42a606ae8 Platform::wait(): Never wait on zero delay 2014-01-05 15:31:59 +02:00
Ilari Liusvaara
a6ed9aad0b Merge branch 'rr1-maint' 2014-01-05 04:39:37 +02:00
Ilari Liusvaara
d72711e7cb Handle frame spanning movie page boundary
Turns out that controller_frame_vector::walk_helper() didn't properly
handle the case where the frame (and the first subframe of next frame)
spans multiple pages in movie.
2014-01-05 04:38:04 +02:00
Ilari Liusvaara
8492f6029d Fix rerecord count to reset on new movie 2014-01-04 04:59:14 +02:00
Ilari Liusvaara
7b5c281d7f Don't desync if loading a movie preserving input
This operation makes pretty much no sense, but support it anyway.
2014-01-04 04:59:09 +02:00
Ilari Liusvaara
9620390514 Oops, GB(C) bus was missing 2014-01-02 03:07:07 +02:00
Ilari Liusvaara
848a0eef1e Don't crash on certain invalid memory read/write commands 2014-01-02 03:04:03 +02:00
Ilari Liusvaara
ba08f9a792 Fix framebuffer::font::get_metrics
Fixes a freeze with memory watch
2014-01-02 01:59:22 +02:00
Ilari Liusvaara
561cca5efc Fix crash on canceling tracelog filename select 2014-01-02 01:51:01 +02:00
Ilari Liusvaara
b375df6102 options.build: Default to g++, not g++-4.6 (too old) 2014-01-02 01:07:19 +02:00
Ilari Liusvaara
8b5b33c422 Merge branch 'rr1-maint' 2014-01-01 23:49:41 +02:00
Ilari Liusvaara
c7bdac819d Fix compiling gambatte binding with versions not supporting debug extensions 2014-01-01 23:47:30 +02:00
Ilari Liusvaara
89a9363e6f lsnes rr2-β14 2013-12-31 22:11:37 +02:00
Ilari Liusvaara
1a0f0448e8 Plugin blacklist/killlist (needed on some toys) 2013-12-31 21:49:50 +02:00
Ilari Liusvaara
1c2885fc12 Fix compiling on Win32
Damn linker...
2013-12-31 21:49:50 +02:00
Ilari Liusvaara
5b76990e97 Also load plugins from location relative to the executable 2013-12-30 22:57:22 +02:00
Ilari Liusvaara
34eaba54a2 Plugin manager: Atomic overwrites, remove otherstate plugin on rename
- Atomically overwrite existing plugins when adding a new one
- When renaming over plugin, remove target in another state
2013-12-30 02:51:10 +02:00
Ilari Liusvaara
64d498b74e Plugin manager: Mark plugins that failed to load 2013-12-29 23:07:58 +02:00
Ilari Liusvaara
e677ebee61 Clean up error reporting on plugin load failure 2013-12-29 15:46:01 +02:00
Ilari Liusvaara
c6d744b867 Fix off-by-one in counting number of objects in render queue 2013-12-29 15:40:49 +02:00
Ilari Liusvaara
5c3682f445 Lua: render_queue_function 2013-12-29 15:40:11 +02:00
Ilari Liusvaara
0d39cfc692 Wxwidgets: Plugin manager 2013-12-29 00:03:57 +02:00
Ilari Liusvaara
f4eb4e3073 Revert "C interface WIP"
This reverts commit 8e6d005f15.
2013-12-27 11:40:50 +02:00
Ilari Liusvaara
d2e3cf9927 GB: Disassemble/Tracelog fixes for CB xx
- Print bit numbers for BIT/RES/SET properly
- Don't print HL address for Bit ops that don't actually have one.
2013-12-27 11:38:16 +02:00
Ilari Liusvaara
b74d47ae5b JSON Pretty printing support and pretty-print joystick configuration 2013-12-27 11:38:16 +02:00
Ilari Liusvaara
8e6d005f15 C interface WIP 2013-12-24 20:34:33 +02:00
Ilari Liusvaara
3f14664f0c Lua: HSL colors and color modifiers 2013-12-24 20:29:31 +02:00
Ilari Liusvaara
00b961bb55 Some refactoring of the named colors stuff (and a lot more colors) 2013-12-24 12:18:01 +02:00
Ilari Liusvaara
f032ae3b60 Allow color names as color specifications 2013-12-24 04:58:09 +02:00
Ilari Liusvaara
a1fb86eddc Lua: RENDERQUEUE:render: Render queue to DBITMAP 2013-12-24 03:02:45 +02:00
Ilari Liusvaara
5a0fdd430f Fix a bug applying delta gaps on render queue 2013-12-24 02:27:34 +02:00
Ilari Liusvaara
68a360ee6a Framebuffer: Set unused color bits to 1 instead of 0
This makes rendering to effectively have an alpha channel.
2013-12-24 02:18:16 +02:00
Ilari Liusvaara
43952138a3 Lua: Bitmap/renderq object methods 2013-12-23 16:32:11 +02:00
Ilari Liusvaara
f52c20895a Crash autosave: Don't try to save movies with NULL sysregion
1) Such movies are never useful
2) Saving would segfault anyway.
2013-12-22 06:07:33 +02:00
Ilari Liusvaara
42f8862283 Clean up some hash and RNG code 2013-12-22 05:48:58 +02:00
Ilari Liusvaara
b6143a6125 SNES: Make needed directories for build if missing 2013-12-22 04:14:43 +02:00
Ilari Liusvaara
2d87514d4b Fix another compile error (constant in Connect()) 2013-12-21 22:12:46 +02:00
Ilari Liusvaara
53a7777723 Fix compile error on some systems
std::string does not implcitly convert to wxString

Reported by dwangoAC.
2013-12-21 21:26:18 +02:00
Ilari Liusvaara
36f56232b5 Get rid of utf8::to32i2() and extract_token() 2013-12-21 16:36:33 +02:00
Ilari Liusvaara
57a36002d8 Move library patch functions with file image functions 2013-12-21 03:43:59 +02:00
Ilari Liusvaara
b5aaf93f07 SNES: PPU registers 2013-12-21 02:13:45 +02:00
Ilari Liusvaara
92c1c776cc Refactor library filesystem code 2013-12-21 01:27:14 +02:00
Ilari Liusvaara
371c6fd9e3 Refactor library fileimage to dedicated namespace 2013-12-21 01:27:13 +02:00
Ilari Liusvaara
2ce7872f39 Fix compilation of make-ports helper 2013-12-20 20:55:50 +02:00
Ilari Liusvaara
634e9bafe0 File upload: Behave like cancel was clicked on window close 2013-12-20 19:04:55 +02:00
Ilari Liusvaara
59a5b4eefa Clean up hexadecimal<->string conversion 2013-12-20 18:59:11 +02:00
Ilari Liusvaara
78cade7daa Refactor library UTF8 to dedicated namespace 2013-12-20 12:39:41 +02:00
Ilari Liusvaara
299a4c0e3c Refactor library png functions to dedicated namespace 2013-12-20 12:39:40 +02:00
Ilari Liusvaara
94a0f1d6b0 Refactor library settings to dedicated namespace 2013-12-20 10:31:04 +02:00
Ilari Liusvaara
2c4a3a5f84 Refactor library Lua base to dedicated namespace 2013-12-20 02:02:22 +02:00
Ilari Liusvaara
9df05e03a9 Throw internal error instead of crashing if trying to use nonexistent class 2013-12-19 23:34:10 +02:00
Ilari Liusvaara
007ef21d7a Get rid of DECLARE_LUACLASS 2013-12-19 23:25:05 +02:00
Ilari Liusvaara
51aae81c78 keyboard-mapper: Get rid of command.hpp include 2013-12-19 23:25:05 +02:00
Ilari Liusvaara
d610c305cf Move routines from oggopus to opus namespace 2013-12-19 23:25:05 +02:00
Ilari Liusvaara
f3dd0ddc7d Move opus_packet_tick_count() to main opus library code 2013-12-19 23:25:04 +02:00
Ilari Liusvaara
1f8e008d6e loadlib refactoring, add program modules 2013-12-19 16:23:59 +02:00
Ilari Liusvaara
327c3197c4 Refactor library serialization to dedicated namespace 2013-12-19 15:00:21 +02:00
Ilari Liusvaara
1bcbae1163 Refactor library zip functions to dedicated namespace 2013-12-19 15:00:21 +02:00
Ilari Liusvaara
0416962afa Refactor library ogg functions to dedicated namespace 2013-12-19 15:00:21 +02:00
Ilari Liusvaara
040f8ebc63 Refactor library gamepad to dedicated namespace 2013-12-19 07:49:06 +02:00
Ilari Liusvaara
db80bea7a5 Refactor custom_font into framebuffer namespace 2013-12-19 07:34:00 +02:00
Ilari Liusvaara
94f3bfa1df Remove some dead files 2013-12-19 07:13:31 +02:00
Ilari Liusvaara
10dbbf278d Further framebuffer refactoring (pixel formats) 2013-12-19 07:00:43 +02:00
Ilari Liusvaara
dce933b76d Refactor library framebuffer to dedicated namespace 2013-12-19 07:00:43 +02:00
Ilari Liusvaara
4a58db3c25 Extra framebuffer methods 2013-12-19 07:00:43 +02:00
Ilari Liusvaara
69f06ce1b0 Remove some crazy dependencies to keymapper 2013-12-19 02:58:22 +02:00
Ilari Liusvaara
8383dbe580 Build: Fast global need-rebuild detection 2013-12-19 02:35:02 +02:00
Ilari Liusvaara
f89395dbc1 Refactor library dispatch stuff to dedicated namespace 2013-12-19 01:05:48 +02:00
Ilari Liusvaara
dd486e7ff8 Refactor library keyboard to dedicated namespace 2013-12-19 01:05:48 +02:00
Ilari Liusvaara
0cf09e958d Refactor library command functions to dedicated namespace 2013-12-18 22:25:51 +02:00
Ilari Liusvaara
6256506884 Move binarystream functions to dedicated namespace 2013-12-18 22:25:51 +02:00
Ilari Liusvaara
99b526335c Clean up filesystem stuff 2013-12-18 00:31:13 +02:00
Ilari Liusvaara
3dc116b430 Lua: gui.screenshot_bitmap() 2013-12-16 18:21:40 +02:00
Ilari Liusvaara
c9636bc63d Lua: Zip create / enumerate 2013-12-16 18:21:39 +02:00
Ilari Liusvaara
b9298b78b1 Lua: random.* 2013-12-14 19:33:08 +02:00
Ilari Liusvaara
f5184c4fd1 Release regexps before finally exiting 2013-12-14 13:13:21 +02:00
Ilari Liusvaara
7e8a777f5a Initialize some vars in messages window 2013-12-14 13:13:21 +02:00
Ilari Liusvaara
59439aa28b Also catch terminate() for autosave 2013-12-14 01:27:10 +02:00
Ilari Liusvaara
cd80fa3ebf Bitmap font to custom font conversion 2013-12-13 21:45:10 +02:00
Ilari Liusvaara
00b8a193a0 Make parse_value be able to parse 0x notation 2013-12-12 20:17:09 +02:00
Ilari Liusvaara
fcd06b8b1a Fix http_request::_progress 2013-12-08 19:41:30 +02:00
Ilari Liusvaara
a81e59a1f7 Add bsnes alternate poll timings patch 2013-12-07 23:33:54 +02:00
Ilari Liusvaara
cae6687242 Fix compile for bsnes accuracy for real 2013-12-07 22:17:05 +02:00
Ilari Liusvaara
7244f45f0b Don't crash if loaded dynamic library contains a new core 2013-12-07 22:06:46 +02:00
Ilari Liusvaara
53b612265b Merge branch 'rr1-maint' 2013-12-06 07:52:01 +02:00
Ilari Liusvaara
56c1282e48 Backport bsnes/gambatte patches and make emu at least run 2013-12-06 07:51:15 +02:00
Ilari Liusvaara
76b8349abe Gambatte: DC levels fixes 2013-12-05 08:49:54 +02:00
Ilari Liusvaara
bb32cf2a22 Optional background sound autodisable 2013-12-04 18:24:37 +02:00
Ilari Liusvaara
d91a1254b0 Command to set current slot 2013-12-03 21:55:33 +02:00
Ilari Liusvaara
6256f1b0c9 Gambatte: Do not lose colors when ROM is reloaded 2013-12-03 18:01:46 +02:00
Ilari Liusvaara
670031cea3 Fix compile with Gambatte not supporting debug hooks 2013-12-02 09:22:55 +02:00
Ilari Liusvaara
1ab4da5d73 Gameboy disasembler 2013-11-30 23:37:48 +02:00
Ilari Liusvaara
cc0d79566a Attempt to save if emulator is crashing 2013-11-30 13:55:07 +02:00
Ilari Liusvaara
aaa3634d1a Null core: Set the hidden flag 2013-11-30 10:40:29 +02:00
Ilari Liusvaara
be7f8ef115 Don't require to specify bsnes version when building 2013-11-30 10:39:32 +02:00
Ilari Liusvaara
b8b982871d Fix printing of errors from some notifications
The following notifications printed errors to stderr instead of messages
window:
- core_changed
- multitrack_change
- title_change
2013-11-29 10:06:47 +02:00
Ilari Liusvaara
4645fd0e2f lsnes rr2-β13 2013-11-28 22:37:36 +02:00
Ilari Liusvaara
e28121a0e1 Unified support for breakpoints & cheats 2013-11-28 22:22:00 +02:00
Ilari Liusvaara
3bf658c5ea Fold audio device controls to VU meter window 2013-11-27 08:18:27 +02:00
Ilari Liusvaara
29197e124d Messages window: Scroll with wheel 2013-11-26 19:14:41 +02:00
Ilari Liusvaara
c367bf1f9b Messages panel: copy to clipboard / save to file 2013-11-26 19:03:02 +02:00
Ilari Liusvaara
ced144784a Oops, remove some crap lines 2013-11-26 14:53:40 +02:00
Ilari Liusvaara
4b9ae1fbb5 Allow resizing messages window 2013-11-26 14:46:49 +02:00
Ilari Liusvaara
75a0f641f4 Print proper error message if Lua expression parse fails 2013-11-26 08:23:56 +02:00
Ilari Liusvaara
5ccdb1be8c Nuke the helper executables on make clean 2013-11-24 07:48:16 +02:00
Ilari Liusvaara
68e5fddf63 Fix writing movie data
Add missing break that caused extra separators to be written.
2013-11-24 07:26:46 +02:00
Ilari Liusvaara
8e154f30a0 Lua: Fix a typo in error message 2013-11-24 04:44:29 +02:00
Ilari Liusvaara
f04224ecf2 Rewrite parse_authenticate in saner way 2013-11-23 05:37:25 +02:00
Ilari Liusvaara
c8932decef Fix WWW-Autheticate parsing
Fix WWW-Autheticate parsing to be compliant to
draft-ietf-httpbis-p7-auth-25.
2013-11-22 09:33:19 +02:00
Ilari Liusvaara
6eda3fceee BSNES: Compile with accuracy core
Accuracy core doesn't support layer hiding.
2013-11-21 11:37:37 +02:00
Ilari Liusvaara
34011352b7 Fix compilation on Win32 2013-11-18 20:47:14 +02:00
Ilari Liusvaara
a97bf29232 Gambatte: Expose CPU registers 2013-11-18 02:30:38 +02:00
Ilari Liusvaara
82bbf9f5c1 httpauth: Use the no-protocol mode 2013-11-13 22:41:58 +02:00
Ilari Liusvaara
02965a8adb Strip path when autofilling filename 2013-11-11 16:59:13 +02:00
Ilari Liusvaara
1e055b17b2 Movie downloading 2013-11-11 12:04:40 +02:00
Ilari Liusvaara
c7acd46352 Upload UI 2013-11-11 12:04:39 +02:00
Ilari Liusvaara
b46f4153c6 Add command-line file uploader 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
fa854a2bd6 File upload code 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
d0f5b8ece9 Support stream compression 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
d92b321d16 HTTP request code 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
8c2fdff4c8 dh25519 HTTP auth class 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
1ac35c2773 Zip: Allow output to arbitrary ostream 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
3ab4db9aeb Add a slow Curve25519 implementation 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
74f8723fa8 Add Skein hash code 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
2f301e1502 Improve randomness of get_random_hexstring (on I386) 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
a271756c06 Fix in-memory slots 2013-11-11 01:49:36 +02:00
Ilari Liusvaara
fb8910cda5 Support in-memory saves and use those for wxwidgets ROM loading 2013-11-10 13:24:49 +02:00
Ilari Liusvaara
ef0eca0caf Don't crash if setting game name & authors outside project context 2013-11-10 02:00:12 +02:00
Ilari Liusvaara
4e082a0150 Win32 compile fixes 2013-11-08 03:36:39 +02:00
Ilari Liusvaara
3a77967619 Fix output if core tries to output wider than buffer (currently 4096) 2013-11-05 01:45:31 +02:00
Ilari Liusvaara
2fb3f201dc Fix recent movies menu 2013-10-29 17:07:41 +02:00
Ilari Liusvaara
6e729a5595 Lua: bsnes.dump_sprite: Allow overriding row stride 2013-10-29 05:59:16 +02:00
Ilari Liusvaara
64557c2245 Lua: gui.bitmap_hash/gui.palete_hash 2013-10-29 05:54:45 +02:00
Ilari Liusvaara
5661c7ca59 Save bitmaps as PNG
Also:
- Refactor PNG code to have PNG writing support
- Add functions to dump SNES sprites and palettes
2013-10-28 21:15:08 +02:00
Ilari Liusvaara
3cae98e8a5 Try to autodect I386/amd64 2013-10-28 15:38:01 +02:00
Ilari Liusvaara
2ca99739ae Add on_latch to Lua docs 2013-10-27 16:00:20 +02:00
Ilari Liusvaara
e48213f1b9 Oops, forgot to update patchseries for latch notification support 2013-10-27 15:13:03 +02:00
Ilari Liusvaara
50e3a3e0f6 Wxwidgets: Command line history 2013-10-27 15:01:59 +02:00
Ilari Liusvaara
1d2df8ebea Support latch notifications on SNES
This patch is so large since it adds support for passing arguments to
the Lua callback, even if SNES doesn't use those.
2013-10-27 14:41:28 +02:00
Ilari Liusvaara
4f3df85a46 Recent Lua scripts
This is handy if you are developing Lua script, even if using
projects.
2013-10-27 00:51:26 +03:00
Ilari Liusvaara
182accd4b2 JSON: Reduce internal exception spam 2013-10-23 23:45:53 +03:00
Ilari Liusvaara
cda917a45a Make regex thread-safe 2013-10-23 23:43:11 +03:00
Ilari Liusvaara
b9e3a36588 Optimize generic controllers using dynamically generated code
The serialization is not quite on par with the static code,
deserialization is quite a bit faster.
2013-10-23 18:06:33 +03:00
Ilari Liusvaara
99130e1f21 Fix compile for Mac OS X 2013-10-21 13:41:08 +03:00
Ilari Liusvaara
b3417018d4 JSON-based controller descriptions
Also allows creating a new controller type (albeit with not optimal
performance) at runtime.
2013-10-20 21:18:27 +03:00
Ilari Liusvaara
ff59cb6e91 Allow setting AVI scale factors 2013-10-17 16:53:46 +03:00
Ilari Liusvaara
84f0d2f774 If libgcrypt is available but /dev/urandom is not, use libgcrypt for RNG 2013-10-16 12:50:40 +03:00
Ilari Liusvaara
d3eee55445 lsnes rr2-β12 2013-10-15 00:11:33 +03:00
Ilari Liusvaara
8de45f693e lsnes rr1-Δ18ε2 2013-10-14 23:33:07 +03:00
Ilari Liusvaara
a471680ec9 Speed up binary savestate saving
1) "Guess" screenshot and savestate sizes beforehand. Speeds up saving
those greatly.

2) Optionally (on by default) use SHA-256 from libgcrypt, which is greatly
faster than the builtin one.
2013-10-12 11:02:26 +03:00
Ilari Liusvaara
4bcbbb7691 Fix bug that caused save slots always to be semi-text in projects 2013-10-11 00:28:06 +03:00
Ilari Liusvaara
ed8a251b6e Fix more bugs in rerecord counting 2013-10-10 03:15:30 +03:00
Ilari Liusvaara
7101af82fa Use correct file for rerecord counting 2013-10-10 02:22:41 +03:00
Ilari Liusvaara
88dc3f0108 Merge branch 'rr1-maint 2013-10-09 10:29:57 +03:00
Ilari Liusvaara
45447e3c14 Fix crash if reloading ROM with non-default controllers in readwrite mode 2013-10-09 10:29:05 +03:00
Ilari Liusvaara
f19fea0ea4 Refactor rrdata handling
Makes savestate/loadstate fair bit faster
2013-10-08 21:35:01 +03:00
Ilari Liusvaara
ecd8b74ee1 Fix crash if loading rom with non-default controllers active 2013-10-08 18:08:56 +03:00
Ilari Liusvaara
72cc54876a Lua: Also add scatter-gather to memory.* (not just memory2.*) 2013-10-08 17:53:20 +03:00
Ilari Liusvaara
7afdb33c8f Fix compilation on Mac OS X 2013-10-07 12:58:36 +03:00
Ilari Liusvaara
75f90891f6 lsnes rr2-β11 2013-10-06 22:57:40 +03:00
Ilari Liusvaara
163909f907 Change working directory 2013-10-06 22:57:05 +03:00
Ilari Liusvaara
54c257fbbf TAS Input: Compute buffer size for lightgun correctly 2013-10-06 22:48:22 +03:00
Ilari Liusvaara
0bc6e39301 TAS input: Don't bug out on loadstate 2013-10-06 22:31:15 +03:00
Ilari Liusvaara
93056a1993 Multitrack support 2013-10-06 22:13:52 +03:00
Ilari Liusvaara
01a8f5521c TAS Input: Improve lightgun support 2013-10-05 23:41:26 +03:00
Ilari Liusvaara
1561b33dea Fix graphics update hanging 2013-10-05 23:38:58 +03:00
Ilari Liusvaara
861caf2256 Fix uninitialzed variable 2013-10-05 23:19:49 +03:00
Ilari Liusvaara
379db3d4a8 Movie editor: Add panel for inputting axis values 2013-10-05 18:08:18 +03:00
Ilari Liusvaara
4f674a1a1f lsnes rr2-β10 2013-10-04 22:13:33 +03:00
Ilari Liusvaara
8afef341d3 lsnes rr1-Δ18ε1 2013-10-04 21:48:48 +03:00
Ilari Liusvaara
3373dcd53c Merge branch 'rr1-maint' 2013-10-03 12:39:07 +03:00
Ilari Liusvaara
4c8f9c04d2 Don't allow editing reset flags after those have been read 2013-10-03 11:45:37 +03:00
Ilari Liusvaara
504dcb912e Memory search: Save, Load, Undo and Redo 2013-10-02 21:42:46 +03:00
Ilari Liusvaara
ae643213e9 Hex editor: Q12.4 2013-09-29 21:02:02 +03:00
Ilari Liusvaara
e8c868c7d9 Hex editor: Few fixed-point types 2013-09-29 20:51:31 +03:00
Ilari Liusvaara
1eda43114c Hex editor: Add watch 2013-09-29 20:50:06 +03:00
Ilari Liusvaara
ecd872d6c3 Memory search: Select in hex editor 2013-09-29 20:22:38 +03:00
Ilari Liusvaara
afbc8ae932 Memory search: Poke 2013-09-29 19:22:10 +03:00
Ilari Liusvaara
7c1acd2219 Hex editor 2013-09-29 18:35:15 +03:00
Ilari Liusvaara
06f099f877 Fix Win32 (or GCC 4.8?) compilation 2013-09-27 22:57:24 +03:00
Ilari Liusvaara
a41894d5d3 Merge branch 'rr1-maint' 2013-09-27 20:54:54 +03:00
Ilari Liusvaara
3657e593d6 Lua: Tilemaps 2013-09-27 20:53:09 +03:00
Ilari Liusvaara
68e8630308 Merge branch 'rr1-maint' 2013-09-27 14:25:46 +03:00
Ilari Liusvaara
1110596977 Fix wrong use of lua_error
Lua_error should only be used in C functions and closures directly
registered with Lua. Otherwise errors should trigger exceptions.
2013-09-27 14:22:52 +03:00
Ilari Liusvaara
59ef6961e3 Merge branch 'rr1-maint' 2013-09-27 10:47:19 +03:00
Ilari Liusvaara
a42c0bf6ea Extend userdata printing 2013-09-27 10:36:19 +03:00
Ilari Liusvaara
22cba85a37 Merge branch 'rr1-maint' 2013-09-27 04:43:44 +03:00
Ilari Liusvaara
ba1d20dda5 Lua: print() can print any type, add tostringx() for print-to-string 2013-09-27 04:15:13 +03:00
Ilari Liusvaara
513534a53a Merge branch 'rr1-maint' 2013-09-26 15:31:57 +03:00
Ilari Liusvaara
837aa6def0 Fix diagonal arrows 2013-09-26 15:30:04 +03:00
Ilari Liusvaara
2bd43d53d5 Merge branch 'rr1-maint' 2013-09-26 13:46:51 +03:00
Ilari Liusvaara
e1579c3746 Lua: gui.arrow 2013-09-26 13:12:36 +03:00
Ilari Liusvaara
e4f656185f Fix UI blocking on hash verification against movie 2013-09-26 00:05:39 +03:00
Ilari Liusvaara
e80185a8b9 Fix a bug where quitting emulator would only unpause it 2013-09-25 23:42:11 +03:00
Ilari Liusvaara
b3b14a6a0d Hashing: Show total work size, and don't accidentally block the UI 2013-09-25 23:34:29 +03:00
Ilari Liusvaara
6772bcf8d2 ROM guessing 2013-09-25 13:45:34 +03:00
Ilari Liusvaara
92093e7062 Merge branch 'rr1-maint' 2013-09-24 13:37:24 +03:00
Ilari Liusvaara
8301de15b2 Merge remote-tracking branch 'origin/rr1-maint' into rr1-maint 2013-09-24 13:35:36 +03:00
Ilari Liusvaara
5568de778c Merge branch 'rr1-maint' 2013-09-24 13:01:55 +03:00
Ilari Liusvaara
9a714d0c7f Fix NULL pointer dereference if gametype changes from NULL 2013-09-24 12:59:55 +03:00
Ilari Liusvaara
01c6855072 runuifun: Only call the function once 2013-09-24 12:59:29 +03:00
Ilari Liusvaara
69b1fd05b2 Fix compilation with wchar_t-based wxString 2013-09-23 12:26:49 +03:00
Ilari Liusvaara
40578782dc Support Multi-ROM projects 2013-09-22 17:39:52 +03:00
Ilari Liusvaara
53674105c1 Cut the ridiculous exception spam from file probing 2013-09-21 23:25:15 +03:00
Ilari Liusvaara
2477d45f29 Fix compilation with wchar_t based wxstring 2013-09-18 14:32:04 +03:00
Ilari Liusvaara
a6c13a7c9d Scatter-gather value read/write 2013-09-15 18:02:58 +03:00
Ilari Liusvaara
982c617a4d Merge branch 'rr1-maint' 2013-09-14 16:31:05 +03:00
Ilari Liusvaara
a48b226af5 Use ROM hints for default request filename 2013-09-14 16:30:08 +03:00
Ilari Liusvaara
70ad5377b8 Save ROM hints 2013-09-14 16:29:58 +03:00
Ilari Liusvaara
702a4b8c4b Use hints for default filename on ROM load request 2013-09-14 15:26:20 +03:00
Ilari Liusvaara
d25f5bbe78 Make symbolic constant ROM_SLOT_COUNT for ROM slot count 2013-09-14 12:26:57 +03:00
Ilari Liusvaara
83dcbee83a Save ROM name hints 2013-09-13 21:34:59 +03:00
Ilari Liusvaara
82440c44bb Fix compilation if wxString is wchar_t-based 2013-09-13 11:53:45 +03:00
Ilari Liusvaara
2168f85b30 Share file image data among copied instances 2013-09-07 08:26:09 +03:00
Ilari Liusvaara
4bfb16ea6c binary_input_stream: Handle nested extensions correctly
Binary savestates don't contain nested extensions, but...
2013-09-06 21:42:26 +03:00
Ilari Liusvaara
c253b2a165 Make some global variables fields 2013-09-04 22:37:28 +03:00
Ilari Liusvaara
ffb68eb4fb Merge branch 'rr1-maint'
Conflicts:
	src/core/moviedata.cpp
2013-09-03 23:30:18 +03:00
Ilari Liusvaara
f1a3b105f2 Fix movie initialization on ROM load
The movie should be fully reinitialized if:
1) Core type changes, or
2) Load is in readonly mode.
2013-09-03 23:07:16 +03:00
Ilari Liusvaara
c0f19435e4 Merge branch 'rr1-maint' 2013-09-03 22:28:14 +03:00
Ilari Liusvaara
61482629ee If loading movie/savestate without ROM, prompt for one 2013-09-03 22:27:42 +03:00
Ilari Liusvaara
d0bf4e220a Mark some globals as const 2013-09-03 21:12:15 +03:00
Ilari Liusvaara
2f80b044a5 Fix compiling if Boost threads are used 2013-09-03 14:18:03 +03:00
Ilari Liusvaara
67484f1ea5 enumerate_directory: Don't list . and .. 2013-09-02 23:30:30 +03:00
Ilari Liusvaara
f054cfb61c Check JSON integer values before trying to parse
This cuts down exception spam.
2013-09-02 23:27:17 +03:00
Ilari Liusvaara
a7e78b4aea Remove lanczos.cpp, Nothing needs it 2013-09-02 23:23:33 +03:00
Ilari Liusvaara
dda9460c3d Refactor binary file saving/loading routines 2013-09-02 16:57:23 +03:00
Ilari Liusvaara
13eee961a7 Refactor image slots code
- Refactor image slot code to be common code
- Hash large files with progress feedback
- Cache hashes of large files
2013-09-01 15:05:08 +03:00
Ilari Liusvaara
06f3f37626 Merge branch 'rr1-maint' 2013-08-31 11:57:33 +03:00
Ilari Liusvaara
f9e0abd0bd Support blitting BITMAP+PALETTE -> DBITMAP 2013-08-31 11:49:25 +03:00
Ilari Liusvaara
e10a7ccbd4 Merge branch 'rr1-maint' 2013-08-31 01:47:36 +03:00
Ilari Liusvaara
f4f052589b Backport support for SGB GB WRAM and GB HRAM 2013-08-31 01:46:50 +03:00
Ilari Liusvaara
d782eb0125 Merge remote-tracking branch 'origin/master' 2013-08-30 21:31:27 +03:00
Ilari Liusvaara
f6efcdef24 Add the installer script 2013-08-30 18:06:04 +03:00
Ilari Liusvaara
85cf485807 Properly change core if ROM is loaded by request 2013-08-27 12:25:12 +03:00
Ilari Liusvaara
0d01d22d83 Allow RAM initialization from movie file 2013-08-27 02:11:59 +03:00
Ilari Liusvaara
a355917b70 Support SGB GB HRAM too 2013-08-26 10:24:50 +03:00
Ilari Liusvaara
da20b6d0cf Add state mapping for SGB Gameboy CPU 2013-08-26 02:31:02 +03:00
Ilari Liusvaara
430f1a1afc Fix memory search datatype names 2013-08-26 02:20:35 +03:00
Ilari Liusvaara
b3d7dc5786 Add some missing files 2013-08-25 20:12:52 +03:00
Ilari Liusvaara
0ac78762a2 Fix slotinfo for binary save slots 2013-08-25 17:44:57 +03:00
Ilari Liusvaara
bf0d0b7ac0 If movie is loaded without ROM, prompt for ROM 2013-08-25 17:32:56 +03:00
Ilari Liusvaara
995dcf1cf2 Fix reading binary movies with unknown extensions 2013-08-25 17:32:01 +03:00
Ilari Liusvaara
4d5a088496 Support float/double memory watch/search 2013-08-25 04:06:46 +03:00
Ilari Liusvaara
dbbf274110 Support 24-bit memory watches / memory searching 2013-08-24 22:16:43 +03:00
Ilari Liusvaara
0e479a907b Simplify memory search by using templates 2013-08-24 21:05:10 +03:00
Ilari Liusvaara
ef3509cbcf Clean up reading of values of various types 2013-08-24 20:29:23 +03:00
Ilari Liusvaara
c3701056c6 Simplify memory space read/write code 2013-08-24 11:29:20 +03:00
Ilari Liusvaara
fa18a739e0 Some libgambatte fixes 2013-08-23 00:55:35 +03:00
Ilari Liusvaara
6a0f9750b2 Lua: Pass name of method to various lua class methods 2013-08-22 22:34:17 +03:00
Ilari Liusvaara
1909357f99 Lua: lua_class<T>::bind_multi (initializer lists are useful) 2013-08-22 00:11:34 +03:00
Ilari Liusvaara
e7472118a5 Lua: Use full userdata to store class binds 2013-08-21 23:32:48 +03:00
Ilari Liusvaara
9092dea931 Lua: Automatically pass Lua state to lua class ctors 2013-08-21 23:19:20 +03:00
Ilari Liusvaara
17f8603ec5 Make lua_obj_pin<T> copyable 2013-08-21 19:24:00 +03:00
Ilari Liusvaara
ae7f99b49c Support "wrambank" register (read-only) for DMG/CGB 2013-08-21 18:57:03 +03:00
Ilari Liusvaara
7026453768 Lua: gui.synchronous_repaint() 2013-08-21 04:14:53 +03:00
Ilari Liusvaara
e2b08d9c83 SNES: Support "compact form" where delay resets aren't supported 2013-08-20 01:20:34 +03:00
Ilari Liusvaara
e4db2486b5 Be more careful when parsing macros
... Don't throw random exceptions when encountering something of wrong
type, instead throw exception with more proper message.
2013-08-19 09:22:09 +03:00
Ilari Liusvaara
c4bcddbfbd Reserve 1 byte for each macro button instead of 2 bits 2013-08-18 23:11:25 +03:00
Ilari Liusvaara
4feb4b6290 Macros: Support ? modifier for macros (press at random) 2013-08-18 23:03:43 +03:00
Ilari Liusvaara
a38ce6b99e Make port_type::legal based on data instead of generated 2013-08-17 17:58:43 +03:00
Ilari Liusvaara
ccd4c2d5b8 lsnes-dumpavi: Support specifying dump length as overdump length 2013-08-15 22:55:59 +03:00
Ilari Liusvaara
76c9e338c5 Remove leftover debug messages 2013-08-14 23:54:05 +03:00
Ilari Liusvaara
065b59cd64 Fix parsing Oggopus files with tags spanning multiple pages 2013-08-14 23:52:35 +03:00
Ilari Liusvaara
782caddfa8 Portaudio: Heed defaults, don't use full-duplex mode 2013-08-14 19:49:04 +03:00
Ilari Liusvaara
707c1a4041 Joystick dialog: Compactify
... Otherwise the dialog will be frickin' big, especially with things like
PS3 controller using EVDEV driver.
2013-08-14 14:40:06 +03:00
Ilari Liusvaara
29fbf12e90 Move E() from joystick code to general text panel code 2013-08-13 11:37:02 +03:00
Ilari Liusvaara
d4698e6380 Joystick dialog: Center one-digit numbers 2013-08-12 22:29:52 +03:00
Ilari Liusvaara
9ebf20f19c Much more compact joystick dialog 2013-08-12 13:27:38 +03:00
Ilari Liusvaara
e6884c194c Tweak the video options panel 2013-08-12 12:39:28 +03:00
Ilari Liusvaara
29f25ce1cb Some sort of fullscreen mode 2013-08-11 22:37:11 +03:00
Ilari Liusvaara
5298eb04f1 Replace X/Y scale with one scale + optional AR correction 2013-08-11 21:17:29 +03:00
Ilari Liusvaara
156974f362 Settings dialog: Support right click context menu 2013-08-11 19:36:00 +03:00
Ilari Liusvaara
be852e63e1 Use tree control instead of pair of listboxes in hotkeys&controls 2013-08-11 16:48:35 +03:00
Ilari Liusvaara
408002eec1 Config dialog / advanced: Treat doubleclick as change click 2013-08-11 13:39:32 +03:00
Ilari Liusvaara
07d3065afc Don't offer horizontal scale factor as value of verical factor 2013-08-11 01:34:03 +03:00
Ilari Liusvaara
0192d46adb Lua: Forbid loading binary chunks
Binary Lua chunks are just plain unsafe.
2013-08-11 00:17:23 +03:00
Ilari Liusvaara
9f9bddccb6 Lua: open_file
This variant has support for relative file locating and reading inside
.zip files.
2013-08-10 23:33:46 +03:00
Ilari Liusvaara
e3bcf53676 Gambatte: Allow native-rate sound output 2013-08-10 11:51:30 +03:00
Ilari Liusvaara
d7dc71a6e4 Gambatte: DMG palette manipulation 2013-08-10 11:41:52 +03:00
Ilari Liusvaara
208228bc7e Lua: gui.bitmap_pget: Read pixels from bitmap 2013-08-08 20:55:42 +03:00
Ilari Liusvaara
212c819416 Lua: gui.kill_frame: Omit this frame from video dump 2013-08-08 20:41:29 +03:00
Ilari Liusvaara
f79359a526 Gambatte: First emit video, then sound 2013-08-08 18:41:52 +03:00
Ilari Liusvaara
3876f60183 SNES: Call callbacks in correct Lua state if there are multiple 2013-08-08 12:19:49 +03:00
Ilari Liusvaara
11655fb0d8 Split callback and load functions to their own categories 2013-08-07 22:10:58 +03:00
Ilari Liusvaara
3b1383232e Cleanup controller and keymapper stuff on exit 2013-08-07 22:06:38 +03:00
Ilari Liusvaara
11b83ef0ff Properly handle zip_reader trying to open something that isn't .zip 2013-08-07 21:26:52 +03:00
Ilari Liusvaara
b3f8f7f1b7 Decouple sets of functions from Lua states 2013-08-07 17:31:09 +03:00
Ilari Liusvaara
da1fb14e24 Lua: callback.foo:register/callback.foo:unregister 2013-08-06 20:55:03 +03:00
Ilari Liusvaara
e2ecb61db0 Don't call action_state_updated() while emulator is starting up 2013-08-06 16:49:37 +03:00
Ilari Liusvaara
f4fd9cfa09 Merge remote-tracking branch 'origin/master' 2013-08-06 16:17:54 +03:00
Ilari Liusvaara
7b67bfaac4 Lua: callback.register/callback.unregister 2013-08-06 16:17:01 +03:00
Ilari Liusvaara
2fcd8b391d Merge remote-tracking branch 'origin/master' 2013-08-05 12:31:43 +03:00
Ilari Liusvaara
7da4621285 Don't show joystics tab/dialog if there are no joysticks 2013-08-05 12:30:38 +03:00
Ilari Liusvaara
89c4f45f36 lsnes rr2-β9 2013-08-04 20:52:55 +03:00
Ilari Liusvaara
e436cabd72 Mac OS X compile fixes 2013-08-04 20:51:11 +03:00
Ilari Liusvaara
3cb5d08c86 Lua: Implement function to resolve filename w.r.t. another 2013-08-04 17:20:27 +03:00
Ilari Liusvaara
25f63a8c09 Some documentation about @@LUA_SCRIPT_FILENAME@@ 2013-08-04 17:16:11 +03:00
Ilari Liusvaara
b66c3b4777 Support packed Lua scripts in load dialog 2013-08-04 14:50:41 +03:00
Ilari Liusvaara
9f546c38a9 Lua: Add basename'd forms for gui.bitmap_load{,_png,_pal} 2013-08-04 14:50:41 +03:00
Ilari Liusvaara
750608ad56 Lua: loadfile/dofile: Support basenames
Also adds support for special token '@@LUA_SCRIPT_FILENAME@@', which
will be replaced with filename of Lua script.
2013-08-04 14:50:41 +03:00
Ilari Liusvaara
0a3fc9ccc6 Lua: gui.adjust_transparency 2013-08-04 12:16:09 +03:00
Ilari Liusvaara
78c6ea99df Fix configure->configure 2013-08-03 20:30:57 +03:00
Ilari Liusvaara
75e5d53912 Call do_sample from audioapi_submit_buffer 2013-08-03 18:54:13 +03:00
Ilari Liusvaara
32b98a880c Kill port type IDs
Those IDs are not used for anything.
2013-08-03 17:07:13 +03:00
Ilari Liusvaara
85d48a9349 Split Lua function reference to its own manual 2013-08-03 14:31:19 +03:00
Ilari Liusvaara
eaf3d4be72 Lua: Convert savestate to rewind point 2013-08-03 10:51:41 +03:00
Ilari Liusvaara
eb7c213985 Nuke a no longer used function 2013-08-03 10:25:18 +03:00
Ilari Liusvaara
05d25513fb Improve inverse_bind/controller_key handling
This allows unbounded number of keys in inverse bind or controller_key,
instead of the old limits of 2 and 1.
2013-08-02 21:11:26 +03:00
Ilari Liusvaara
7b7a96bfa3 Fix wxWigdets joystick driver
Also fix deadlock if joystick driver tries to report nonexistent axis,
button or hat.
2013-08-02 15:01:33 +03:00
Ilari Liusvaara
7a89929868 Fix Win32 joystick driver to compile
Also try to fix other (MacOSX and wxWidgets) joystick drivers to
compile (totally untested).
2013-08-02 12:35:54 +03:00
Ilari Liusvaara
2308401234 Refactor joystick code
Gamepads are now remembered across emulator restarts
2013-08-02 11:50:56 +03:00
Ilari Liusvaara
19040b2033 Fix binary file saving (renames) 2013-07-31 15:38:35 +03:00
Ilari Liusvaara
2b1ffb9f17 moviefile.cpp: Need windows.h on Win32 2013-07-30 22:07:24 +03:00
Ilari Liusvaara
45300b3a2b wxWidgets: Refactor the settings dialog 2013-07-30 13:51:56 +03:00
Ilari Liusvaara
12ec5a9dcf Clip analog macros going out-of-range correctly 2013-07-29 23:16:32 +03:00
Ilari Liusvaara
75b3e79ea7 Binary movies support 2013-07-29 22:16:23 +03:00
Ilari Liusvaara
a2fc2a19ec New file dialogs code 2013-07-27 14:49:29 +03:00
Ilari Liusvaara
d23d312e78 Merge branch 'rr1-maint' 2013-07-25 22:14:38 +03:00
Ilari Liusvaara
2095d7858e lsnes rr1-Δ18 2013-07-25 16:42:33 +03:00
Ilari Liusvaara
59710f8f38 Merge branch 'rr1-maint' 2013-07-24 19:57:08 +03:00
Ilari Liusvaara
79dd270a7e Lua methods for handling movies as objects 2013-07-24 19:03:48 +03:00
Ilari Liusvaara
cd9ee7be69 Merge branch 'rr1-maint' 2013-07-24 13:38:40 +03:00
Ilari Liusvaara
7186e515ff Lua: Allow shortening "evaluate-lua" to "L". 2013-07-24 13:34:04 +03:00
Ilari Liusvaara
740eaf17de Remove moviestate support
Moviestate was supported for backward compatiblity to some pre-rr0
version savestates, but those savestates are not compatible anyway due
to poll vectors being constructed differently.
2013-07-24 01:22:38 +03:00
Ilari Liusvaara
8c7e8a1636 Merge branch 'rr1-maint' 2013-07-24 00:42:26 +03:00
Ilari Liusvaara
6d6570ecea Support Y-cabled gamepad16 2013-07-23 23:48:09 +03:00
Ilari Liusvaara
d8ab482470 Merge branch 'rr1-maint' 2013-07-23 13:10:52 +03:00
Ilari Liusvaara
15679e0776 Lua: Don't crash if some method throws 2013-07-23 13:01:47 +03:00
Ilari Liusvaara
d84b665333 Add missing file 2013-07-21 18:50:45 +03:00
Ilari Liusvaara
53b75adcf2 Automatically build index triple and legacy-pcid maps
All cores build these the same way, so make the code common.
2013-07-20 14:35:16 +03:00
Ilari Liusvaara
d10c863a56 Used_indices can be defined the same way for all ports, do so 2013-07-20 12:35:21 +03:00
Ilari Liusvaara
a149c67c40 Show dialog on important errors 2013-07-19 17:21:52 +03:00
Ilari Liusvaara
ff86d2f0c2 Merge branch 'rr1-maint' 2013-07-17 22:58:24 +03:00
Ilari Liusvaara
a8a1f09e94 Lua: Allow direct loading of PNG/PAL/BITMAP from string 2013-07-17 22:28:54 +03:00
Ilari Liusvaara
319d23ca69 Merge branch 'rr1-maint' 2013-07-17 15:22:07 +03:00
Ilari Liusvaara
da6d1256d2 (D)Bitmap decoding from PNG support 2013-07-17 14:58:53 +03:00
Ilari Liusvaara
5923c4def6 Merge branch 'rr1-maint'
Conflicts:
	src/lua/input.cpp
2013-07-13 12:53:25 +03:00
Ilari Liusvaara
6e2b56ddbb Fix reading system controls using input.get2 2013-07-13 12:51:50 +03:00
Ilari Liusvaara
b9f44d4f20 Merge branch 'macosx-joystick2' 2013-07-12 21:27:15 +03:00
Ilari Liusvaara
9275e5cb93 memory.get_lag_flag/memory.set_lag_flag 2013-07-08 20:42:37 +03:00
Ilari Liusvaara
97e47ccb9b Mac OS X joystick support 2013-07-08 00:32:23 +03:00
Ilari Liusvaara
284d3d78c1 Merge branch 'rr1-maint' 2013-07-07 19:58:01 +03:00
Ilari Liusvaara
9bcb9c7760 Movie editor copy&paste 2013-07-07 19:53:08 +03:00
Ilari Liusvaara
4c0dde5678 Fix creating new project after forcing core 2013-07-07 17:19:35 +03:00
Ilari Liusvaara
8fe4f70d9a Lots of dispatch refactoring 2013-07-07 13:54:56 +03:00
Ilari Liusvaara
95bbae153e Whitespace cleanup 2013-07-06 23:21:11 +03:00
Ilari Liusvaara
eed387af93 Core cleanups
- Use initializer lists for actions
- Move some type methods to be core methods
2013-07-06 23:08:19 +03:00
Ilari Liusvaara
9d440ace13 More cleanup via initializer lists 2013-07-06 20:41:32 +03:00
Ilari Liusvaara
338a1d8a1b Oops, remove rest of references to slots.inc, which no longer exists 2013-07-06 17:44:23 +03:00
Ilari Liusvaara
ac06feeeba Cleanup image slot stuff using initializer lists 2013-07-06 14:46:12 +03:00
Ilari Liusvaara
b10a560611 Kill unused code 2013-07-04 22:37:29 +03:00
Ilari Liusvaara
5386986129 Pull instead of push reset vectors
Pushing anything global from cores is very dubious to do...
2013-07-04 20:42:37 +03:00
Ilari Liusvaara
9538f19c92 Extend core actions
- Toggleable actions
- Enumerated choices
- Lua interface
- Nested action menus
- Fix actions disabled from the start
2013-07-04 18:17:07 +03:00
Ilari Liusvaara
ec23d31819 Merge remote-tracking branch 'origin/master' 2013-07-04 12:42:18 +03:00
Ilari Liusvaara
a111afad42 Use virtual methods instead of pointers for core stuff 2013-07-03 18:21:16 +03:00
Ilari Liusvaara
7616cccb7a Add another missing file 2013-07-03 12:57:58 +03:00
Ilari Liusvaara
84faf2f42e Rip out remainder of that old unmaintained dump code 2013-07-03 04:10:24 +03:00
Ilari Liusvaara
08e5f6acc9 Probably buggy SNES disassembler 2013-07-03 04:06:40 +03:00
Ilari Liusvaara
6ce7b3dc7b Oops, Fix compilation of core actions related stuff 2013-07-01 11:32:41 +03:00
Ilari Liusvaara
b9fedf0dde Remove long-unmaintained SNES-specific dump format 2013-06-30 14:33:57 +03:00
Ilari Liusvaara
2995be7f12 Merge branch 'core-actions' 2013-06-30 14:07:10 +03:00
Ilari Liusvaara
839304f701 Core actions 2013-06-30 13:20:23 +03:00
Ilari Liusvaara
2874a1e7c5 More cleanup via initializer lists 2013-06-28 17:57:45 +03:00
Ilari Liusvaara
cd8b2e7d39 Allow specifying ROM type in file load dialog 2013-06-26 14:48:19 +03:00
Ilari Liusvaara
b221e29552 Fix reading byte-sized values via read-(s)byte 2013-06-26 06:13:55 +03:00
Ilari Liusvaara
bcecac1e66 Fix reading signed values via read-s* 2013-06-26 06:10:49 +03:00
Ilari Liusvaara
c6025beccb lsnes rr2-β8 2013-06-24 17:34:27 +03:00
Ilari Liusvaara
c1c5a3f84d lsnes rr1-Δ17ε4 2013-06-24 17:18:19 +03:00
Ilari Liusvaara
30fe476014 Backport subtitle generation fix 2013-06-24 17:09:15 +03:00
Ilari Liusvaara
fbf7c48b84 More code simplification using C++11 initializers. 2013-06-23 15:57:21 +03:00
Ilari Liusvaara
992096c8c5 Macro support 2013-06-23 15:57:20 +03:00
Ilari Liusvaara
511a2aef1c JSON library 2013-06-23 15:57:20 +03:00
Ilari Liusvaara
f87a5fd453 copy_from_utf8_2 (iterators to std::function) 2013-06-21 22:14:05 +03:00
Ilari Liusvaara
3206d206fe Keep memory watches on project creation 2013-06-21 22:14:00 +03:00
Ilari Liusvaara
9ac0d00d17 Fix subtitle generation 2013-06-21 08:06:44 +03:00
Ilari Liusvaara
0cf62d0d58 SNES: SMP opcode disassemble 2013-06-21 00:26:48 +03:00
Ilari Liusvaara
5fb06d7e78 Fix Lua functions when called in coroutines 2013-06-21 00:26:48 +03:00
Ilari Liusvaara
14327834ce Expand some comments about core bindings 2013-06-15 14:22:46 +03:00
Ilari Liusvaara
dfd0453feb Use C++11 initializer lists to simplify core binding code 2013-06-15 12:53:28 +03:00
Ilari Liusvaara
83b91168d3 Oh, found some funky functions from bsnes... 2013-06-14 17:29:40 +03:00
Ilari Liusvaara
64683d6908 Merge branch 'rr1-maint'
Conflicts:
	src/core/command.cpp
	src/lua/ibind.cpp
	src/platform/wxwidgets/settings.cpp
2013-06-14 14:09:43 +03:00
Ilari Liusvaara
081adfb565 Implicit creation of inverse binds for aliases 2013-06-14 13:40:08 +03:00
Ilari Liusvaara
1866f480b2 Wxwidgets: Don't print narrow chacters into wide stream 2013-06-09 16:10:20 +03:00
Ilari Liusvaara
f091268ef4 Is maximum of 999,999,999 savestate slots enough? 2013-06-07 16:16:33 +03:00
Ilari Liusvaara
bd592f223d Merge branch 'rr1-maint' 2013-05-30 23:37:43 +03:00
Ilari Liusvaara
3e2e4379dc Fix text bounding if drawing left or up from display 2013-05-30 23:37:29 +03:00
Ilari Liusvaara
985e4c6327 Merge branch 'rr1-maint'
Conflicts:
	src/lua/lua.cpp
2013-05-30 04:17:03 +03:00
Ilari Liusvaara
015bd796f6 Save/Restore host memory across UNSAFEREWINDs 2013-05-30 04:13:59 +03:00
Ilari Liusvaara
e31084cc2b Merge branch 'rr1-maint' 2013-05-29 20:20:31 +03:00
Ilari Liusvaara
1ee295f6de Unconditionally reload RTC state on loadstate 2013-05-29 20:20:10 +03:00
Ilari Liusvaara
0658872a7f Fix compilation if wxstring is wide character based 2013-05-27 12:48:01 +03:00
Ilari Liusvaara
0243e3fc53 Close ROM function 2013-05-23 01:00:37 +03:00
Ilari Liusvaara
b404184412 Handle project switch as special kind of loadstate
This avoids all manner of special cases.
2013-05-23 00:31:45 +03:00
Ilari Liusvaara
1be1d0ff72 wxwidgets: Initialize size_changed in text panel renderer 2013-05-20 20:02:05 +03:00
Ilari Liusvaara
7f6468ce03 Report port internal names not hnames to Lua 2013-05-20 01:25:17 +03:00
Ilari Liusvaara
3bcddd27cc Support runtime loading of libopus 2013-05-19 14:49:25 +03:00
Ilari Liusvaara
d531dc6afc opus.hpp: Untested (but compiles) support for surround API 2013-05-18 11:56:35 +03:00
Ilari Liusvaara
54ebc86762 Add special change dialogs for numeric and path settings 2013-05-17 21:37:53 +03:00
Ilari Liusvaara
2b7268a0dc Support enumerated settings 2013-05-17 17:22:24 +03:00
Ilari Liusvaara
7039c28305 Change boolean settings without prompting 2013-05-17 15:25:33 +03:00
Ilari Liusvaara
b9f20f2d35 Don't change settings in UI thread 2013-05-17 14:20:19 +03:00
Ilari Liusvaara
6fc02d459b Allow per-variable names for boolean values 2013-05-17 11:29:34 +03:00
Ilari Liusvaara
93d0263404 Merge branch 'rr1-maint'
Conflicts:
	manual.txt
	src/lua/gui-core.cpp
2013-05-15 17:38:00 +03:00
Ilari Liusvaara
8affdb3edc Lua: gui.delta_<class>_gap 2013-05-15 17:34:26 +03:00
Ilari Liusvaara
b4ad4adc09 Merge branch 'rr1-maint'
Conflicts:
	src/core/inthread.cpp
2013-05-14 22:12:08 +03:00
Ilari Liusvaara
64a4317818 Fix Oggopus export Vendor vs. ENCODER 2013-05-14 22:11:13 +03:00
Ilari Liusvaara
a539c58cee Fix Oggopus export Vendor vs. ENCODER 2013-05-14 22:10:13 +03:00
Ilari Liusvaara
c366723065 Fix memory watching with project active 2013-05-13 20:10:41 +03:00
Ilari Liusvaara
6c77539a93 Merge branch 'rr1-maint' 2013-05-13 20:05:39 +03:00
Ilari Liusvaara
2c89ce8f60 Backport Mac OS X build fix 2013-05-13 20:05:21 +03:00
Ilari Liusvaara
059f1f37d7 Movie editor: Fix repainting 2013-05-13 20:05:10 +03:00
Ilari Liusvaara
1a8a4b049a Merge remote-tracking branch 'origin/master' 2013-05-13 19:56:08 +03:00
Ilari Liusvaara
c233f88c2a Fix desync if loading movie file via projec load 2013-05-13 19:55:59 +03:00
Ilari Liusvaara
c11b6de9e1 Add some missing headers to fix compilation on Mac OS X 2013-05-13 13:25:13 +03:00
Ilari Liusvaara
bb9d6a8ce2 Fix bug causing ext0...ext3 to sometimes appear pressed on 12btn gamepad 2013-05-12 23:55:17 +03:00
Ilari Liusvaara
19828f169b Lua: memory2 2013-05-12 16:15:18 +03:00
Ilari Liusvaara
fd16f6f6eb Lua: Don't crash if method execution throws 2013-05-12 15:02:38 +03:00
Ilari Liusvaara
2cf05458bc Lua: Fix lua_state::do_once() 2013-05-12 13:48:52 +03:00
Ilari Liusvaara
b0edee81c8 Projects support 2013-05-12 11:18:59 +03:00
Ilari Liusvaara
192ac85aa2 Lua: Move some stuff 2013-05-12 11:18:59 +03:00
Ilari Liusvaara
69597313e6 Merge branch 'rr1-maint' 2013-05-11 15:58:26 +03:00
Ilari Liusvaara
2f868547df Memory search: Code cleanup 2013-05-11 15:51:04 +03:00
Ilari Liusvaara
6029a92914 Fix statusbar breakage when not recording 2013-05-11 13:43:28 +03:00
Ilari Liusvaara
a2cbad39ab Merge branch 'rr1-maint' 2013-05-11 12:56:20 +03:00
Ilari Liusvaara
c725e4e874 wxwidgets: Refactor scrollbar handling 2013-05-11 12:52:43 +03:00
Ilari Liusvaara
6677ef19b1 Merge branch 'rr1-maint'
Conflicts:
	src/platform/wxwidgets/memorysearch.cpp
	src/platform/wxwidgets/status.cpp
	src/platform/wxwidgets/textrender.cpp
2013-05-11 02:35:11 +03:00
Ilari Liusvaara
9dc12ae746 Wxwidgets: Improve memory search and refactor text panel code 2013-05-11 02:19:49 +03:00
Ilari Liusvaara
8b1b021d00 Lua: Throw instead of raising error if VMA is invalid 2013-05-10 16:44:44 +03:00
Ilari Liusvaara
d88cb4fb15 Merge branch 'rr1-maint'
Conflicts:
	src/core/memorymanip.cpp
	src/platform/wxwidgets/memorysearch.cpp
2013-05-10 13:34:12 +03:00
Ilari Liusvaara
d1c8435fa2 Merge remote-tracking branch 'origin/rr1-maint' into rr1-maint 2013-05-10 13:31:57 +03:00
Ilari Liusvaara
96c1f417c5 Move buttons to context menu, add option to disqualify address 2013-05-10 13:31:08 +03:00
Ilari Liusvaara
acec789323 Autoupdate memory search by default 2013-05-10 12:55:05 +03:00
Ilari Liusvaara
30943200fe Commentary tracks: Remove support for old Opus format (use OggOpus) 2013-05-08 15:36:56 +03:00
Ilari Liusvaara
1daca22d81 Merge branch 'rr1-maint' 2013-05-08 09:38:55 +03:00
Ilari Liusvaara
8c4b8e1605 Backport fixes from master
- Ogg: Properly ininitialize data_count on read ogg pages
- Movie editor: Fix displaying unicode characters
2013-05-08 09:35:07 +03:00
Ilari Liusvaara
0b8ab9324c Ogg: Properly ininitialize data_count on read ogg pages 2013-05-08 00:16:31 +03:00
Ilari Liusvaara
9f7008bf2a Movie editor: Fix displaying unicode characters 2013-05-06 18:04:26 +03:00
Ilari Liusvaara
3f493d24d1 Lua: Allow creation of commands 2013-05-04 18:26:18 +03:00
Ilari Liusvaara
089602bd77 Merge branch 'rr1-maint' 2013-05-03 16:02:37 +03:00
Ilari Liusvaara
3ded324737 Merge remote-tracking branch 'origin/rr1-maint' into rr1-maint 2013-05-03 16:01:28 +03:00
Ilari Liusvaara
9a1cbc2207 Merge branch 'rr1-maint' 2013-05-03 15:42:58 +03:00
Ilari Liusvaara
f051aabb57 Fix compilation if size_t != uint64_t 2013-05-03 15:40:43 +03:00
Ilari Liusvaara
bce5e8a936 Movie editor: Backport UTF-32 stuff from master
Makes it easier to change the movie editor code by reducing
incompatiblities between rr1 and rr2.
2013-05-03 15:39:27 +03:00
Ilari Liusvaara
6fe837ab48 Make all Lua memory functions optionally take VMA to use as base 2013-05-01 22:43:07 +03:00
Ilari Liusvaara
9fdb5b0deb Use Unicode arrows as symbols of dpad buttons 2013-05-01 18:14:13 +03:00
Ilari Liusvaara
efbc60d494 Allow button display symbols to be Unicode characters 2013-05-01 18:06:24 +03:00
Ilari Liusvaara
04f32ca48a Cleanup port defintions
- Replace explicit display methods with data-driven stuff.
- Deduplicate the default system port types.
- Remove generic_port_* because those aren't used in more than one place.

Serialization/Deserialization can't be made data-driven due to performance
constraints (those things are still autogenerated).
2013-05-01 17:18:56 +03:00
Ilari Liusvaara
92fe2c0c92 Merge branch 'rr1-maint' 2013-04-20 06:21:15 +03:00
Ilari Liusvaara
a77781f9fb Lua: Fix drawing lines in certain angles 2013-04-20 06:21:03 +03:00
Ilari Liusvaara
9013904da3 Make save slot info work correctly with prefixes / prefix changes 2013-04-19 03:20:25 +03:00
Ilari Liusvaara
c37d2c69ad lsnes rr2-β7 2013-04-17 18:28:47 +03:00
Ilari Liusvaara
7f823a21a3 Fix bug causing crash if triple has invalid button 2013-04-17 18:20:38 +03:00
Ilari Liusvaara
fa65332496 lsnes rr2-β6 2013-04-17 16:13:03 +03:00
Ilari Liusvaara
45e7712234 lsnes rr1-Δ17ε3 2013-04-17 15:55:24 +03:00
Ilari Liusvaara
9201705087 Lua: Don't crash if input.[gs]et{,a} is called outside on_input
Thanks to bahamete for finding the bug.
2013-04-16 20:11:10 +03:00
Ilari Liusvaara
27fd5df59e Fix compiling if uint64_t and size_t are not compatible 2013-04-16 17:08:55 +03:00
Ilari Liusvaara
c5a5a4059d Merge branch 'rr1-maint' 2013-04-16 13:56:21 +03:00
Ilari Liusvaara
485558d148 Merge remote-tracking branch 'origin/rr1-maint' into rr1-maint 2013-04-16 13:55:54 +03:00
Ilari Liusvaara
3c3d3051b3 Movie editor: Interpret ctrl+click as right click 2013-04-16 13:55:26 +03:00
Ilari Liusvaara
e8d32ed930 Merge branch 'rr1-maint'
Conflicts:
	src/core/movie.cpp
2013-04-16 04:02:55 +03:00
Ilari Liusvaara
3ab8f196ec Cap current_frame_first_subframe to movie size when recounting movie
The case where it is greater should never happen, but just check to be
sure.
2013-04-16 03:56:10 +03:00
Ilari Liusvaara
a85619270d Merge branch 'rr1-maint'
Conflicts:
	include/core/movie.hpp
	src/core/movie.cpp
2013-04-16 03:45:00 +03:00
Ilari Liusvaara
f1399d2f2e Movie editor: Fix bug if extending finished movie 2013-04-16 03:39:51 +03:00
Ilari Liusvaara
b7e3329db3 Merge branch 'rr1-maint'
Conflicts:
	src/platform/wxwidgets/settings.cpp
2013-04-14 21:32:47 +03:00
Ilari Liusvaara
81145d38ea Fix hotkeys stopping working after X-ing settings dialog 2013-04-14 21:29:22 +03:00
Ilari Liusvaara
4a482d22c1 Merge branch 'rr1-maint' 2013-04-14 20:43:46 +03:00
Ilari Liusvaara
c75596f7e4 Add snes9x fonts 2013-04-14 20:43:32 +03:00
Ilari Liusvaara
b53f647315 Fix race condition causing possible crash on startup 2013-04-14 20:11:14 +03:00
Ilari Liusvaara
99b666f790 Remove some unused leftover stuff 2013-04-13 23:38:18 +03:00
Ilari Liusvaara
e75667068a Merge branch 'rr1-maint'
Conflicts:
	src/core/mainloop.cpp
2013-04-13 22:20:00 +03:00
Ilari Liusvaara
b7dfe28ae1 Display current save slot information 2013-04-13 22:04:49 +03:00
Ilari Liusvaara
185085a019 Allow slowing down subframe advance (it used to always be very fast) 2013-04-13 21:31:56 +03:00
Ilari Liusvaara
4f92b11336 New settings framework 2013-04-13 17:55:33 +03:00
Ilari Liusvaara
6494536334 Merge branch 'rr1-maint' 2013-04-10 13:46:25 +03:00
Ilari Liusvaara
f32e593912 Merge remote-tracking branch 'origin/rr1-maint' into rr1-maint 2013-04-10 13:37:14 +03:00
Ilari Liusvaara
1d9fdedbb3 Merge branch 'rr1-maint' 2013-04-10 13:18:06 +03:00
Ilari Liusvaara
254e49c476 Offer lsmv.backup as file filter too for load lsmv 2013-04-10 13:17:34 +03:00
Ilari Liusvaara
fade785bc4 Fix print() after Lua VM reset 2013-04-10 02:33:12 +03:00
Ilari Liusvaara
7ee2c4ddb6 Fix subframe counter 2013-04-09 22:38:28 +03:00
Ilari Liusvaara
7d0acfbaec Merge branch 'rr1-maint'
Conflicts:
	src/core/mainloop.cpp
2013-04-05 20:09:31 +03:00
Ilari Liusvaara
bfaf627c66 Show effects of Lua in input display 2013-04-05 20:06:00 +03:00
Ilari Liusvaara
bd39b322ce Autofire: Fix false status indications 2013-04-05 15:48:08 +03:00
Ilari Liusvaara
53d436f399 Merge branch 'rr1-maint' 2013-04-03 18:42:07 +03:00
Ilari Liusvaara
f7b6602f10 Actually fix the statuspane/movie-editor flicker 2013-04-03 18:37:15 +03:00
Ilari Liusvaara
e60af4d32c Merge branch 'rr1-maint'
Conflicts:
	src/platform/wxwidgets/status.cpp
2013-04-03 10:39:18 +03:00
Ilari Liusvaara
cf19dc3335 Fix status panel (and movie editor) flicker 2013-04-03 10:38:11 +03:00
Ilari Liusvaara
65218e0894 lsnes rr2-β5 2013-04-01 15:14:16 +03:00
Ilari Liusvaara
31434a691d lsnes rr1-Δ17ε2 2013-04-01 15:05:41 +03:00
Ilari Liusvaara
3ae089cf05 Merge branch 'rr1-maint' 2013-04-01 14:08:44 +03:00
Ilari Liusvaara
03c03fc4c1 Fix value search to work with byte types 2013-04-01 14:08:24 +03:00
Ilari Liusvaara
ccf3ca8ba9 Merge branch 'rr1-maint' 2013-03-29 17:20:54 +02:00
Ilari Liusvaara
e27a06f7c3 Lua: CUSTOMFONT: Allow painting with halo
Conflicts:

	manual.txt
	src/lua/gui-text-cf.cpp
2013-03-29 17:15:28 +02:00
Ilari Liusvaara
3e1836453b data/verysmall.font is mising glyph 70 (F) 2013-03-29 17:13:01 +02:00
Ilari Liusvaara
31e05b501d Lua: CUSTOMFONT: Allow painting with halo 2013-03-29 00:43:14 +02:00
Ilari Liusvaara
d0858038fd data/verysmall.font is mising glyph 70 (F) 2013-03-29 00:41:27 +02:00
Ilari Liusvaara
2e00c726f0 Move some info from status panel to statusbar 2013-03-28 11:33:25 +02:00
Ilari Liusvaara
145b7e3dbe Fix undefined return value from port unserialization 2013-03-28 05:54:10 +02:00
Ilari Liusvaara
73fd1d4737 Merge branch 'rr1-maint'
Conflicts:
	include/core/loadlib.hpp
	src/core/loadlib.cpp
	src/platform/wxwidgets/mainwindow.cpp
2013-03-25 11:35:41 +02:00
Ilari Liusvaara
3e8f02fcaf Wxwidgets: Filter filenames in load/save dialogs, autoappend extensions 2013-03-25 11:28:06 +02:00
Ilari Liusvaara
5b0f5b25f9 Movie editor: Use UTF-32 internally 2013-03-25 10:58:06 +02:00
Ilari Liusvaara
92adf8519c Use std::u32string instead of std::vector<uint32_t> for UTF-32 strings
This also uncovered a bug in copy_from_utf8.
2013-03-25 00:29:48 +02:00
Ilari Liusvaara
3c2aefdc06 Add missing $(CROSS_PREFIX) to pkg-config for libopus 2013-03-24 20:17:00 +02:00
Ilari Liusvaara
8bbf432ada Autohold/Autofire: Try fix the "ga" bug 2013-03-23 21:09:28 +02:00
Ilari Liusvaara
cc366d3de0 Merge branch 'rr1-maint' 2013-03-22 22:03:56 +02:00
Ilari Liusvaara
ba6efda53e Fix mouse movement 2013-03-22 22:03:38 +02:00
Ilari Liusvaara
688f75e261 Don't crash if somebody calls audioapi_get_voice with samples=NULL 2013-03-22 17:26:39 +02:00
Ilari Liusvaara
98b940db3c Merge branch 'rr1-maint' 2013-03-22 12:17:58 +02:00
Ilari Liusvaara
9c6df350bd Allow immediate saving at point of save 2013-03-22 12:16:53 +02:00
Ilari Liusvaara
ab9080294c Merge branch 'rr1-maint'
Conflicts:
	manual.txt
	src/lua/input.cpp
2013-03-19 05:32:26 +02:00
Ilari Liusvaara
c1c9c1d2b2 input.joyset: Preserve and invert user input 2013-03-19 05:26:06 +02:00
Ilari Liusvaara
b534131f21 Fix analog input using mouse (got broken with analog passthrough) 2013-03-17 18:10:54 +02:00
Ilari Liusvaara
34e83828c3 TAS input plugin: Accept keyboard hotkeys 2013-03-17 07:27:07 +02:00
Ilari Liusvaara
058a63c7c0 Movie editor: Mark the panel as wxWANTS_CHARS
This should fix using some keys like TAB or ENTER as hotkeys (at least
in some situations).
2013-03-17 02:43:25 +02:00
Ilari Liusvaara
282dfe02a3 TAS input plugin: Tweak coordinate transforms and pad sizes
Now there is guaranteed spot for exactly the middle point of axes.

Also enlarge pads from 128 pixels to 193.
2013-03-16 14:30:05 +02:00
Ilari Liusvaara
84d8770486 Add tests for throttle axes and fix numerious mistakes 2013-03-16 07:15:24 +02:00
Ilari Liusvaara
c89be21bdf Gambatte: Clean up unused stuff 2013-03-16 06:12:35 +02:00
Ilari Liusvaara
3e48ffcf98 Analog passthrough 2013-03-16 00:12:35 +02:00
Ilari Liusvaara
f38671a3e2 TAS input plugin 2013-03-15 18:48:39 +02:00
Ilari Liusvaara
2c2591501b Movie editor: Fix mouse 2013-03-15 18:48:39 +02:00
Ilari Liusvaara
dea02b366d Warn about nonexistent controller keys more aggressively 2013-03-15 18:48:39 +02:00
Ilari Liusvaara
f114762b87 Wxwidgets: Autohold: Don't open with no controllers 2013-03-15 18:48:39 +02:00
Ilari Liusvaara
d66adf9602 Also use named initializers for null core 2013-03-15 18:48:39 +02:00
Ilari Liusvaara
f88b3eaee5 Fix crashes trying to frameadvance or exit with no ROM loaded 2013-03-14 00:17:30 +02:00
Ilari Liusvaara
67c78124d5 Support per-button autofire 2013-03-14 00:15:43 +02:00
Ilari Liusvaara
3b92a5eb72 Have dedicated window for autohold instead of menu
This comes handy for autofire later.
2013-03-13 23:01:33 +02:00
Ilari Liusvaara
43145be27a Use named field initializers in cores 2013-03-13 18:39:08 +02:00
Ilari Liusvaara
8f57ae5834 Refactoring: copy_from_utf8() 2013-03-13 01:02:10 +02:00
Ilari Liusvaara
00f5754ef7 Allow on_input to veto/force system controls (including reset line) 2013-03-13 00:36:44 +02:00
Ilari Liusvaara
b53fb1fe75 Workaround framebuffer bug if screen width >1024
Framebuffer can't properly blit the image if width is >1024. Bump the
buffer size to 4096 so widths up to 4096 (which should be enough for now)
work.
2013-03-11 01:06:38 +02:00
Ilari Liusvaara
5d9131d2dc Merge branch 'rr1-maint' 2013-03-10 12:21:02 +02:00
Ilari Liusvaara
acb377cc83 Load selected slot in ro/rw/preserve/movie mode 2013-03-10 12:12:26 +02:00
Ilari Liusvaara
4637efb9b7 Merge branch 'rr1-maint' 2013-03-10 00:42:09 +02:00
Ilari Liusvaara
22826009b3 Movie editor: Sweep axis 2013-03-10 00:42:01 +02:00
Ilari Liusvaara
491edbd34c Fix saving PNG screenshots 2013-03-10 00:40:14 +02:00
Ilari Liusvaara
5d3b142d21 Multistream and demuxing fixes 2013-03-09 16:01:58 +02:00
Ilari Liusvaara
6812037774 Rewrite opus_packet_tick_count without lookup tables 2013-03-06 09:40:23 +02:00
Ilari Liusvaara
cfd129d86b Make opus_packet_tick_count a common function 2013-03-06 09:23:04 +02:00
Ilari Liusvaara
40ef521f82 Reject Oggopus files that don't have complete pregap 2013-03-04 23:46:57 +02:00
Ilari Liusvaara
f8705fa56c lsnes rr2-β4 2013-03-04 22:58:52 +02:00
Ilari Liusvaara
ff0a484fb2 lsnes rr1-Δ17ε1 2013-03-04 22:40:02 +02:00
Ilari Liusvaara
2fae20cdad Refactor Oggopus support 2013-03-04 22:20:10 +02:00
Ilari Liusvaara
d9a5332df9 Lua: Don't wedge VM if callback fails with exception 2013-03-03 09:42:16 +02:00
Ilari Liusvaara
efc06d1f10 Merge branch 'rr1-maint'
Conflicts:
	manual.txt
	src/core/controller.cpp
	src/lua/dummy.cpp
	src/lua/input.cpp
	src/lua/lua.cpp
	src/platform/wxwidgets/mainwindow.cpp
2013-03-03 09:37:52 +02:00
Ilari Liusvaara
dca767f650 Lua: on_button and input.veto_button 2013-03-03 09:09:41 +02:00
Ilari Liusvaara
458343b390 Lua: on_snoop2 2013-03-03 08:41:54 +02:00
Ilari Liusvaara
f01505a910 Lua: Document input.controller_info 2013-03-03 08:31:40 +02:00
Ilari Liusvaara
c913e473bb Fix movie editor in obscure case 2013-03-03 01:59:51 +02:00
Ilari Liusvaara
ecbadcc148 Fix rlow and rhigh to be right way around 2013-03-03 00:17:52 +02:00
Ilari Liusvaara
9492b81d28 Merge branch 'rr1-maint' 2013-03-03 00:15:15 +02:00
Ilari Liusvaara
27f7cda29a Lua: input.controller_info 2013-03-02 23:15:23 +02:00
Ilari Liusvaara
3022e04740 Movie editor: Fix the reset delay counters to be right way around 2013-03-02 22:27:13 +02:00
Ilari Liusvaara
ee3a232e37 Merge branch 'rr1-maint' 2013-03-02 18:49:27 +02:00
Ilari Liusvaara
3880648ec8 Lua: input.port_type: Be consistent on type of port 0 2013-03-02 18:48:48 +02:00
Ilari Liusvaara
51800c72a9 Merge branch 'rr1-maint' 2013-03-02 18:46:22 +02:00
Ilari Liusvaara
02039ee3bd Lua: Some new and backported input functions 2013-03-02 18:33:28 +02:00
Ilari Liusvaara
5ec61c864f Some bizarre stuff... 2013-03-02 16:45:53 +02:00
Ilari Liusvaara
03d1ec9aae Merge branch 'rr1-maint' 2013-03-01 18:49:56 +02:00
Ilari Liusvaara
ec76e05b50 Fix writing of screenshot magic to be reliable 2013-03-01 18:48:56 +02:00
Ilari Liusvaara
caa216c290 Fix reading of host-endian VMAs. 2013-03-01 00:48:13 +02:00
Ilari Liusvaara
2004486a1e Merge branch 'rr1-maint' 2013-02-28 21:18:19 +02:00
Ilari Liusvaara
aa9881278e gui.text: Don't corrupt memory on rendering off bottom 2013-02-28 21:17:50 +02:00
Ilari Liusvaara
a103052222 Voicesubs: Don't access uninitialized variables 2013-02-28 21:16:36 +02:00
Ilari Liusvaara
ff8e220fb7 Merge branch 'rr1-maint'
Conflicts:
	include/lua/internal.hpp
2013-02-28 10:40:40 +02:00
Ilari Liusvaara
1295518041 More paint / reset fixes
- Refactor the code related to killing requests.
- Free the pins when destroying killed requests (otherwise memory will
  leak).
- Customfont texts have associated requests, so those need to be killed
  if the font goes away.
2013-02-28 10:36:57 +02:00
Ilari Liusvaara
236b9075d9 Merge branch 'rr1-maint'
Conflicts:
	include/core/framebuffer.hpp
2013-02-28 04:06:37 +02:00
Ilari Liusvaara
80c9dcee2d Fix crash with bitmaps and resetting Lua VM
Kill requests depending on bitmaps and palettes going away, to avoid
having the emulator crash if there is a request using those bitmaps
and palettes in flight while Lua VM is reset.

Noticed by FatRatKnight.
2013-02-28 04:03:01 +02:00
Ilari Liusvaara
93758678b7 Merge branch 'rr1-maint' 2013-02-27 22:40:47 +02:00
Ilari Liusvaara
615d525fa6 Lua: Query bindings, manipulate aliases, create inverse bindings 2013-02-27 22:23:51 +02:00
Ilari Liusvaara
60404062a5 Restrict member picking to only .zip files
This makes it possible to load ROMs that are internally ZIP files.
2013-02-26 13:10:59 +02:00
Ilari Liusvaara
4084b1c16b Fix memory search bug with host-endian VMAs 2013-02-25 19:20:18 +02:00
Ilari Liusvaara
db28464d61 Opus support: Support multistream 2013-02-25 19:20:18 +02:00
Ilari Liusvaara
7beef32a8a Make some things unsigned and fix on platforms where int is not 32 bits 2013-02-20 00:05:39 +02:00
Ilari Liusvaara
a88ae3a8a3 Opus support: Fix all sorts of mistakes 2013-02-19 23:44:25 +02:00
Ilari Liusvaara
0c711d4c6c Better error handling in opus code 2013-02-19 23:04:29 +02:00
Ilari Liusvaara
b64d10a171 Opus support: Ignore errors ctls 2013-02-19 23:04:29 +02:00
Ilari Liusvaara
698dfdde1c Opus support: Repacketizer 2013-02-19 23:04:28 +02:00
Ilari Liusvaara
d7531086e3 Refactor Opus handing 2013-02-18 05:13:41 +02:00
Ilari Liusvaara
80a0ddf5c0 Merge branch 'rr1-maint' 2013-02-17 19:25:30 +02:00
Ilari Liusvaara
579b52e3aa Unconditionally reload hostmemory on loadstate
Hostmemory is associated with system state, so it must be reloaded upon
loadstate, even in preserve input mode.
2013-02-17 19:25:20 +02:00
Ilari Liusvaara
870102d3ce Allow cores to create big-endian VMAs 2013-02-17 10:27:00 +02:00
Ilari Liusvaara
c53339a31d Revert memory leak fix breaking input 2013-02-13 14:49:27 +02:00
Ilari Liusvaara
e83cc21e8a Merge branch 'rr1-maint' 2013-02-12 00:28:48 +02:00
Ilari Liusvaara
a3ecd5ca9d Commentary: Max bitrate limiting 2013-02-12 00:24:05 +02:00
Ilari Liusvaara
a8392eeecc lsnes rr2-β3 2013-02-11 00:32:56 +02:00
Ilari Liusvaara
a22a31c33e lsnes rr1-Δ17 2013-02-11 00:11:52 +02:00
Ilari Liusvaara
1732705e62 Wxwidgets: Support -h and --help 2013-02-11 00:09:49 +02:00
Ilari Liusvaara
629beb01d5 Wxwidgets: Load filenames as ROMs and support --lua=<file> 2013-02-10 23:58:51 +02:00
Ilari Liusvaara
3e1cce95d2 Allow changing the Opus bitrate at runtime 2013-02-10 23:47:40 +02:00
Ilari Liusvaara
67c41463b9 Merge branch 'rr1-maint' 2013-02-10 15:31:33 +02:00
Ilari Liusvaara
b9968d0bdd Fix compiling on Win32 2013-02-10 15:23:29 +02:00
Ilari Liusvaara
15f597939f Backport some bugfixes from compiler warning fixing 2013-02-10 15:17:00 +02:00
Ilari Liusvaara
90a5f80232 Fix lots of -Wall compiler warnings 2013-02-10 15:00:12 +02:00
Ilari Liusvaara
408ea46268 {set,clear}-pause-on-end 2013-02-09 23:46:17 +02:00
Ilari Liusvaara
2a3efcd229 Fix breakage in last commit 2013-02-09 23:46:05 +02:00
Ilari Liusvaara
063edaf9a5 lsnes-dumpavi: --firmware-path 2013-02-09 23:29:33 +02:00
Ilari Liusvaara
7e091d2cf5 Cleanup many settings (all from core) 2013-02-09 21:22:24 +02:00
Ilari Liusvaara
60f2801ecf Fix some uninitialized variables caught by Valgrind 2013-02-09 18:35:39 +02:00
Ilari Liusvaara
2bcb022f95 Clean up save slots handling
Also changes save slots to be per-project instead of the weird handling
earlier.
2013-02-09 18:35:13 +02:00
Ilari Liusvaara
c9e05a607a Clean up framerate handling
Also stop saving the framerate (it is not meaningful to persist between
sessions).
2013-02-09 16:24:31 +02:00
Ilari Liusvaara
363e7c7a3c Remove lsnesrc-related code (since what it was used for is long gone) 2013-02-09 16:08:06 +02:00
Ilari Liusvaara
bf3255e315 Merge branch 'rr1-maint' 2013-02-09 13:02:04 +02:00
Ilari Liusvaara
ac6bb35fa3 Movie editor: Show buttons even when released 2013-02-09 13:00:29 +02:00
Ilari Liusvaara
0b4459cafc Movie editor: Allow toggling whole sequence of axis values at once 2013-02-09 12:55:07 +02:00
Ilari Liusvaara
02bddef57e Update manual 2013-02-09 12:39:25 +02:00
Ilari Liusvaara
be616a5316 Movie editor: Scroll to current frame 2013-02-09 12:26:49 +02:00
Ilari Liusvaara
aa1e6f184a Merge branch 'rr1-maint' 2013-02-08 20:55:53 +02:00
Ilari Liusvaara
ac954193c6 Movie editor: Tweak colors 2013-02-08 20:55:31 +02:00
Ilari Liusvaara
6b1097edbe Movie editor: Handle scrolling when rewinding 2013-02-08 20:35:19 +02:00
Ilari Liusvaara
c0d3d7fd2f Fix controls with gambatte core 2013-02-08 19:47:06 +02:00
Ilari Liusvaara
4413ffe901 Portaudio: Fix buggy full-duplex mode 2013-02-08 18:30:20 +02:00
Ilari Liusvaara
8a80c86684 Portaudio: Do split duplex with different I/O devices 2013-02-08 13:15:48 +02:00
Ilari Liusvaara
cf365d181e Wxwidgets: Don't save or load blank core preferences 2013-02-08 08:03:44 +02:00
Ilari Liusvaara
3917c41b6b Merge branch 'rr1-maint' 2013-02-08 00:54:01 +02:00
Ilari Liusvaara
118eb3fbdf Movie editor: Scrolling fixes 2013-02-08 00:53:49 +02:00
Ilari Liusvaara
891235f5d4 Merge branch 'rr1-maint'
Conflicts:
	src/platform/wxwidgets/editor-movie.cpp
2013-02-07 18:14:50 +02:00
Ilari Liusvaara
3cbfd67ddb Movie editor: Scroll to specified frame 2013-02-07 18:05:36 +02:00
Ilari Liusvaara
719d90956d Movie editor: Truncate movie 2013-02-07 17:52:57 +02:00
Ilari Liusvaara
c6424efa7f Movie editor: Append multiple frames at once 2013-02-07 17:46:17 +02:00
Ilari Liusvaara
cc31d0ea86 Movie editor: Run to frame function 2013-02-07 17:40:32 +02:00
Ilari Liusvaara
368564d040 Wxwidgets: Repaint the status panel after RW/RO switch 2013-02-07 17:23:58 +02:00
Ilari Liusvaara
1e64ba0c6b Movie editor: Fix compilation on Win32 2013-02-07 13:29:44 +02:00
Ilari Liusvaara
833a16437f Win32: Use MoveFileEx to replace the target in one operation 2013-02-07 13:29:38 +02:00
Ilari Liusvaara
5a5968511c Fix saving unconnected ports to movie 2013-02-05 23:43:18 +02:00
Ilari Liusvaara
90d5fff406 Fix serializing multiple ports 2013-02-05 23:01:29 +02:00
Ilari Liusvaara
91d096984f Fix serializing multi-controller ports 2013-02-05 22:56:49 +02:00
Ilari Liusvaara
c7272f39d4 Merge branch 'rr1-maint' 2013-02-05 21:47:21 +02:00
Ilari Liusvaara
891d10fcc6 Movie editor: Show movie length 2013-02-05 21:46:35 +02:00
Ilari Liusvaara
feaa527e2a Movie editor: Reorganize the popup menu a bit 2013-02-05 21:43:53 +02:00
Ilari Liusvaara
f819fe8510 Merge branch 'rr1-maint' 2013-02-05 19:18:13 +02:00
Ilari Liusvaara
43a6d1012f Movie editor: Locked scrolling mode 2013-02-05 19:17:59 +02:00
Ilari Liusvaara
9f8a7ccdd9 Merge branch 'rr1-maint' 2013-02-05 16:02:30 +02:00
Ilari Liusvaara
ed22b1acab Movie editor: Fix deleting the leading subframe 2013-02-05 16:02:16 +02:00
Ilari Liusvaara
c0bf2046d4 Merge branch 'rr1-maint'
Conflicts:
	src/core/audioapi.cpp
2013-02-05 15:57:05 +02:00
Ilari Liusvaara
f7fc235e25 Movie editor: Delete (sub)frame 2013-02-05 15:48:50 +02:00
Ilari Liusvaara
a0682ca5ba Show nominal and actual sample rates in VU window 2013-02-05 15:48:22 +02:00
Ilari Liusvaara
cc67a7f887 Merge branch 'rr1-maint'
Conflicts:
	src/core/audioapi.cpp
2013-02-05 01:23:02 +02:00
Ilari Liusvaara
1e29e41577 Fix all sorts of wacky behavior with dummy audio callback
This fixes the VU meter when the audio output is set to NULL.
2013-02-05 01:11:52 +02:00
Ilari Liusvaara
463eacedf1 Movie editor: Handle partially stored frames properly 2013-02-05 00:24:36 +02:00
Ilari Liusvaara
4e2db8416d Merge branch 'rr1-maint'
Conflicts:
	include/core/movie.hpp
	src/platform/wxwidgets/editor-movie.cpp
2013-02-04 21:59:21 +02:00
Ilari Liusvaara
0925eea4cc Movie editor: Insert frame after 2013-02-04 21:55:27 +02:00
Ilari Liusvaara
4feed2304e Movie editor: Don't recount the entire movie when change is known 2013-02-04 20:50:56 +02:00
Ilari Liusvaara
62cb6c0727 Movie editor: Sanity-limit number of rows 2013-02-04 20:43:12 +02:00
Ilari Liusvaara
4a1838427e Movie editor: Allow changing window size 2013-02-04 20:08:00 +02:00
Ilari Liusvaara
590b7fb927 Movie editor: Don't offer out-of-movie edits in menu
Out-of-movie edits don't crash, those just won't work.
2013-02-04 19:50:58 +02:00
Ilari Liusvaara
1cc8a3dc92 Merge branch 'rr1-maint' 2013-02-04 19:09:15 +02:00
Ilari Liusvaara
a1b1dd8d65 Movie editor: Show button/axis names in popup menu 2013-02-04 19:05:29 +02:00
Ilari Liusvaara
4e7d763abb Movie editor: Don't offer popup menu items that make no sense 2013-02-04 18:54:55 +02:00
Ilari Liusvaara
e032662a38 Merge branch 'rr1-maint' 2013-02-04 12:54:20 +02:00
Ilari Liusvaara
ccb4d67074 Movie editor: Popup menu 2013-02-04 12:53:46 +02:00
Ilari Liusvaara
e5b9a62194 Merge branch 'rr1-maint'
Conflicts:
	src/platform/wxwidgets/editor-movie.cpp
2013-02-04 12:13:55 +02:00
Ilari Liusvaara
124238cea7 Movie editor: Refactoring 2013-02-04 11:55:19 +02:00
Ilari Liusvaara
ea2042acfd Movie editor: Properly space in presence of axis fields 2013-02-04 08:43:36 +02:00
Ilari Liusvaara
e7fd247c07 Movie editor: Add space before axis fields 2013-02-03 20:50:00 +02:00
Ilari Liusvaara
5eaa80a5f2 Merge branch 'rr1-maint'
This merges the basic movie editor functionality
2013-02-03 17:41:09 +02:00
Ilari Liusvaara
ca63bd5bea Very basic movie editing support
This is still very incomplete. More features later.
2013-02-03 16:01:21 +02:00
Ilari Liusvaara
dfe18d2a4d lsnes rr1-Δ16ε1 2013-02-03 11:53:50 +02:00
Ilari Liusvaara
f9415b0154 Fix loading standard-mode movies
When not in extended mode, the checking for movie compatibility read past
the end of poll counter array, potentially leading to a hang.
2013-02-03 06:13:51 +02:00
Ilari Liusvaara
9560c66bf4 Oops, set the sound mode default to 2 not 3
The last merge was bad: Instead of mode 2 (round up to nearest integer)
the default got set to mode 3 (multiply rate).
2013-02-02 01:44:35 +02:00
Ilari Liusvaara
c3ae963cbe Merge branch 'rr1-maint'
Conflicts:
	src/video/avi.cpp
2013-02-02 01:39:55 +02:00
Ilari Liusvaara
3eea885a64 Change AVI default sound mode
Change AVI default sound mode to mode 2 (round up to nearest integer)
if built without SRC support and to mode 5 (high quality 48kHz) if built
with SRC.
2013-02-02 01:39:17 +02:00
Ilari Liusvaara
010c337fa9 Merge branch 'rr1-maint' 2013-02-02 01:23:41 +02:00
Ilari Liusvaara
3539fc508d Fix paths in bsnes patches 2013-02-02 01:23:34 +02:00
Ilari Liusvaara
1d6cf64908 Merge branch 'rr1-maint' 2013-02-01 23:14:25 +02:00
Ilari Liusvaara
8e88ad35b3 Fix rerecord count when loading movies 2013-02-01 23:14:00 +02:00
Ilari Liusvaara
bcdb9dd9f8 Merge branch 'rr1-maint'
Conflicts:
	include/lua/internal.hpp
	manual.txt
	src/lua/lua.cpp
	src/lua/memory.cpp
2013-02-01 22:26:22 +02:00
Ilari Liusvaara
8c346c0695 Lua: Fix bug with methods and resetting Lua VM 2013-02-01 22:10:01 +02:00
Ilari Liusvaara
531c0d0635 Merge branch 'rr1-maint'
Conflicts:
	manual.lyx
	manual.txt
2013-02-01 21:54:32 +02:00
Ilari Liusvaara
5d08c36390 Lua: Custom fonts support 2013-02-01 21:52:27 +02:00
Ilari Liusvaara
86d4f99da9 Oops, missing file. 2013-01-28 16:38:13 +02:00
Ilari Liusvaara
246f0e32b9 Dedicated sound devices dialog 2013-01-28 13:01:05 +02:00
Ilari Liusvaara
b928596e09 Support for hard resets and make some stuff movie settings 2013-01-27 13:57:33 +02:00
Ilari Liusvaara
0b45d38af1 Render queue documentation 2013-01-26 23:55:50 +02:00
Ilari Liusvaara
5171900b43 Lua: Render queues as objects 2013-01-26 23:42:08 +02:00
Ilari Liusvaara
33ad2fcc12 Merge branch 'rr1-maint'
Conflicts:
	include/platform/wxwidgets/platform.hpp
	src/platform/wxwidgets/mainwindow.cpp
2013-01-26 13:27:31 +02:00
Ilari Liusvaara
c065f0398f Wxwidgets: VU meters & volume adjustment window 2013-01-26 13:20:39 +02:00
Ilari Liusvaara
0fa3109116 Merge branch 'rr1-maint'
Conflicts:
	src/core/inthread.cpp
2013-01-25 20:15:07 +02:00
Ilari Liusvaara
c5d45840ed Allow setting stream gain 2013-01-25 20:14:11 +02:00
Ilari Liusvaara
23b5f9891e Merge branch 'rr1-maint' 2013-01-25 14:45:20 +02:00
Ilari Liusvaara
1297f683e0 Merge remote-tracking branch 'origin/rr1-maint' into rr1-maint 2013-01-25 12:35:01 +02:00
Ilari Liusvaara
a116622b32 Wxwidgets: Fix memory watch rendering 2013-01-25 12:33:55 +02:00
Ilari Liusvaara
ee3035cacc lsnes rr2-β2 2013-01-24 18:44:55 +02:00
Ilari Liusvaara
c168be8562 lsnes rr1-Δ16 2013-01-24 18:35:13 +02:00
Ilari Liusvaara
422e90b7d6 Split duplex support
This allows having sound I/O on Mac OS X (at least on Macbooks)
2013-01-24 18:26:37 +02:00
Ilari Liusvaara
ed77f5a4e0 Merge branch 'rr1-maint' 2013-01-24 18:26:26 +02:00
Ilari Liusvaara
2526414a53 Actually honor music volume setting 2013-01-24 18:26:03 +02:00
Ilari Liusvaara
bd14e31e57 Merge branch 'rr1-maint'
Conflicts:
	src/platform/wxwidgets/editor-subtitles.cpp
2013-01-24 04:22:24 +02:00
Ilari Liusvaara
5c3e48348b Live subtitle editing 2013-01-24 04:16:38 +02:00
Ilari Liusvaara
fa3211f87f Merge branch 'rr1-maint'
Conflicts:
	include/core/dispatch.hpp
	src/core/dispatch.cpp
	src/core/inthread.cpp
2013-01-24 02:14:12 +02:00
Ilari Liusvaara
ab204556da Real-time updates for voice streams in editor 2013-01-24 02:04:36 +02:00
Ilari Liusvaara
10bff4a0c3 Merge branch 'rr1-maint' 2013-01-23 08:48:48 +02:00
Ilari Liusvaara
242ce42bb7 Lua: bit.rflagdecode 2013-01-23 08:48:27 +02:00
Ilari Liusvaara
ecfec8a1f4 Lua: Backport new Lua functions from master and add bit.rflagdecode 2013-01-23 08:43:31 +02:00
Ilari Liusvaara
0763a00bef Emulate weak dummy driver in a way compatible with Win32
This is less performant than doing it with linker support, but that
doesn't matter because none of the functions is called very often.
2013-01-22 09:26:22 +02:00
Ilari Liusvaara
c9e038f902 Lua: bit.flagdecode 2013-01-21 23:57:19 +02:00
Ilari Liusvaara
bbe8f0b0fd Lua: bit.clshift / bit.crshift 2013-01-21 23:13:45 +02:00
Ilari Liusvaara
b764bd3c62 Bit.{test_any,test_all,popcount}: Fix wrong datatype 2013-01-21 20:45:20 +02:00
Ilari Liusvaara
865a450a43 Backport the new bit functions 2013-01-21 20:43:06 +02:00
Ilari Liusvaara
312c3a8944 Lua: bit.popcount 2013-01-21 20:35:23 +02:00
Ilari Liusvaara
0cf0681c1d Lua: bit.test_any, bit.test_all 2013-01-21 20:29:36 +02:00
Ilari Liusvaara
9dc3284969 Windows apparently doesn't support weak functions 2013-01-21 19:06:28 +02:00
Ilari Liusvaara
03b060de89 Graphics driver: Use weak functions
This also gets rid of src/dummy
2013-01-21 14:29:51 +02:00
Ilari Liusvaara
5efecc7041 graphics_plugin:: -> graphics_driver_ 2013-01-21 14:03:40 +02:00
Ilari Liusvaara
41ca0a3051 Audio drivers: Use weak functions 2013-01-21 13:52:26 +02:00
Ilari Liusvaara
8770824c15 Joystick: use weak functions 2013-01-21 13:35:37 +02:00
Ilari Liusvaara
ad997c36bd joystick_plugin:: -> joystick_driver_ 2013-01-21 12:48:07 +02:00
Ilari Liusvaara
13f69fac09 Get rid of platform threads
This was the last platform threading feature, so delete platform
thread files completely.
2013-01-21 12:30:35 +02:00
Ilari Liusvaara
b322011ee2 Get rid of platform thread_id 2013-01-21 12:04:09 +02:00
Ilari Liusvaara
8578b8812a Use system mutex/condition types instead of platform ones 2013-01-21 09:24:46 +02:00
Ilari Liusvaara
0186929e64 lsnes rr2-β1 2013-01-19 21:31:32 +02:00
Ilari Liusvaara
6e013653cb Fix bug when changing controller key to another subkey of the same key 2013-01-19 21:20:30 +02:00
Ilari Liusvaara
4467f693f5 Support screen rotation & flipping 2013-01-19 20:16:55 +02:00
Ilari Liusvaara
e9a3787344 Support screen rotation & flipping 2013-01-19 20:11:24 +02:00
Ilari Liusvaara
0dacba56a3 Load XML even without gamepack 2013-01-19 15:48:45 +02:00
Ilari Liusvaara
2caf7001dc Load XML even without gamepack files 2013-01-19 15:20:22 +02:00
Ilari Liusvaara
0da8befb8d Get rid of partial linking
Partial linking doesn't seem to work right with MXE.
2013-01-19 14:03:25 +02:00
Ilari Liusvaara
17ff101f9d Merge branch 'rr1-maint' 2013-01-18 21:15:13 +02:00
Ilari Liusvaara
389ec0f63d Update libgambatte to SVN 364 2013-01-18 21:15:00 +02:00
Ilari Liusvaara
b2be07750f Merge branch 'rr1-maint' 2013-01-18 19:21:44 +02:00
Ilari Liusvaara
f89a2caa52 Cores: Blurb 2013-01-18 19:20:03 +02:00
677 changed files with 133997 additions and 36458 deletions

8
.gitignore vendored
View file

@ -3,7 +3,9 @@
*.lib
*.obj
*.exe
*.dep
*.ldflags
*.files
docs
rom
lsnes
@ -13,3 +15,9 @@ lsnes
/gambatte
src/fonts/font.cpp
src/core/version.cpp
src/cmdhelp/*.cpp
include/cmdhelp/*.hpp
src/emulation/make-ports
src/cmdhelp/mkstubs
src/cmdhelp/mkstubsi
buildaux/mkdeps

6
.gitmodules vendored Normal file
View file

@ -0,0 +1,6 @@
[submodule "bsnes"]
path = bsnes
url = ./
[submodule "gambatte"]
path = gambatte
url = ./

2129
CHANGELOG Normal file

File diff suppressed because it is too large Load diff

View file

@ -12,14 +12,16 @@ REALRANLIB = $(CROSS_PREFIX)$(RANLIB)
#Flags.
HOSTCCFLAGS = -std=gnu++0x
CFLAGS += -std=gnu++0x $(USER_CFLAGS)
CFLAGS += -std=gnu++0x -pthread $(USER_CFLAGS)
ifdef BOOST_NEEDS_MT
BOOST_LIB_POSTFIX=-mt
else
BOOST_LIB_POSTFIX=
endif
ifdef HOST_BOOST_NEEDS_MT
HOST_BOOST_POSTFIX=-mt
endif
LDFLAGS = -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lboost_regex$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS)
LDFLAGS = -pthread -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS)
HOSTHELPER_LDFLAGS =
ifeq ($(THREADS), NATIVE)
CFLAGS += -DNATIVE_THREADS
@ -32,6 +34,33 @@ $(error "Bad value for THREADS (expected NATIVE or BOOST)")
endif
endif
ifeq ($(REGEX), BOOST)
CFLAGS += -DUSE_BOOST_REGEX
LDFLAGS += -lboost_regex$(BOOST_LIB_POSTFIX)
HOSTHELPER_LDFLAGS += -lboost_regex$(HOST_BOOST_POSTFIX)
endif
HOSTHELPER_LDFLAGS += -lboost_system$(HOST_BOOST_POSTFIX)
ifdef NEED_LIBICONV
LDFLAGS += -liconv
endif
ifdef USE_LIBGCRYPT
CFLAGS += -DUSE_LIBGCRYPT_SHA256
LDFLAGS += -lgcrypt -lgpg-error
endif
ifdef USE_LIBLZMA
CFLAGS += -DLIBLZMA_AVAILABLE
LDFLAGS += -llzma
endif
ifeq ($(ARCHITECTURE), I386)
CFLAGS += -DARCH_IS_I386
else
endif
export
@ -39,6 +68,8 @@ all: src/__all_files__
CFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --cflags)
LDFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --libs)
CFLAGS += $(shell $(CROSS_PREFIX)curl-config --cflags)
LDFLAGS += $(shell $(CROSS_PREFIX)curl-config --libs)
compiler=$(subst ++,cc,$(REALCC))
gambatte_compiler=$(REALCC)
@ -48,19 +79,28 @@ bsnes/out/libsnes.$(ARCHIVE_SUFFIX): forcelook
$(REALRANLIB) bsnes/out/libsnes.$(ARCHIVE_SUFFIX)
src/__all_files__: src/core/version.cpp forcelook
src/__all_files__: src/core/version.cpp buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX) buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX) forcelook
$(MAKE) -C src precheck
$(MAKE) -C src
cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) .
buildaux/version.exe: buildaux/version.cpp VERSION
buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX): buildaux/txt2cstr.cpp
$(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
src/core/version.cpp: buildaux/version.exe forcelook
buildaux/version.exe >$@
buildaux/version$(DOT_EXECUTABLE_SUFFIX): buildaux/version.cpp VERSION
$(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX): buildaux/mkdeps.cpp VERSION
$(HOSTCC) $(HOSTCCFLAGS) -o $@ $< -lboost_filesystem$(HOST_BOOST_POSTFIX) -lboost_system$(HOST_BOOST_POSTFIX)
src/core/version.cpp: buildaux/version$(DOT_EXECUTABLE_SUFFIX) forcelook
buildaux/version$(DOT_EXECUTABLE_SUFFIX) >$@
platclean:
$(MAKE) -C src platclean
clean:
$(MAKE) -C src clean
rm -f buildaux/version$(DOT_EXECUTABLE_SUFFIX)
rm -f buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX)
rm -f buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX)
forcelook:
@true

3
TODO Normal file
View file

@ -0,0 +1,3 @@
- Memory Tracking: Track dynamic state.
- Fix paths and filenames containing non-ASCII on Win32.
- Win64 build.

View file

@ -1 +1 @@
2-β0
2-β23

1
bsnes Submodule

@ -0,0 +1 @@
Subproject commit 4cfbbeadc3abe3e3911f7f59ce57b715edc76563

View file

@ -1,13 +1,13 @@
From df75db4512ef7e6ad70f8cee8c7d7071132168f0 Mon Sep 17 00:00:00 2001
From 831e9614a7babbacf59935960fbaa6cfc8d49c08 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:30:36 +0200
Subject: [PATCH 1/7] Make libsnes compile
Subject: [PATCH 01/10] Make libsnes compile
Changes between v083 and v084 had broken libsnes. Fix it so it at least
compiles.
---
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
index fbb4482..5f5ded6 100755
@ -78,5 +78,5 @@ index fbb4482..5f5ded6 100755
}
SNES::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, xmlrom);
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,11 +1,12 @@
From 637952f6b97bef882ca3870be8d434c31aeacf77 Mon Sep 17 00:00:00 2001
From df7851648e41ae6b6efd1a54cdcd32ac55a90131 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:31:59 +0200
Subject: [PATCH 2/7] Fix bsnes version number in libsnes to be v084, not v083
Subject: [PATCH 02/10] Fix bsnes version number in libsnes to be v084, not
v083
---
ui-libsnes/libsnes.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
ui-libsnes/libsnes.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
index 5f5ded6..6b4ef12 100755
@ -21,5 +22,5 @@ index 5f5ded6..6b4ef12 100755
unsigned snes_library_revision_major(void) {
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,17 +1,17 @@
From 308ba2d96d3dc0e49821c9db9902882e3919e372 Mon Sep 17 00:00:00 2001
From b481e3d161d924cc5a4449329393c8d9f23b27ec Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:37:44 +0200
Subject: [PATCH 3/7] Don't use time() in emulating chips
Subject: [PATCH 03/10] Don't use time() in emulating chips
Instead of using time() in chip emulation, create new interface method
currentTime(), defaulting to time(0). This way frontend can cleanly
override the current time bsnes is using.
---
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
5 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
extern Interface *interface;
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,26 +1,26 @@
From 8d990991d97eb7742c4daa461b158d1aa9f6dce4 Mon Sep 17 00:00:00 2001
From af7fdd9f73a3eb5e9266c59bfb4dd676679b2f7d Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 01:52:08 +0200
Subject: [PATCH 4/7] Save controller state when savestating
Subject: [PATCH 04/10] Save controller state when savestating
When savestating, save the controller state and restore it upon loadstate.
Prevents libsnes from mixing up buttons.
---
snes/controller/controller.cpp | 8 ++++++
snes/controller/controller.hpp | 2 +
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 ++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/input/input.cpp | 15 ++++++++++++
snes/input/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
snes/controller/controller.cpp | 8 +++++++
snes/controller/controller.hpp | 2 ++
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 +++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/input/input.cpp | 15 +++++++++++++
snes/input/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
15 files changed, 141 insertions(+), 3 deletions(-)
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
@ -341,5 +341,5 @@ index f7d6f3b..08e7051 100755
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.serialize(s);
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,11 +1,11 @@
From 0520c04455b9e96e6caa54009d4ef7c300146c67 Mon Sep 17 00:00:00 2001
From aa1352516e38ff64f304d8831b357841c4795e43 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Fri, 11 Nov 2011 03:05:48 +0200
Subject: [PATCH 5/7] Fix unserialization of 64-bit signed integers
Subject: [PATCH 05/10] Fix unserialization of 64-bit signed integers
---
nall/serializer.hpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
nall/serializer.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nall/serializer.hpp b/nall/serializer.hpp
index ff2337a..e6bc8fa 100755
@ -21,5 +21,5 @@ index ff2337a..e6bc8fa 100755
isize += size;
}
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,13 +1,13 @@
From 723b5884d53db9d5e24b8cd300e97b1bb12fba29 Mon Sep 17 00:00:00 2001
From 794d83cb28a93d9ae1e613598d3c7cf09090d6a3 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Fri, 11 Nov 2011 19:49:46 +0200
Subject: [PATCH 6/7] Allow frontend to control random number seed
Subject: [PATCH 06/10] Allow frontend to control random number seed
---
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletions(-)
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index b3017c9..0a21a13 100755
@ -49,5 +49,5 @@ index 6881810..8583595 100755
region = config.region;
expansion = config.expansion_port;
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,60 +1,63 @@
From eea50468e8d7e7a034b05c819aef11a032f972eb Mon Sep 17 00:00:00 2001
From 4f6981592e29038ad9f818399c0d5a48750cf28a Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 7 Mar 2012 16:57:18 +0200
Subject: [PATCH 7/7] Fix mouse polling
Subject: [PATCH 07/10] Fix mouse polling
Don't poll for mouse motion excessive number of times (no need to poll it for
each bit!)
---
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 12 insertions(+), 2 deletions(-)
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
index 6b26fae..824ecd3 100755
index 6b26fae..1a066b9 100755
--- a/snes/controller/mouse/mouse.cpp
+++ b/snes/controller/mouse/mouse.cpp
@@ -3,8 +3,10 @@
@@ -3,9 +3,13 @@
uint2 Mouse::data() {
if(counter >= 32) return 1;
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ if(counter == 0) {
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ }
+ int position_x = _position_x;
+ int position_y = _position_y;
bool direction_x = position_x < 0; //0 = right, 1 = left
bool direction_y = position_y < 0; //0 = down, 1 = up
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
unsigned char block[Controller::SaveSize] = {0};
block[0] = latched ? 1 : 0;
block[1] = counter;
+ block[2] = (unsigned short)position_x >> 8;
+ block[3] = (unsigned short)position_x;
+ block[4] = (unsigned short)position_y >> 8;
+ block[5] = (unsigned short)position_y;
+ block[2] = (unsigned short)_position_x >> 8;
+ block[3] = (unsigned short)_position_x;
+ block[4] = (unsigned short)_position_y >> 8;
+ block[5] = (unsigned short)_position_y;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
}
}
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
index b66ea51..6074f34 100755
index b66ea51..b07c8ab 100755
--- a/snes/controller/mouse/mouse.hpp
+++ b/snes/controller/mouse/mouse.hpp
@@ -6,4 +6,6 @@ struct Mouse : Controller {
private:
bool latched;
unsigned counter;
+ int position_x;
+ int position_y;
+ int _position_x;
+ int _position_y;
};
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,18 +1,18 @@
From 170490ff3a98a4d4c923fb3fe48014359d4b5f6f Mon Sep 17 00:00:00 2001
From 7b09063fbcaf50c56b476a744f9f3d9634777740 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 24 Sep 2012 21:46:09 +0300
Subject: [PATCH] Add needed support for detecting true polls as opposed to
just autopolling
Subject: [PATCH 08/10] Add needed support for detecting true polls as opposed
to just autopolling
---
bsnes/snes/cpu/cpu.hpp | 1 +
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
snes/cpu/cpu.hpp | 1 +
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
index 67a56d1..976a4a6 100755
--- a/bsnes/snes/cpu/cpu.hpp
+++ b/bsnes/snes/cpu/cpu.hpp
--- a/snes/cpu/cpu.hpp
+++ b/snes/cpu/cpu.hpp
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
CPU();
~CPU();
@ -21,10 +21,10 @@ index 67a56d1..976a4a6 100755
private:
#include "dma/dma.hpp"
#include "memory/memory.hpp"
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index 8b6aaa6..c5ee930 100755
--- a/bsnes/snes/cpu/mmio/mmio.cpp
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
//1-0 = Joypad serial data
uint8 CPU::mmio_r4016() {
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
//DMAPx
uint8 CPU::mmio_r43x0(uint8 i) {
--
1.7.10.4
1.8.4.4

View file

@ -0,0 +1,65 @@
From 62f8a07104b57b75071318098145d99012dbc908 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 27 Oct 2013 10:52:45 +0200
Subject: [PATCH 09/10] Support notifying latches
---
snes/cpu/mmio/mmio.cpp | 1 +
snes/cpu/timing/joypad.cpp | 1 +
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
4 files changed, 8 insertions(+)
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index c5ee930..b7afff0 100755
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
//strobing $4016.d0 affects both controller port latches.
//$4017 bit 0 writes are ignored.
void CPU::mmio_w4016(uint8 data) {
+ if(data&1) interface->notifyLatched();
input.port1->latch(data & 1);
input.port2->latch(data & 1);
}
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index 6e15346..c69b708 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -7,6 +7,7 @@ void CPU::step_auto_joypad_poll() {
if(status.auto_joypad_active && status.auto_joypad_poll) {
if(status.auto_joypad_counter == 0) {
+ interface->notifyLatched();
input.port1->latch(1);
input.port2->latch(1);
input.port1->latch(0);
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index 0a21a13..6685556 100755
--- a/snes/interface/interface.cpp
+++ b/snes/interface/interface.cpp
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
return time(0);
}
+void Interface::notifyLatched()
+{
+ //Nothing.
+}
+
}
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
index 30ee7fd..203f7b0 100755
--- a/snes/interface/interface.hpp
+++ b/snes/interface/interface.hpp
@@ -7,6 +7,7 @@ struct Interface {
virtual void message(const string &text);
virtual time_t currentTime();
virtual time_t randomSeed();
+ virtual void notifyLatched();
};
extern Interface *interface;
--
1.8.4.4

View file

@ -0,0 +1,22 @@
From 242efcc9cf10fa58c8e06f154c41db21e6aa2688 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 30 Nov 2013 10:26:59 +0200
Subject: [PATCH 10/10] Add support for auto-detecting bsnes version
---
bsnes.mk | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 bsnes.mk
diff --git a/bsnes.mk b/bsnes.mk
new file mode 100644
index 0000000..11300e2
--- /dev/null
+++ b/bsnes.mk
@@ -0,0 +1,3 @@
+BSNES_SUPPORTS_DEBUGGER=yes
+LIBSNES_DIR=ui-libsnes
+BSNES_VERSION=084
--
1.8.4.4

View file

@ -1,16 +1,16 @@
From 7c8d537a7be0f9c5883393e0d4a0df76d69bf19c Mon Sep 17 00:00:00 2001
From b19b3b2d1d7a522af695f4482abb28e52804326b Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:30:36 +0200
Subject: [PATCH 1/7] Make libsnes compile
Subject: [PATCH 01/27] Make libsnes compile
Changes between v083 and v084 had broken libsnes. Fix it so it at least
compiles.
---
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
ui-libsnes/libsnes.cpp | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
index fbb4482..5f5ded6 100755
index fbb4482c..5f5ded69 100755
--- a/ui-libsnes/libsnes.cpp
+++ b/ui-libsnes/libsnes.cpp
@@ -1,5 +1,6 @@
@ -78,5 +78,5 @@ index fbb4482..5f5ded6 100755
}
SNES::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, xmlrom);
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,14 +1,15 @@
From 5f9f74b1334cb05d8636d71c2cfc0a48685a7347 Mon Sep 17 00:00:00 2001
From bb2fed04fbfe62a89e4bcfe90f44b4738f7c7c1a Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:31:59 +0200
Subject: [PATCH 2/7] Fix bsnes version number in libsnes to be v085, not v083
Subject: [PATCH 02/27] Fix bsnes version number in libsnes to be v085, not
v083
---
ui-libsnes/libsnes.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
ui-libsnes/libsnes.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
index 5f5ded6..0e63075 100755
index 5f5ded69..0e63075e 100755
--- a/ui-libsnes/libsnes.cpp
+++ b/ui-libsnes/libsnes.cpp
@@ -112,7 +112,7 @@ struct Interface : public SNES::Interface {
@ -21,5 +22,5 @@ index 5f5ded6..0e63075 100755
unsigned snes_library_revision_major(void) {
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,21 +1,21 @@
From 773d0a3f71fca2df375a8e75c081d1f28c3b817b Mon Sep 17 00:00:00 2001
From 7379b4570e5755a5a1da25181ba4f5d1ca461a98 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:37:44 +0200
Subject: [PATCH 3/7] Don't use time() in emulating chips
Subject: [PATCH 03/27] Don't use time() in emulating chips
Instead of using time() in chip emulation, create new interface method
currentTime(), defaulting to time(0). This way frontend can cleanly
override the current time bsnes is using.
---
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
5 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
index 386fb62..3c98019 100755
index 386fb628..3c980195 100755
--- a/snes/chip/bsx/satellaview/satellaview.cpp
+++ b/snes/chip/bsx/satellaview/satellaview.cpp
@@ -38,7 +38,7 @@ uint8 BSXSatellaview::mmio_read(unsigned addr) {
@ -28,7 +28,7 @@ index 386fb62..3c98019 100755
regs.r2192_hour = t->tm_hour;
diff --git a/snes/chip/spc7110/spc7110.cpp b/snes/chip/spc7110/spc7110.cpp
index d2dc640..74a817a 100755
index d2dc640b..74a817a6 100755
--- a/snes/chip/spc7110/spc7110.cpp
+++ b/snes/chip/spc7110/spc7110.cpp
@@ -101,7 +101,7 @@ void SPC7110::set_data_adjust(unsigned addr) { r4814 = addr; r4815 = addr >> 8;
@ -41,7 +41,7 @@ index d2dc640..74a817a 100755
//sizeof(time_t) is platform-dependent; though rtc[] needs to be platform-agnostic.
//yet platforms with 32-bit signed time_t will overflow every ~68 years. handle this by
diff --git a/snes/chip/srtc/srtc.cpp b/snes/chip/srtc/srtc.cpp
index 1b2fd2a..78fc4c1 100755
index 1b2fd2aa..78fc4c1f 100755
--- a/snes/chip/srtc/srtc.cpp
+++ b/snes/chip/srtc/srtc.cpp
@@ -31,7 +31,7 @@ void SRTC::reset() {
@ -54,7 +54,7 @@ index 1b2fd2a..78fc4c1 100755
//sizeof(time_t) is platform-dependent; though rtc[] needs to be platform-agnostic.
//yet platforms with 32-bit signed time_t will overflow every ~68 years. handle this by
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index a0e3a81..b3017c9 100755
index a0e3a81b..b3017c90 100755
--- a/snes/interface/interface.cpp
+++ b/snes/interface/interface.cpp
@@ -18,4 +18,9 @@ void Interface::message(const string &text) {
@ -68,7 +68,7 @@ index a0e3a81..b3017c9 100755
+
}
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
index f1a48c0..df975e8 100755
index f1a48c0f..df975e83 100755
--- a/snes/interface/interface.hpp
+++ b/snes/interface/interface.hpp
@@ -5,6 +5,7 @@ struct Interface {
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
extern Interface *interface;
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,30 +1,30 @@
From c7bf497a7016c9be3a1e2fff46973a555f9ad555 Mon Sep 17 00:00:00 2001
From efe1b5884c316ce070953edd87c6c9aeffffaa94 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 01:52:08 +0200
Subject: [PATCH 4/7] Save controller state when savestating
Subject: [PATCH 04/27] Save controller state when savestating
When savestating, save the controller state and restore it upon loadstate.
Prevents libsnes from mixing up buttons.
---
snes/controller/controller.cpp | 8 ++++++
snes/controller/controller.hpp | 2 +
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 ++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/system/input.cpp | 16 +++++++++++++
snes/system/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
snes/controller/controller.cpp | 8 +++++++
snes/controller/controller.hpp | 2 ++
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 +++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/system/input.cpp | 16 ++++++++++++++
snes/system/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
15 files changed, 142 insertions(+), 3 deletions(-)
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
index 9091b21..f254bed 100755
index 9091b21b..f254bedb 100755
--- a/snes/controller/controller.cpp
+++ b/snes/controller/controller.cpp
@@ -46,8 +46,16 @@ void Controller::iobit(bool data) {
@ -45,7 +45,7 @@ index 9091b21..f254bed 100755
+
}
diff --git a/snes/controller/controller.hpp b/snes/controller/controller.hpp
index 7332712..827b2eb 100755
index 73327129..827b2eb4 100755
--- a/snes/controller/controller.hpp
+++ b/snes/controller/controller.hpp
@@ -13,12 +13,14 @@
@ -64,7 +64,7 @@ index 7332712..827b2eb 100755
bool iobit();
void iobit(bool data);
diff --git a/snes/controller/gamepad/gamepad.cpp b/snes/controller/gamepad/gamepad.cpp
index 594020d..4fa1c99 100755
index 594020d2..4fa1c99e 100755
--- a/snes/controller/gamepad/gamepad.cpp
+++ b/snes/controller/gamepad/gamepad.cpp
@@ -13,6 +13,19 @@ void Gamepad::latch(bool data) {
@ -88,7 +88,7 @@ index 594020d..4fa1c99 100755
latched = 0;
counter = 0;
diff --git a/snes/controller/gamepad/gamepad.hpp b/snes/controller/gamepad/gamepad.hpp
index c5ca69c..a2392d1 100755
index c5ca69ca..a2392d1e 100755
--- a/snes/controller/gamepad/gamepad.hpp
+++ b/snes/controller/gamepad/gamepad.hpp
@@ -2,7 +2,7 @@ struct Gamepad : Controller {
@ -101,7 +101,7 @@ index c5ca69c..a2392d1 100755
bool latched;
unsigned counter;
diff --git a/snes/controller/justifier/justifier.cpp b/snes/controller/justifier/justifier.cpp
index 6207916..ad13a9b 100755
index 62079166..ad13a9bd 100755
--- a/snes/controller/justifier/justifier.cpp
+++ b/snes/controller/justifier/justifier.cpp
@@ -100,6 +100,42 @@ void Justifier::latch(bool data) {
@ -148,7 +148,7 @@ index 6207916..ad13a9b 100755
create(Controller::Enter, 21477272);
latched = 0;
diff --git a/snes/controller/justifier/justifier.hpp b/snes/controller/justifier/justifier.hpp
index f927acf..6b7bba0 100755
index f927acf6..6b7bba07 100755
--- a/snes/controller/justifier/justifier.hpp
+++ b/snes/controller/justifier/justifier.hpp
@@ -2,6 +2,7 @@ struct Justifier : Controller {
@ -160,7 +160,7 @@ index f927acf..6b7bba0 100755
//private:
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
index c9f5d16..6b26fae 100755
index c9f5d16b..6b26fae5 100755
--- a/snes/controller/mouse/mouse.cpp
+++ b/snes/controller/mouse/mouse.cpp
@@ -61,6 +61,19 @@ void Mouse::latch(bool data) {
@ -184,7 +184,7 @@ index c9f5d16..6b26fae 100755
latched = 0;
counter = 0;
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
index 95e24b6..b66ea51 100755
index 95e24b65..b66ea513 100755
--- a/snes/controller/mouse/mouse.hpp
+++ b/snes/controller/mouse/mouse.hpp
@@ -2,7 +2,7 @@ struct Mouse : Controller {
@ -197,7 +197,7 @@ index 95e24b6..b66ea51 100755
bool latched;
unsigned counter;
diff --git a/snes/controller/multitap/multitap.cpp b/snes/controller/multitap/multitap.cpp
index 3a6eb72..146c41d 100755
index 3a6eb720..146c41d4 100755
--- a/snes/controller/multitap/multitap.cpp
+++ b/snes/controller/multitap/multitap.cpp
@@ -30,6 +30,22 @@ void Multitap::latch(bool data) {
@ -224,7 +224,7 @@ index 3a6eb72..146c41d 100755
latched = 0;
counter1 = 0;
diff --git a/snes/controller/multitap/multitap.hpp b/snes/controller/multitap/multitap.hpp
index 0540af7..e6324ac 100755
index 0540af71..e6324ac5 100755
--- a/snes/controller/multitap/multitap.hpp
+++ b/snes/controller/multitap/multitap.hpp
@@ -2,7 +2,7 @@ struct Multitap : Controller {
@ -237,7 +237,7 @@ index 0540af7..e6324ac 100755
bool latched;
unsigned counter1;
diff --git a/snes/controller/superscope/superscope.cpp b/snes/controller/superscope/superscope.cpp
index 12068f0..1a1dfbf 100755
index 12068f05..1a1dfbff 100755
--- a/snes/controller/superscope/superscope.cpp
+++ b/snes/controller/superscope/superscope.cpp
@@ -100,6 +100,37 @@ void SuperScope::latch(bool data) {
@ -279,7 +279,7 @@ index 12068f0..1a1dfbf 100755
create(Controller::Enter, 21477272);
latched = 0;
diff --git a/snes/controller/superscope/superscope.hpp b/snes/controller/superscope/superscope.hpp
index a7a90b7..93509d7 100755
index a7a90b71..93509d79 100755
--- a/snes/controller/superscope/superscope.hpp
+++ b/snes/controller/superscope/superscope.hpp
@@ -2,6 +2,7 @@ struct SuperScope : Controller {
@ -291,7 +291,7 @@ index a7a90b7..93509d7 100755
//private:
diff --git a/snes/system/input.cpp b/snes/system/input.cpp
index 9050310..ec5559d 100755
index 90503106..ec5559dc 100755
--- a/snes/system/input.cpp
+++ b/snes/system/input.cpp
@@ -26,6 +26,22 @@ void Input::connect(bool port, Input::Device id) {
@ -318,7 +318,7 @@ index 9050310..ec5559d 100755
connect(Controller::Port1, Input::Device::Joypad);
connect(Controller::Port2, Input::Device::Joypad);
diff --git a/snes/system/input.hpp b/snes/system/input.hpp
index 13ef46e..6832e82 100755
index 13ef46e1..6832e823 100755
--- a/snes/system/input.hpp
+++ b/snes/system/input.hpp
@@ -31,6 +31,7 @@ struct Input {
@ -330,7 +330,7 @@ index 13ef46e..6832e82 100755
Input();
~Input();
diff --git a/snes/system/serialization.cpp b/snes/system/serialization.cpp
index f7d6f3b..08e7051 100755
index f7d6f3b1..08e70510 100755
--- a/snes/system/serialization.cpp
+++ b/snes/system/serialization.cpp
@@ -56,6 +56,7 @@ void System::serialize_all(serializer &s) {
@ -342,5 +342,5 @@ index f7d6f3b..08e7051 100755
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
if(cartridge.mode() == Cartridge::Mode::SuperGameBoy) icd2.serialize(s);
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,14 +1,14 @@
From 18812e5cc5bd4cdc7cc7ef87a18bce78adbb4b13 Mon Sep 17 00:00:00 2001
From cdf2f46490f128308eb7f399d03530936ebeda0a Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Fri, 11 Nov 2011 03:05:48 +0200
Subject: [PATCH 5/7] Fix unserialization of 64-bit signed integers
Subject: [PATCH 05/27] Fix unserialization of 64-bit signed integers
---
nall/serializer.hpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
nall/serializer.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nall/serializer.hpp b/nall/serializer.hpp
index ff2337a..e6bc8fa 100755
index ff2337ab..e6bc8fad 100755
--- a/nall/serializer.hpp
+++ b/nall/serializer.hpp
@@ -58,7 +58,7 @@ namespace nall {
@ -21,5 +21,5 @@ index ff2337a..e6bc8fa 100755
isize += size;
}
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,16 +1,16 @@
From efe643e986ac15028ac7c7842532d8a8fb33963b Mon Sep 17 00:00:00 2001
From 4dc46334ec175e26277632fee4aea80768749af9 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Fri, 11 Nov 2011 19:49:46 +0200
Subject: [PATCH 6/7] Allow frontend to control random number seed
Subject: [PATCH 06/27] Allow frontend to control random number seed
---
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletions(-)
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index b3017c9..0a21a13 100755
index b3017c90..0a21a132 100755
--- a/snes/interface/interface.cpp
+++ b/snes/interface/interface.cpp
@@ -23,4 +23,9 @@ time_t Interface::currentTime()
@ -24,7 +24,7 @@ index b3017c9..0a21a13 100755
+
}
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
index df975e8..30ee7fd 100755
index df975e83..30ee7fde 100755
--- a/snes/interface/interface.hpp
+++ b/snes/interface/interface.hpp
@@ -6,6 +6,7 @@ struct Interface {
@ -36,7 +36,7 @@ index df975e8..30ee7fd 100755
extern Interface *interface;
diff --git a/snes/system/system.cpp b/snes/system/system.cpp
index c19a7c5..dbd912d 100755
index c19a7c51..dbd912d8 100755
--- a/snes/system/system.cpp
+++ b/snes/system/system.cpp
@@ -146,7 +146,7 @@ void System::unload() {
@ -49,5 +49,5 @@ index c19a7c5..dbd912d 100755
region = config.region;
expansion = config.expansion_port;
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,60 +1,63 @@
From ce95700dc34ffdc5370aa699992bd8275e21c5c2 Mon Sep 17 00:00:00 2001
From eeaf6dc52d39ca9c150ff61864c11297d200d968 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 7 Mar 2012 16:57:18 +0200
Subject: [PATCH 7/7] Fix mouse polling
Subject: [PATCH 07/27] Fix mouse polling
Don't poll for mouse motion excessive number of times (no need to poll it for
each bit!)
---
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 12 insertions(+), 2 deletions(-)
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
index 6b26fae..824ecd3 100755
index 6b26fae5..1a066b98 100755
--- a/snes/controller/mouse/mouse.cpp
+++ b/snes/controller/mouse/mouse.cpp
@@ -3,8 +3,10 @@
@@ -3,9 +3,13 @@
uint2 Mouse::data() {
if(counter >= 32) return 1;
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ if(counter == 0) {
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ }
+ int position_x = _position_x;
+ int position_y = _position_y;
bool direction_x = position_x < 0; //0 = right, 1 = left
bool direction_y = position_y < 0; //0 = down, 1 = up
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
unsigned char block[Controller::SaveSize] = {0};
block[0] = latched ? 1 : 0;
block[1] = counter;
+ block[2] = (unsigned short)position_x >> 8;
+ block[3] = (unsigned short)position_x;
+ block[4] = (unsigned short)position_y >> 8;
+ block[5] = (unsigned short)position_y;
+ block[2] = (unsigned short)_position_x >> 8;
+ block[3] = (unsigned short)_position_x;
+ block[4] = (unsigned short)_position_y >> 8;
+ block[5] = (unsigned short)_position_y;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
}
}
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
index b66ea51..6074f34 100755
index b66ea513..b07c8ab7 100755
--- a/snes/controller/mouse/mouse.hpp
+++ b/snes/controller/mouse/mouse.hpp
@@ -6,4 +6,6 @@ struct Mouse : Controller {
private:
bool latched;
unsigned counter;
+ int position_x;
+ int position_y;
+ int _position_x;
+ int _position_y;
};
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,22 +1,22 @@
From 3761a50c0faed2d9252781c5508bf91cc84ad493 Mon Sep 17 00:00:00 2001
From 7018377c93553071fc404db872b2746d40ac3bce Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 1 Sep 2012 11:23:34 +0300
Subject: [PATCH] Fix uninitialized variables
Subject: [PATCH 08/27] Fix uninitialized variables
These uninitialized variables cause a lot of desyncs in Shadowrun.
---
snes/alt/dsp/dsp.cpp | 2 ++
snes/alt/ppu-compatibility/ppu.cpp | 11 +++++++++++
snes/cpu/core/core.cpp | 8 ++++++++
snes/cpu/core/core.hpp | 2 ++
snes/cpu/cpu.cpp | 1 +
snes/smp/core/core.cpp | 11 +++++++++++
snes/smp/core/core.hpp | 2 ++
snes/smp/smp.cpp | 1 +
8 files changed, 38 insertions(+), 0 deletions(-)
snes/alt/dsp/dsp.cpp | 2 ++
snes/alt/ppu-compatibility/ppu.cpp | 11 +++++++++++
snes/cpu/core/core.cpp | 8 ++++++++
snes/cpu/core/core.hpp | 2 ++
snes/cpu/cpu.cpp | 1 +
snes/smp/core/core.cpp | 11 +++++++++++
snes/smp/core/core.hpp | 2 ++
snes/smp/smp.cpp | 1 +
8 files changed, 38 insertions(+)
diff --git a/snes/alt/dsp/dsp.cpp b/snes/alt/dsp/dsp.cpp
index d0c9e07..c6809f7 100755
index d0c9e077..c6809f73 100755
--- a/snes/alt/dsp/dsp.cpp
+++ b/snes/alt/dsp/dsp.cpp
@@ -40,6 +40,8 @@ void DSP::write(uint8 addr, uint8 data) {
@ -29,7 +29,7 @@ index d0c9e07..c6809f7 100755
spc_dsp.reset();
spc_dsp.set_output(samplebuffer, 8192);
diff --git a/snes/alt/ppu-compatibility/ppu.cpp b/snes/alt/ppu-compatibility/ppu.cpp
index 1a3835b..a21e5e3 100755
index 1a3835b3..a21e5e31 100755
--- a/snes/alt/ppu-compatibility/ppu.cpp
+++ b/snes/alt/ppu-compatibility/ppu.cpp
@@ -345,6 +345,17 @@ void PPU::power() {
@ -51,7 +51,7 @@ index 1a3835b..a21e5e3 100755
}
diff --git a/snes/cpu/core/core.cpp b/snes/cpu/core/core.cpp
index 427176b..a5b809b 100755
index 427176b0..a5b809b9 100755
--- a/snes/cpu/core/core.cpp
+++ b/snes/cpu/core/core.cpp
@@ -86,4 +86,12 @@ CPUcore::CPUcore() {
@ -68,7 +68,7 @@ index 427176b..a5b809b 100755
+
}
diff --git a/snes/cpu/core/core.hpp b/snes/cpu/core/core.hpp
index 964bd12..7a685a8 100755
index 964bd128..7a685a8d 100755
--- a/snes/cpu/core/core.hpp
+++ b/snes/cpu/core/core.hpp
@@ -7,6 +7,8 @@ struct CPUcore {
@ -81,7 +81,7 @@ index 964bd12..7a685a8 100755
virtual uint8_t op_read(uint32_t addr) = 0;
virtual void op_write(uint32_t addr, uint8_t data) = 0;
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
index f6ae975..2d7d343 100755
index f6ae9754..2d7d3432 100755
--- a/snes/cpu/cpu.cpp
+++ b/snes/cpu/cpu.cpp
@@ -125,6 +125,7 @@ void CPU::power() {
@ -93,7 +93,7 @@ index f6ae975..2d7d343 100755
void CPU::reset() {
diff --git a/snes/smp/core/core.cpp b/snes/smp/core/core.cpp
index 9c94d00..2fc29be 100755
index 9c94d00a..2fc29be1 100755
--- a/snes/smp/core/core.cpp
+++ b/snes/smp/core/core.cpp
@@ -269,4 +269,15 @@ void SMPcore::op_step() {
@ -113,7 +113,7 @@ index 9c94d00..2fc29be 100755
+
}
diff --git a/snes/smp/core/core.hpp b/snes/smp/core/core.hpp
index 6adf6f6..1489fce 100755
index 6adf6f6b..1489fcef 100755
--- a/snes/smp/core/core.hpp
+++ b/snes/smp/core/core.hpp
@@ -11,6 +11,8 @@ struct SMPcore {
@ -126,7 +126,7 @@ index 6adf6f6..1489fce 100755
string disassemble_opcode(uint16 addr);
diff --git a/snes/smp/smp.cpp b/snes/smp/smp.cpp
index 9080624..d4ccf42 100755
index 90806245..d4ccf425 100755
--- a/snes/smp/smp.cpp
+++ b/snes/smp/smp.cpp
@@ -53,6 +53,7 @@ void SMP::power() {
@ -138,5 +138,5 @@ index 9080624..d4ccf42 100755
void SMP::reset() {
--
1.7.9.48.g85da4d
2.15.0.rc1

View file

@ -1,18 +1,18 @@
From 03f134f4db8d179cf95f6017dffd893cd3801e82 Mon Sep 17 00:00:00 2001
From 6e0364c9a86caa71623a188a720b2d68b304b89b Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 24 Sep 2012 21:46:09 +0300
Subject: [PATCH] Add needed support for detecting true polls as opposed to
just autopolling
Subject: [PATCH 09/27] Add needed support for detecting true polls as opposed
to just autopolling
---
bsnes/snes/cpu/cpu.hpp | 1 +
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
snes/cpu/cpu.hpp | 1 +
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
index 3da865e..4944577 100755
--- a/bsnes/snes/cpu/cpu.hpp
+++ b/bsnes/snes/cpu/cpu.hpp
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
index 3da865e2..49445773 100755
--- a/snes/cpu/cpu.hpp
+++ b/snes/cpu/cpu.hpp
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
CPU();
~CPU();
@ -21,10 +21,10 @@ index 3da865e..4944577 100755
private:
#include "dma/dma.hpp"
#include "memory/memory.hpp"
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
index 8b6aaa6..c5ee930 100755
--- a/bsnes/snes/cpu/mmio/mmio.cpp
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index 8b6aaa6a..c5ee930f 100755
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
//1-0 = Joypad serial data
uint8 CPU::mmio_r4016() {
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
//DMAPx
uint8 CPU::mmio_r43x0(uint8 i) {
--
1.7.10.4
2.15.0.rc1

View file

@ -1,16 +1,16 @@
From 36777ec11c093a1cc902b8b72188e06f49a4d0f2 Mon Sep 17 00:00:00 2001
From e397bd46f17d6ea00c8c96d5a8e0c5f5b4a6f642 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 14 Oct 2012 23:31:36 +0300
Subject: [PATCH] Fix compiling on GCC 4.7
Subject: [PATCH 10/27] Fix compiling on GCC 4.7
---
bsnes/nall/string.hpp | 2 +-
nall/string.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bsnes/nall/string.hpp b/bsnes/nall/string.hpp
index 1b255ce..07a64df 100755
--- a/bsnes/nall/string.hpp
+++ b/bsnes/nall/string.hpp
diff --git a/nall/string.hpp b/nall/string.hpp
index 1b255ce2..07a64dfc 100755
--- a/nall/string.hpp
+++ b/nall/string.hpp
@@ -25,8 +25,8 @@
#include <nall/string/base.hpp>
#include <nall/string/bml.hpp>
@ -22,5 +22,5 @@ index 1b255ce..07a64df 100755
#include <nall/string/convert.hpp>
#include <nall/string/cstring.hpp>
--
1.7.10.4
2.15.0.rc1

View file

@ -0,0 +1,65 @@
From e047aa8eb9883f60e4141effba8128a4a555d8be Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 27 Oct 2013 10:52:45 +0200
Subject: [PATCH 11/27] Support notifying latches
---
snes/cpu/mmio/mmio.cpp | 1 +
snes/cpu/timing/joypad.cpp | 1 +
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
4 files changed, 8 insertions(+)
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index c5ee930f..b7afff00 100755
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
//strobing $4016.d0 affects both controller port latches.
//$4017 bit 0 writes are ignored.
void CPU::mmio_w4016(uint8 data) {
+ if(data&1) interface->notifyLatched();
input.port1->latch(data & 1);
input.port2->latch(data & 1);
}
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index 179df27d..6a98de00 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -9,6 +9,7 @@ void CPU::step_auto_joypad_poll() {
if(status.auto_joypad_active && status.auto_joypad_latch) {
if(status.auto_joypad_counter == 0) {
+ interface->notifyLatched();
input.port1->latch(1);
input.port2->latch(1);
input.port1->latch(0);
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index 0a21a132..6685556c 100755
--- a/snes/interface/interface.cpp
+++ b/snes/interface/interface.cpp
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
return time(0);
}
+void Interface::notifyLatched()
+{
+ //Nothing.
+}
+
}
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
index 30ee7fde..203f7b0c 100755
--- a/snes/interface/interface.hpp
+++ b/snes/interface/interface.hpp
@@ -7,6 +7,7 @@ struct Interface {
virtual void message(const string &text);
virtual time_t currentTime();
virtual time_t randomSeed();
+ virtual void notifyLatched();
};
extern Interface *interface;
--
2.15.0.rc1

View file

@ -0,0 +1,799 @@
From a5b380757b086e3a00b47fe14e2a63c74683e8da Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Thu, 28 Nov 2013 22:36:29 +0200
Subject: [PATCH 12/27] Support unlimited number of breakpoints
---
snes/alt/cpu/cpu.cpp | 22 +++++++-------
snes/alt/ppu-compatibility/ppu.cpp | 4 +--
snes/alt/ppu-parallel/ppu.cpp | 4 +--
snes/alt/ppu-performance/ppu.cpp | 4 +--
snes/cartridge/cartridge.hpp | 17 +++++++++++
snes/cartridge/markup.cpp | 11 +++++++
snes/cheat/cheat.cpp | 11 ++++---
snes/cheat/cheat.hpp | 1 +
snes/chip/bsx/satellaview/satellaview.cpp | 4 +--
snes/chip/hitachidsp/hitachidsp.cpp | 2 +-
snes/chip/hitachidsp/memory.cpp | 2 +-
snes/chip/nss/nss.cpp | 4 +--
snes/chip/sa1/memory/memory.cpp | 2 +-
snes/chip/sa1/memory/memory.hpp | 2 +-
snes/chip/sa1/sa1.cpp | 2 +-
snes/chip/sdd1/sdd1.cpp | 4 +--
snes/cpu/core/core.hpp | 2 +-
snes/cpu/core/disassembler/disassembler.cpp | 2 +-
snes/cpu/core/memory.hpp | 2 +-
snes/cpu/cpu.cpp | 26 ++++++++--------
snes/cpu/debugger/debugger.cpp | 4 +--
snes/cpu/debugger/debugger.hpp | 2 +-
snes/cpu/dma/dma.cpp | 4 +--
snes/cpu/memory/memory.cpp | 4 +--
snes/cpu/memory/memory.hpp | 2 +-
snes/cpu/mmio/mmio.cpp | 2 +-
snes/debugger/debugger.cpp | 2 +-
snes/memory/memory-inline.hpp | 21 +++++++++++--
snes/memory/memory.cpp | 47 ++++++++++++++++++++++++++---
snes/memory/memory.hpp | 13 +++++++-
snes/ppu/ppu.cpp | 4 +--
snes/smp/core/core.hpp | 2 +-
snes/snes.hpp | 1 +
33 files changed, 166 insertions(+), 70 deletions(-)
diff --git a/snes/alt/cpu/cpu.cpp b/snes/alt/cpu/cpu.cpp
index 814908d0..dcbb92d3 100755
--- a/snes/alt/cpu/cpu.cpp
+++ b/snes/alt/cpu/cpu.cpp
@@ -89,24 +89,24 @@ void CPU::enable() {
function<uint8 (unsigned)> read = { &CPU::mmio_read, (CPU*)&cpu };
function<void (unsigned, uint8)> write = { &CPU::mmio_write, (CPU*)&cpu };
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, 0, read, write);
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, 0, read, write);
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, 0, read, write);
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, 0, read, write);
read = [](unsigned addr) { return cpu.wram[addr]; };
write = [](unsigned addr, uint8 data) { cpu.wram[addr] = data; };
- bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
- bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
- bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, read, write);
+ bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
+ bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
+ bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, 3, read, write);
}
void CPU::power() {
diff --git a/snes/alt/ppu-compatibility/ppu.cpp b/snes/alt/ppu-compatibility/ppu.cpp
index a21e5e31..122b1430 100755
--- a/snes/alt/ppu-compatibility/ppu.cpp
+++ b/snes/alt/ppu-compatibility/ppu.cpp
@@ -126,8 +126,8 @@ void PPU::enable() {
function<uint8 (unsigned)> read = { &PPU::mmio_read, (PPU*)&ppu };
function<void (unsigned, uint8)> write = { &PPU::mmio_write, (PPU*)&ppu };
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, read, write);
}
void PPU::power() {
diff --git a/snes/alt/ppu-parallel/ppu.cpp b/snes/alt/ppu-parallel/ppu.cpp
index 1c3dcb70..8dd118b2 100755
--- a/snes/alt/ppu-parallel/ppu.cpp
+++ b/snes/alt/ppu-parallel/ppu.cpp
@@ -36,8 +36,8 @@ void PPU::frame() {
}
void PPU::enable() {
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, { &PPU::mmio_read, this }, { &PPU::mmio_write, this });
}
void PPU::power() {
diff --git a/snes/alt/ppu-performance/ppu.cpp b/snes/alt/ppu-performance/ppu.cpp
index 7c231bc0..4b2b2948 100755
--- a/snes/alt/ppu-performance/ppu.cpp
+++ b/snes/alt/ppu-performance/ppu.cpp
@@ -90,8 +90,8 @@ void PPU::enable() {
function<uint8 (unsigned)> read = { &PPU::mmio_read, (PPU*)&ppu };
function<void (unsigned, uint8)> write = { &PPU::mmio_write, (PPU*)&ppu };
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, read, write);
}
void PPU::power() {
diff --git a/snes/cartridge/cartridge.hpp b/snes/cartridge/cartridge.hpp
index 37555bc0..82e73c4c 100755
--- a/snes/cartridge/cartridge.hpp
+++ b/snes/cartridge/cartridge.hpp
@@ -12,6 +12,22 @@ struct Cartridge : property<Cartridge> {
PAL,
};
+ enum class MemoryClass : unsigned {
+ MISC = 0,
+ ROM = 1,
+ SRAM = 2,
+ WRAM = 3,
+ SUPERFXROM = 4,
+ SUPERFXRAM = 5,
+ SA1IRAM = 6,
+ SA1BWRAM = 7,
+ SUFAMITURBO_ROMA = 8,
+ SUFAMITURBO_ROMB = 9,
+ SUFAMITURBO_RAMA = 10,
+ SUFAMITURBO_RAMB = 11,
+ BSXFLASH = 12,
+ };
+
enum class Slot : unsigned {
Base,
Bsx,
@@ -68,6 +84,7 @@ struct Cartridge : property<Cartridge> {
unsigned addrhi;
unsigned offset;
unsigned size;
+ MemoryClass clazz;
Mapping();
Mapping(const function<uint8 (unsigned)>&, const function<void (unsigned, uint8)>&);
diff --git a/snes/cartridge/markup.cpp b/snes/cartridge/markup.cpp
index e639fe52..2dd0d646 100755
--- a/snes/cartridge/markup.cpp
+++ b/snes/cartridge/markup.cpp
@@ -74,6 +74,7 @@ void Cartridge::parse_markup_rom(XML::Node &root) {
for(auto &node : root) {
if(node.name != "map") continue;
Mapping m(rom);
+ m.clazz = MemoryClass::ROM;
parse_markup_map(m, node);
if(m.size == 0) m.size = rom.size();
mapping.append(m);
@@ -85,6 +86,7 @@ void Cartridge::parse_markup_ram(XML::Node &root) {
ram_size = parse_markup_integer(root["size"].data);
for(auto &node : root) {
Mapping m(ram);
+ m.clazz = MemoryClass::SRAM;
parse_markup_map(m, node);
if(m.size == 0) m.size = ram_size;
mapping.append(m);
@@ -133,6 +135,7 @@ void Cartridge::parse_markup_superfx(XML::Node &root) {
for(auto &leaf : node) {
if(leaf.name != "map") continue;
Mapping m(superfx.rom);
+ //m.clazz = MemoryClass::SUPERFXROM; -- Aliases ROM.
parse_markup_map(m, leaf);
mapping.append(m);
}
@@ -145,6 +148,7 @@ void Cartridge::parse_markup_superfx(XML::Node &root) {
}
if(leaf.name != "map") continue;
Mapping m(superfx.ram);
+ //m.clazz = MemoryClass::SUPERFXRAM; -- Aliases SRAM.
parse_markup_map(m, leaf);
if(m.size == 0) m.size = ram_size;
mapping.append(m);
@@ -188,6 +192,7 @@ void Cartridge::parse_markup_sa1(XML::Node &root) {
for(auto &node : iram) {
if(node.name != "map") continue;
Mapping m(sa1.cpuiram);
+ m.clazz = MemoryClass::SA1IRAM;
parse_markup_map(m, node);
if(m.size == 0) m.size = 2048;
mapping.append(m);
@@ -197,6 +202,7 @@ void Cartridge::parse_markup_sa1(XML::Node &root) {
for(auto &node : bwram) {
if(node.name != "map") continue;
Mapping m(sa1.cpubwram);
+ //m.clazz = MemoryClass::SA1BWRAM; -- Aliases SRAM
parse_markup_map(m, node);
if(m.size == 0) m.size = ram_size;
mapping.append(m);
@@ -341,6 +347,7 @@ void Cartridge::parse_markup_bsx(XML::Node &root) {
for(auto &node : root["slot"]) {
if(node.name != "map") continue;
Mapping m(bsxflash.memory);
+ m.clazz = MemoryClass::BSXFLASH;
parse_markup_map(m, node);
mapping.append(m);
}
@@ -373,6 +380,7 @@ void Cartridge::parse_markup_sufamiturbo(XML::Node &root) {
if(leaf.name != "map") continue;
Memory &memory = slotid == 0 ? sufamiturbo.slotA.rom : sufamiturbo.slotB.rom;
Mapping m(memory);
+ m.clazz = slotid ? MemoryClass::SUFAMITURBO_ROMB : MemoryClass::SUFAMITURBO_ROMA;
parse_markup_map(m, leaf);
if(m.size == 0) m.size = memory.size();
if(m.size) mapping.append(m);
@@ -384,6 +392,7 @@ void Cartridge::parse_markup_sufamiturbo(XML::Node &root) {
if(leaf.name != "map") continue;
Memory &memory = slotid == 0 ? sufamiturbo.slotA.ram : sufamiturbo.slotB.ram;
Mapping m(memory);
+ m.clazz = slotid ? MemoryClass::SUFAMITURBO_RAMB : MemoryClass::SUFAMITURBO_RAMA;
parse_markup_map(m, leaf);
if(m.size == 0) m.size = ram_size;
if(m.size) mapping.append(m);
@@ -536,11 +545,13 @@ void Cartridge::parse_markup_link(XML::Node &root) {
}
Cartridge::Mapping::Mapping() {
+ clazz = MemoryClass::MISC;
mode = Bus::MapMode::Direct;
banklo = bankhi = addrlo = addrhi = offset = size = 0;
}
Cartridge::Mapping::Mapping(Memory &memory) {
+ clazz = MemoryClass::MISC;
read = { &Memory::read, &memory };
write = { &Memory::write, &memory };
mode = Bus::MapMode::Direct;
diff --git a/snes/cheat/cheat.cpp b/snes/cheat/cheat.cpp
index 46c42d1c..3a269cc5 100755
--- a/snes/cheat/cheat.cpp
+++ b/snes/cheat/cheat.cpp
@@ -21,9 +21,9 @@ void Cheat::synchronize() {
for(unsigned i = 0; i < size(); i++) {
const CheatCode &code = operator[](i);
- unsigned addr = mirror(code.addr);
+ unsigned addr = code.nomirror ? code.addr : mirror(code.addr);
override[addr] = true;
- if((addr & 0xffe000) == 0x7e0000) {
+ if(!code.nomirror && (addr & 0xffe000) == 0x7e0000) {
//mirror $7e:0000-1fff to $00-3f|80-bf:0000-1fff
unsigned mirroraddr;
for(unsigned x = 0; x <= 0x3f; x++) {
@@ -40,11 +40,14 @@ void Cheat::synchronize() {
}
uint8 Cheat::read(unsigned addr) const {
- addr = mirror(addr);
+ unsigned raddr = mirror(addr);
for(unsigned i = 0; i < size(); i++) {
const CheatCode &code = operator[](i);
- if(addr == mirror(code.addr)) {
+ if(!code.nomirror && addr == mirror(code.addr)) {
+ return code.data;
+ }
+ if(code.nomirror && raddr == code.addr) {
return code.data;
}
}
diff --git a/snes/cheat/cheat.hpp b/snes/cheat/cheat.hpp
index 306b99b1..b4d2a42e 100755
--- a/snes/cheat/cheat.hpp
+++ b/snes/cheat/cheat.hpp
@@ -1,6 +1,7 @@
struct CheatCode {
unsigned addr;
unsigned data;
+ bool nomirror;
};
struct Cheat : public linear_vector<CheatCode> {
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
index 3c980195..25af8e56 100755
--- a/snes/chip/bsx/satellaview/satellaview.cpp
+++ b/snes/chip/bsx/satellaview/satellaview.cpp
@@ -6,8 +6,8 @@ void BSXSatellaview::init() {
}
void BSXSatellaview::load() {
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2188, 0x219f, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2188, 0x219f, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2188, 0x219f, 0, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2188, 0x219f, 0, { &BSXSatellaview::mmio_read, &bsxsatellaview }, { &BSXSatellaview::mmio_write, &bsxsatellaview });
}
void BSXSatellaview::unload() {
diff --git a/snes/chip/hitachidsp/hitachidsp.cpp b/snes/chip/hitachidsp/hitachidsp.cpp
index 1042267e..3e5c5bdb 100755
--- a/snes/chip/hitachidsp/hitachidsp.cpp
+++ b/snes/chip/hitachidsp/hitachidsp.cpp
@@ -23,7 +23,7 @@ void HitachiDSP::enter() {
break;
case State::DMA:
for(unsigned n = 0; n < regs.dma_length; n++) {
- bus.write(regs.dma_target + n, bus.read(regs.dma_source + n));
+ bus.write(regs.dma_target + n, bus.read(regs.dma_source + n, false));
step(2);
}
state = State::Idle;
diff --git a/snes/chip/hitachidsp/memory.cpp b/snes/chip/hitachidsp/memory.cpp
index 3c9c3af1..36868e88 100755
--- a/snes/chip/hitachidsp/memory.cpp
+++ b/snes/chip/hitachidsp/memory.cpp
@@ -1,7 +1,7 @@
#ifdef HITACHIDSP_CPP
uint8 HitachiDSP::bus_read(unsigned addr) {
- if((addr & 0x408000) == 0x008000) return bus.read(addr);
+ if((addr & 0x408000) == 0x008000) return bus.read(addr, false);
return 0x00;
}
diff --git a/snes/chip/nss/nss.cpp b/snes/chip/nss/nss.cpp
index 964973d0..5946af3b 100755
--- a/snes/chip/nss/nss.cpp
+++ b/snes/chip/nss/nss.cpp
@@ -10,8 +10,8 @@ void NSS::init() {
void NSS::load() {
dip = 0x0000;
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4100, 0x4101, { &NSS::read, this }, { &NSS::write, this });
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4100, 0x4101, { &NSS::read, this }, { &NSS::write, this });
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4100, 0x4101, 0, { &NSS::read, this }, { &NSS::write, this });
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4100, 0x4101, 0, { &NSS::read, this }, { &NSS::write, this });
}
void NSS::unload() {
diff --git a/snes/chip/sa1/memory/memory.cpp b/snes/chip/sa1/memory/memory.cpp
index d13ac929..9bb4ff20 100755
--- a/snes/chip/sa1/memory/memory.cpp
+++ b/snes/chip/sa1/memory/memory.cpp
@@ -107,7 +107,7 @@ void SA1::op_io() {
tick();
}
-uint8 SA1::op_read(unsigned addr) {
+uint8 SA1::op_read(unsigned addr, bool exec) {
tick();
if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick();
return bus_read(addr);
diff --git a/snes/chip/sa1/memory/memory.hpp b/snes/chip/sa1/memory/memory.hpp
index ffb9e9f6..ab8e1edd 100755
--- a/snes/chip/sa1/memory/memory.hpp
+++ b/snes/chip/sa1/memory/memory.hpp
@@ -3,7 +3,7 @@ void bus_write(unsigned addr, uint8 data);
uint8 vbr_read(unsigned addr);
alwaysinline void op_io();
-alwaysinline uint8 op_read(unsigned addr);
+alwaysinline uint8 op_read(unsigned addr, bool exec);
alwaysinline void op_write(unsigned addr, uint8 data);
uint8 mmc_read(unsigned addr);
diff --git a/snes/chip/sa1/sa1.cpp b/snes/chip/sa1/sa1.cpp
index 71c6310a..30e00809 100755
--- a/snes/chip/sa1/sa1.cpp
+++ b/snes/chip/sa1/sa1.cpp
@@ -37,7 +37,7 @@ void SA1::enter() {
}
void SA1::op_irq() {
- op_read(regs.pc.d);
+ op_read(regs.pc.d, false);
op_io();
if(!regs.e) op_writestack(regs.pc.b);
op_writestack(regs.pc.h);
diff --git a/snes/chip/sdd1/sdd1.cpp b/snes/chip/sdd1/sdd1.cpp
index c9b8b1c4..5d6cc55f 100755
--- a/snes/chip/sdd1/sdd1.cpp
+++ b/snes/chip/sdd1/sdd1.cpp
@@ -14,8 +14,8 @@ void SDD1::init() {
void SDD1::load() {
//hook S-CPU DMA MMIO registers to gather information for struct dma[];
//buffer address and transfer size information for use in SDD1::mcu_read()
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, 0, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, 0, { &SDD1::mmio_read, &sdd1 }, { &SDD1::mmio_write, &sdd1 });
}
void SDD1::unload() {
diff --git a/snes/cpu/core/core.hpp b/snes/cpu/core/core.hpp
index 7a685a8d..9d77f3c5 100755
--- a/snes/cpu/core/core.hpp
+++ b/snes/cpu/core/core.hpp
@@ -10,7 +10,7 @@ struct CPUcore {
void powercycle();
virtual void op_io() = 0;
- virtual uint8_t op_read(uint32_t addr) = 0;
+ virtual uint8_t op_read(uint32_t addr, bool exec = false) = 0;
virtual void op_write(uint32_t addr, uint8_t data) = 0;
virtual void last_cycle() = 0;
virtual bool interrupt_pending() = 0;
diff --git a/snes/cpu/core/disassembler/disassembler.cpp b/snes/cpu/core/disassembler/disassembler.cpp
index 030b3ab5..ab8dde24 100755
--- a/snes/cpu/core/disassembler/disassembler.cpp
+++ b/snes/cpu/core/disassembler/disassembler.cpp
@@ -6,7 +6,7 @@ uint8 CPUcore::dreadb(uint32 addr) {
//do not read MMIO registers within debugger
return 0x00;
}
- return bus.read(addr);
+ return bus.read(addr, false);
}
uint16 CPUcore::dreadw(uint32 addr) {
diff --git a/snes/cpu/core/memory.hpp b/snes/cpu/core/memory.hpp
index 49926578..132501c1 100755
--- a/snes/cpu/core/memory.hpp
+++ b/snes/cpu/core/memory.hpp
@@ -1,5 +1,5 @@
alwaysinline uint8_t op_readpc() {
- return op_read((regs.pc.b << 16) + regs.pc.w++);
+ return op_read((regs.pc.b << 16) + regs.pc.w++, true);
}
alwaysinline uint8_t op_readstack() {
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
index 2d7d3432..39da6b16 100755
--- a/snes/cpu/cpu.cpp
+++ b/snes/cpu/cpu.cpp
@@ -78,8 +78,8 @@ void CPU::enter() {
} else if(status.reset_pending) {
status.reset_pending = false;
add_clocks(186);
- regs.pc.l = bus.read(0xfffc);
- regs.pc.h = bus.read(0xfffd);
+ regs.pc.l = bus.read(0xfffc, false);
+ regs.pc.h = bus.read(0xfffd, false);
}
}
@@ -95,24 +95,24 @@ void CPU::enable() {
function<uint8 (unsigned)> read = { &CPU::mmio_read, (CPU*)&cpu };
function<void (unsigned, uint8)> write = { &CPU::mmio_write, (CPU*)&cpu };
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2140, 0x2183, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2140, 0x2183, 0, read, write);
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4016, 0x4017, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4016, 0x4017, 0, read, write);
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4200, 0x421f, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4200, 0x421f, 0, read, write);
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x4300, 0x437f, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x4300, 0x437f, 0, read, write);
read = [](unsigned addr) { return cpu.wram[addr]; };
write = [](unsigned addr, uint8 data) { cpu.wram[addr] = data; };
- bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
- bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, read, write, 0x000000, 0x002000);
- bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, read, write);
+ bus.map(Bus::MapMode::Linear, 0x00, 0x3f, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
+ bus.map(Bus::MapMode::Linear, 0x80, 0xbf, 0x0000, 0x1fff, 3, read, write, 0x000000, 0x002000);
+ bus.map(Bus::MapMode::Linear, 0x7e, 0x7f, 0x0000, 0xffff, 3, read, write);
}
void CPU::power() {
diff --git a/snes/cpu/debugger/debugger.cpp b/snes/cpu/debugger/debugger.cpp
index a33518ed..8301bdb6 100755
--- a/snes/cpu/debugger/debugger.cpp
+++ b/snes/cpu/debugger/debugger.cpp
@@ -19,8 +19,8 @@ void CPUDebugger::op_step() {
synchronize_smp();
}
-uint8 CPUDebugger::op_read(uint32 addr) {
- uint8 data = CPU::op_read(addr);
+uint8 CPUDebugger::op_read(uint32 addr, bool exec) {
+ uint8 data = CPU::op_read(addr, exec);
usage[addr] |= UsageRead;
debugger.breakpoint_test(Debugger::Breakpoint::Source::CPUBus, Debugger::Breakpoint::Mode::Read, addr, data);
return data;
diff --git a/snes/cpu/debugger/debugger.hpp b/snes/cpu/debugger/debugger.hpp
index 579f6f03..c3d66db5 100755
--- a/snes/cpu/debugger/debugger.hpp
+++ b/snes/cpu/debugger/debugger.hpp
@@ -16,7 +16,7 @@ public:
bool opcode_edge; //true right before an opcode execues, used to skip over opcodes
void op_step();
- uint8 op_read(uint32 addr);
+ uint8 op_read(uint32 addr, bool exec = false);
void op_write(uint32 addr, uint8 data);
CPUDebugger();
diff --git a/snes/cpu/dma/dma.cpp b/snes/cpu/dma/dma.cpp
index e8cdb3ec..0a00bfea 100755
--- a/snes/cpu/dma/dma.cpp
+++ b/snes/cpu/dma/dma.cpp
@@ -26,7 +26,7 @@ bool CPU::dma_addr_valid(uint32 abus) {
uint8 CPU::dma_read(uint32 abus) {
if(dma_addr_valid(abus) == false) return 0x00;
- return bus.read(abus);
+ return bus.read(abus, false);
}
//simulate two-stage pipeline for DMA transfers; example:
@@ -49,7 +49,7 @@ void CPU::dma_transfer(bool direction, uint8 bbus, uint32 abus) {
dma_write(dma_transfer_valid(bbus, abus), 0x2100 | bbus, regs.mdr);
} else {
dma_add_clocks(4);
- regs.mdr = dma_transfer_valid(bbus, abus) ? bus.read(0x2100 | bbus) : 0x00;
+ regs.mdr = dma_transfer_valid(bbus, abus) ? bus.read(0x2100 | bbus, false) : 0x00;
dma_add_clocks(4);
dma_write(dma_addr_valid(abus), abus, regs.mdr);
}
diff --git a/snes/cpu/memory/memory.cpp b/snes/cpu/memory/memory.cpp
index c2c8f1fa..31f82c31 100755
--- a/snes/cpu/memory/memory.cpp
+++ b/snes/cpu/memory/memory.cpp
@@ -10,11 +10,11 @@ void CPU::op_io() {
alu_edge();
}
-uint8 CPU::op_read(uint32 addr) {
+uint8 CPU::op_read(uint32 addr, bool exec) {
status.clock_count = speed(addr);
dma_edge();
add_clocks(status.clock_count - 4);
- regs.mdr = bus.read(addr);
+ regs.mdr = bus.read(addr, exec);
add_clocks(4);
alu_edge();
return regs.mdr;
diff --git a/snes/cpu/memory/memory.hpp b/snes/cpu/memory/memory.hpp
index d33861d4..fd64ba8b 100755
--- a/snes/cpu/memory/memory.hpp
+++ b/snes/cpu/memory/memory.hpp
@@ -1,4 +1,4 @@
void op_io();
-debugvirtual uint8 op_read(uint32 addr);
+debugvirtual uint8 op_read(uint32 addr, bool exec);
debugvirtual void op_write(uint32 addr, uint8 data);
alwaysinline unsigned speed(unsigned addr) const;
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index b7afff00..30048c19 100755
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -5,7 +5,7 @@ bool CPU::joylatch() { return status.joypad_strobe_latch; }
//WMDATA
uint8 CPU::mmio_r2180() {
- return bus.read(0x7e0000 | status.wram_addr++);
+ return bus.read(0x7e0000 | status.wram_addr++, false);
}
//WMDATA
diff --git a/snes/debugger/debugger.cpp b/snes/debugger/debugger.cpp
index b1312339..e8d0f5af 100755
--- a/snes/debugger/debugger.cpp
+++ b/snes/debugger/debugger.cpp
@@ -33,7 +33,7 @@ uint8 Debugger::read(Debugger::MemorySource source, unsigned addr) {
case MemorySource::CPUBus: {
//do not read from memory-mapped registers that could affect program behavior
if(((addr - 0x2000) & 0x40c000) == 0x000000) break; //$00-3f:2000-5fff MMIO
- return bus.read(addr & 0xffffff);
+ return bus.read(addr & 0xffffff, false);
} break;
case MemorySource::APUBus: {
diff --git a/snes/memory/memory-inline.hpp b/snes/memory/memory-inline.hpp
index 70503bea..45f150c9 100755
--- a/snes/memory/memory-inline.hpp
+++ b/snes/memory/memory-inline.hpp
@@ -51,11 +51,26 @@ MappedRAM::MappedRAM() : data_(0), size_(0), write_protect_(false) {}
//Bus
-uint8 Bus::read(unsigned addr) {
- if(cheat.override[addr]) return cheat.read(addr);
- return reader[lookup[addr]](target[addr]);
+uint8 Bus::read(unsigned addr, bool exec) {
+ uint8 emask = exec ? 0x24 : 0x09;
+ uint8 val;
+ if(__builtin_expect(cheat.override[addr], 0))
+ val = cheat.read(addr);
+ else
+ val = reader[lookup[addr]](target[addr]);
+ if(__builtin_expect((u_debugflags | debugflags[addr]) & emask, 0)) {
+ unsigned daddr = target[addr];
+ uint8 mclass = classmap[addr];
+ debug_read(mclass, daddr, addr, val, exec);
+ }
+ return val;
}
void Bus::write(unsigned addr, uint8 data) {
+ if(__builtin_expect((u_debugflags | debugflags[addr]) & 0x12, 0)) {
+ unsigned daddr = target[addr];
+ uint8 mclass = classmap[addr];
+ debug_write(mclass, daddr, addr, data);
+ }
return writer[lookup[addr]](target[addr], data);
}
diff --git a/snes/memory/memory.cpp b/snes/memory/memory.cpp
index ede9cbd0..a9a484a0 100755
--- a/snes/memory/memory.cpp
+++ b/snes/memory/memory.cpp
@@ -27,6 +27,7 @@ void Bus::map(
MapMode mode,
unsigned bank_lo, unsigned bank_hi,
unsigned addr_lo, unsigned addr_hi,
+ unsigned mclass,
const function<uint8 (unsigned)> &rd,
const function<void (unsigned, uint8)> &wr,
unsigned base, unsigned length
@@ -48,6 +49,7 @@ void Bus::map(
if(mode == MapMode::Shadow) destaddr = mirror(base + destaddr, length);
lookup[(bank << 16) | addr] = id;
target[(bank << 16) | addr] = destaddr;
+ if(mclass) classmap[(bank << 16) | addr] = mclass;
}
}
}
@@ -57,23 +59,58 @@ void Bus::map_reset() {
function<void (unsigned, uint8)> writer = [](unsigned, uint8) {};
idcount = 0;
- map(MapMode::Direct, 0x00, 0xff, 0x0000, 0xffff, reader, writer);
+ map(MapMode::Direct, 0x00, 0xff, 0x0000, 0xffff, 0xFF, reader, writer);
}
void Bus::map_xml() {
for(auto &m : cartridge.mapping) {
- map(m.mode, m.banklo, m.bankhi, m.addrlo, m.addrhi, m.read, m.write, m.offset, m.size);
+ map(m.mode, m.banklo, m.bankhi, m.addrlo, m.addrhi, (unsigned)m.clazz, m.read, m.write, m.offset, m.size);
}
}
+unsigned Bus::enumerateMirrors(uint8 clazz, uint32 offset, unsigned start)
+{
+ unsigned i;
+ for(i = start; i < 0x1000000; i++)
+ if((classmap[i] == clazz && target[i] == offset) || (i == offset && clazz == 255))
+ return i;
+ return i;
+}
+
+void Bus::clearDebugFlags()
+{
+ u_debugflags = 0;
+ memset(debugflags, 0, 0x1000000);
+}
+
+void Bus::debugFlags(uint8 setf, uint8 clrf)
+{
+ u_debugflags = (u_debugflags | setf) & ~clrf;
+}
+
+void Bus::debugFlags(uint8 setf, uint8 clrf, uint8 clazz, uint32 offset)
+{
+ if(clazz == 255) {
+ setf <<= 3;
+ clrf <<= 3;
+ debugflags[offset] = (debugflags[offset] | setf) & ~clrf;
+ } else
+ for(unsigned i = 0; i < 0x1000000; i++)
+ if(classmap[i] == clazz && target[i] == offset)
+ debugflags[i] = (debugflags[i] | setf) & ~clrf;
+}
+
Bus::Bus() {
- lookup = new uint8 [16 * 1024 * 1024];
- target = new uint32[16 * 1024 * 1024];
+ u_debugflags = 0;
+ lookup = new uint8 [112 * 1024 * 1024];
+ target = (uint32*)(lookup + 0x3000000);
+ classmap = lookup + 0x1000000;
+ debugflags = lookup + 0x2000000;
+ memset(debugflags, 0, 0x1000000);
}
Bus::~Bus() {
delete[] lookup;
- delete[] target;
}
}
diff --git a/snes/memory/memory.hpp b/snes/memory/memory.hpp
index 634e0717..c20e14db 100755
--- a/snes/memory/memory.hpp
+++ b/snes/memory/memory.hpp
@@ -44,10 +44,13 @@ private:
struct Bus {
unsigned mirror(unsigned addr, unsigned size);
- alwaysinline uint8 read(unsigned addr);
+ alwaysinline uint8 read(unsigned addr, bool exec);
alwaysinline void write(unsigned addr, uint8 data);
uint8 *lookup;
+ uint8 *classmap;
+ uint8 *debugflags;
+ uint8 u_debugflags;
uint32 *target;
unsigned idcount;
@@ -59,6 +62,7 @@ struct Bus {
MapMode mode,
unsigned bank_lo, unsigned bank_hi,
unsigned addr_lo, unsigned addr_hi,
+ unsigned mclass,
const function<uint8 (unsigned)> &read,
const function<void (unsigned, uint8)> &write,
unsigned base = 0, unsigned length = 0
@@ -67,6 +71,13 @@ struct Bus {
void map_reset();
void map_xml();
+ void clearDebugFlags();
+ void debugFlags(uint8 setf, uint8 clrf);
+ void debugFlags(uint8 setf, uint8 clrf, uint8 clazz, uint32 offset);
+ unsigned enumerateMirrors(uint8 clazz, uint32 offset, unsigned start);
+ function<void (uint8, unsigned, unsigned, uint8, bool)> debug_read;
+ function<void (uint8, unsigned, unsigned, uint8)> debug_write;
+
Bus();
~Bus();
};
diff --git a/snes/ppu/ppu.cpp b/snes/ppu/ppu.cpp
index 8545175f..13e231cf 100755
--- a/snes/ppu/ppu.cpp
+++ b/snes/ppu/ppu.cpp
@@ -87,8 +87,8 @@ void PPU::enable() {
function<uint8 (unsigned)> read = { &PPU::mmio_read, (PPU*)&ppu };
function<void (unsigned, uint8)> write = { &PPU::mmio_write, (PPU*)&ppu };
- bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, read, write);
- bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, read, write);
+ bus.map(Bus::MapMode::Direct, 0x00, 0x3f, 0x2100, 0x213f, 0, read, write);
+ bus.map(Bus::MapMode::Direct, 0x80, 0xbf, 0x2100, 0x213f, 0, read, write);
}
void PPU::power() {
diff --git a/snes/smp/core/core.hpp b/snes/smp/core/core.hpp
index 1489fcef..13d69364 100755
--- a/snes/smp/core/core.hpp
+++ b/snes/smp/core/core.hpp
@@ -2,7 +2,7 @@ struct SMPcore {
virtual void op_io() = 0;
virtual uint8 op_read(uint16 addr) = 0;
virtual void op_write(uint16 addr, uint8 data) = 0;
- void op_step();
+ virtual void op_step();
#include "registers.hpp"
#include "memory.hpp"
diff --git a/snes/snes.hpp b/snes/snes.hpp
index dffeeee3..37ed1feb 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -1,5 +1,6 @@
#ifndef SNES_HPP
#define SNES_HPP
+#define BSNES_SUPPORTS_ADV_BREAKPOINTS
namespace SNES {
namespace Info {
--
2.15.0.rc1

View file

@ -0,0 +1,22 @@
From 8bc6bb381e680616dcc843c99889799aedd43163 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 30 Nov 2013 10:27:37 +0200
Subject: [PATCH 13/27] Support auto-detecting bsnes version
---
bsnes.mk | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 bsnes.mk
diff --git a/bsnes.mk b/bsnes.mk
new file mode 100644
index 00000000..20f22f61
--- /dev/null
+++ b/bsnes.mk
@@ -0,0 +1,3 @@
+BSNES_SUPPORTS_DEBUGGER=yes
+LIBSNES_DIR=ui-libsnes
+BSNES_VERSION=085
--
2.15.0.rc1

View file

@ -0,0 +1,138 @@
From 40c456dadd79cb2c94379fda8b41a4d0ba051ad1 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 7 Dec 2013 23:32:44 +0200
Subject: [PATCH 14/27] Support alternate (more accurate) poll timings
---
snes/config/config.cpp | 1 +
snes/config/config.hpp | 1 +
snes/cpu/timing/joypad.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
snes/cpu/timing/timing.cpp | 16 ++++++++++++----
snes/cpu/timing/timing.hpp | 1 +
snes/snes.hpp | 1 +
6 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/snes/config/config.cpp b/snes/config/config.cpp
index 701af94c..206daae0 100755
--- a/snes/config/config.cpp
+++ b/snes/config/config.cpp
@@ -13,6 +13,7 @@ Configuration::Configuration() {
cpu.ntsc_frequency = 21477272; //315 / 88 * 6000000
cpu.pal_frequency = 21281370;
cpu.wram_init_value = 0x55;
+ cpu.alt_poll_timings = false;
smp.ntsc_frequency = 24607104; //32040.5 * 768
smp.pal_frequency = 24607104;
diff --git a/snes/config/config.hpp b/snes/config/config.hpp
index 1f4d037c..dabde597 100755
--- a/snes/config/config.hpp
+++ b/snes/config/config.hpp
@@ -10,6 +10,7 @@ struct Configuration {
unsigned ntsc_frequency;
unsigned pal_frequency;
unsigned wram_init_value;
+ bool alt_poll_timings;
} cpu;
struct SMP {
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index 6a98de00..ae8e94f8 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -29,4 +29,44 @@ void CPU::step_auto_joypad_poll() {
}
}
+//called every 128 clocks; see CPU::add_clocks()
+void CPU::step_auto_joypad_poll_NEW(bool polarity) {
+ if(status.auto_joypad_counter > 0 && status.auto_joypad_counter <= 34) {
+ if(!status.auto_joypad_latch) {
+ //FIXME: Is this right, busy flag goes on even if not enabled???
+ if(status.auto_joypad_counter == 1)
+ status.auto_joypad_active = true;
+ if(status.auto_joypad_counter == 34)
+ status.auto_joypad_active = false;
+ } else {
+ if(status.auto_joypad_counter == 1) {
+ status.auto_joypad_active = true;
+ input.port1->latch(1);
+ input.port2->latch(1);
+ }
+ if(status.auto_joypad_counter == 3) {
+ input.port1->latch(0);
+ input.port2->latch(0);
+ }
+ if((status.auto_joypad_counter & 1) != 0 && status.auto_joypad_counter != 1) {
+ uint2 port0 = input.port1->data();
+ uint2 port1 = input.port2->data();
+
+ status.joy1 = (status.joy1 << 1) | (bool)(port0 & 1);
+ status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
+ status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
+ status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
+ }
+ if(status.auto_joypad_counter == 34)
+ status.auto_joypad_active = false;
+ }
+ status.auto_joypad_counter++;
+ }
+ if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && status.auto_joypad_counter == 0 && !polarity) {
+ status.auto_joypad_latch = status.auto_joypad_poll;
+ status.auto_joypad_counter = 1;
+ }
+}
+
+
#endif
diff --git a/snes/cpu/timing/timing.cpp b/snes/cpu/timing/timing.cpp
index f1378f0c..d7cf24f3 100755
--- a/snes/cpu/timing/timing.cpp
+++ b/snes/cpu/timing/timing.cpp
@@ -17,10 +17,18 @@ void CPU::add_clocks(unsigned clocks) {
step(clocks);
- status.auto_joypad_clock += clocks;
- if(status.auto_joypad_clock >= 256) {
- status.auto_joypad_clock -= 256;
- step_auto_joypad_poll();
+ if(config.cpu.alt_poll_timings) {
+ bool opolarity = (status.auto_joypad_clock & 128);
+ status.auto_joypad_clock = (status.auto_joypad_clock + clocks) & 0xFF;
+ bool npolarity = (status.auto_joypad_clock & 128);
+ if(opolarity != npolarity)
+ step_auto_joypad_poll_NEW(opolarity);
+ } else {
+ status.auto_joypad_clock += clocks;
+ if(status.auto_joypad_clock >= 256) {
+ status.auto_joypad_clock -= 256;
+ step_auto_joypad_poll();
+ }
}
if(status.dram_refreshed == false && hcounter() >= status.dram_refresh_position) {
diff --git a/snes/cpu/timing/timing.hpp b/snes/cpu/timing/timing.hpp
index 6c225dab..bf15a727 100755
--- a/snes/cpu/timing/timing.hpp
+++ b/snes/cpu/timing/timing.hpp
@@ -22,3 +22,4 @@ alwaysinline bool irq_test();
//joypad.cpp
void step_auto_joypad_poll();
+void step_auto_joypad_poll_NEW(bool polarity);
diff --git a/snes/snes.hpp b/snes/snes.hpp
index 37ed1feb..4e3ba64c 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -1,6 +1,7 @@
#ifndef SNES_HPP
#define SNES_HPP
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
+#define BSNES_SUPPORTS_ALT_TIMINGS
namespace SNES {
namespace Info {
--
2.15.0.rc1

View file

@ -0,0 +1,103 @@
From 863bde899b53ae31e854096ac5258208c848a293 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Thu, 6 Mar 2014 21:07:54 +0200
Subject: [PATCH 15/27] Fix mouse speed support
---
snes/config/config.cpp | 1 +
snes/config/config.hpp | 3 +++
snes/controller/mouse/mouse.cpp | 11 +++++++++--
snes/controller/mouse/mouse.hpp | 1 +
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/snes/config/config.cpp b/snes/config/config.cpp
index 206daae0..19831370 100755
--- a/snes/config/config.cpp
+++ b/snes/config/config.cpp
@@ -8,6 +8,7 @@ Configuration::Configuration() {
expansion_port = System::ExpansionPortDevice::BSX;
region = System::Region::Autodetect;
random = true;
+ mouse_speed_fix = false;
cpu.version = 2;
cpu.ntsc_frequency = 21477272; //315 / 88 * 6000000
diff --git a/snes/config/config.hpp b/snes/config/config.hpp
index dabde597..68fe0bde 100755
--- a/snes/config/config.hpp
+++ b/snes/config/config.hpp
@@ -1,9 +1,12 @@
+#define BSNES_SUPPORTS_MOUSE_SPEED_FIX
+
struct Configuration {
Input::Device controller_port1;
Input::Device controller_port2;
System::ExpansionPortDevice expansion_port;
System::Region region;
bool random;
+ bool mouse_speed_fix;
struct CPU {
unsigned version;
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
index 1a066b98..caa7a358 100755
--- a/snes/controller/mouse/mouse.cpp
+++ b/snes/controller/mouse/mouse.cpp
@@ -1,6 +1,10 @@
#ifdef CONTROLLER_CPP
uint2 Mouse::data() {
+ if(config.mouse_speed_fix && latched) {
+ speed = (speed + 1) % 3;
+ return 0;
+ }
if(counter >= 32) return 1;
if(counter == 0) {
@@ -31,8 +35,8 @@ uint2 Mouse::data() {
case 8: return interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Right);
case 9: return interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Left);
- case 10: return 0; //speed (0 = slow, 1 = normal, 2 = fast, 3 = unused)
- case 11: return 0; // ||
+ case 10: return speed >> 1; //speed (0 = slow, 1 = normal, 2 = fast, 3 = unused)
+ case 11: return speed & 1; // ||
case 12: return 0; //signature
case 13: return 0; // ||
@@ -75,10 +79,12 @@ void Mouse::serialize(serializer& s) {
block[3] = (unsigned short)_position_x;
block[4] = (unsigned short)_position_y >> 8;
block[5] = (unsigned short)_position_y;
+ block[6] = speed;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
+ speed = block[6];
_position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
_position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
}
@@ -87,6 +93,7 @@ void Mouse::serialize(serializer& s) {
Mouse::Mouse(bool port) : Controller(port) {
latched = 0;
counter = 0;
+ speed = 0;
}
#endif
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
index b07c8ab7..13a9313e 100755
--- a/snes/controller/mouse/mouse.hpp
+++ b/snes/controller/mouse/mouse.hpp
@@ -6,6 +6,7 @@ struct Mouse : Controller {
private:
bool latched;
unsigned counter;
+ unsigned speed;
int _position_x;
int _position_y;
};
--
2.15.0.rc1

View file

@ -0,0 +1,25 @@
From 60267d1f22fd2ff3197c6c829640f66304c89283 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 16 Mar 2014 16:40:55 +0200
Subject: [PATCH 16/27] Fix tracelog of controller registers
---
snes/cpu/core/disassembler/disassembler.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/snes/cpu/core/disassembler/disassembler.cpp b/snes/cpu/core/disassembler/disassembler.cpp
index ab8dde24..624a80ce 100755
--- a/snes/cpu/core/disassembler/disassembler.cpp
+++ b/snes/cpu/core/disassembler/disassembler.cpp
@@ -1,6 +1,8 @@
#ifdef CPUCORE_CPP
uint8 CPUcore::dreadb(uint32 addr) {
+ if((addr & 0x40fff8) == 0x4218)
+ return bus.read(addr, false); //Controller registers are safe to read.
if((addr & 0x40ffff) >= 0x2000 && (addr & 0x40ffff) <= 0x5fff) {
//$[00-3f|80-bf]:[2000-5fff]
//do not read MMIO registers within debugger
--
2.15.0.rc1

View file

@ -0,0 +1,105 @@
From de71f12eb59a41899a5c77d797e144e6f0919777 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 17 Mar 2014 14:22:58 +0200
Subject: [PATCH 17/27] Fix performance problem with non-bus breakpoints
---
snes/memory/memory.cpp | 35 ++++++++++++++++++++++++++---------
snes/memory/memory.hpp | 1 +
snes/snes.hpp | 1 +
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/snes/memory/memory.cpp b/snes/memory/memory.cpp
index a9a484a0..d22e3137 100755
--- a/snes/memory/memory.cpp
+++ b/snes/memory/memory.cpp
@@ -43,6 +43,7 @@ void Bus::map(
unsigned offset = 0;
for(unsigned bank = bank_lo; bank <= bank_hi; bank++) {
+ region_start.insert((bank << 16) | addr_lo);
for(unsigned addr = addr_lo; addr <= addr_hi; addr++) {
unsigned destaddr = (bank << 16) | addr;
if(mode == MapMode::Linear) destaddr = mirror(base + offset++, length);
@@ -60,6 +61,7 @@ void Bus::map_reset() {
idcount = 0;
map(MapMode::Direct, 0x00, 0xff, 0x0000, 0xffff, 0xFF, reader, writer);
+ region_start.clear();
}
void Bus::map_xml() {
@@ -70,11 +72,21 @@ void Bus::map_xml() {
unsigned Bus::enumerateMirrors(uint8 clazz, uint32 offset, unsigned start)
{
- unsigned i;
- for(i = start; i < 0x1000000; i++)
- if((classmap[i] == clazz && target[i] == offset) || (i == offset && clazz == 255))
- return i;
- return i;
+ if(clazz == 255) {
+ if(start > offset)
+ return 0x1000000;
+ else
+ return start;
+ }
+ //Given region can not contain the same address twice.
+ for(std::set<uint32>::iterator i = region_start.lower_bound(start); i != region_start.end(); i++) {
+ if(classmap[*i] != clazz) continue;
+ if(target[*i] > offset) continue;
+ uint32 wouldbe = offset - target[*i] + *i;
+ if(wouldbe > 0xFFFFFF) continue;
+ if(classmap[wouldbe] == clazz && target[wouldbe] == offset) return wouldbe;
+ }
+ return 0x1000000;
}
void Bus::clearDebugFlags()
@@ -94,10 +106,15 @@ void Bus::debugFlags(uint8 setf, uint8 clrf, uint8 clazz, uint32 offset)
setf <<= 3;
clrf <<= 3;
debugflags[offset] = (debugflags[offset] | setf) & ~clrf;
- } else
- for(unsigned i = 0; i < 0x1000000; i++)
- if(classmap[i] == clazz && target[i] == offset)
- debugflags[i] = (debugflags[i] | setf) & ~clrf;
+ } else {
+ uint32 i = 0;
+ while(true) {
+ i = enumerateMirrors(clazz, offset, i);
+ if(i >= 0x1000000) break;
+ debugflags[i] = (debugflags[i] | setf) & ~clrf;
+ i++;
+ }
+ }
}
Bus::Bus() {
diff --git a/snes/memory/memory.hpp b/snes/memory/memory.hpp
index c20e14db..ee0c0a9e 100755
--- a/snes/memory/memory.hpp
+++ b/snes/memory/memory.hpp
@@ -52,6 +52,7 @@ struct Bus {
uint8 *debugflags;
uint8 u_debugflags;
uint32 *target;
+ std::set<uint32> region_start;
unsigned idcount;
function<uint8 (unsigned)> reader[256];
diff --git a/snes/snes.hpp b/snes/snes.hpp
index 4e3ba64c..9589db9b 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -38,6 +38,7 @@ namespace SNES {
#include <nall/varint.hpp>
#include <nall/vector.hpp>
#include <nall/gameboy/cartridge.hpp>
+#include <set>
using namespace nall;
#include <gameboy/gameboy.hpp>
--
2.15.0.rc1

View file

@ -0,0 +1,537 @@
From 6bd069191d29ad70d38c82d59dd72cd0996fc45c Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 31 Mar 2014 20:17:46 +0300
Subject: [PATCH 18/27] Support VRAM, OAM, CGRAM and APURAM breakpoints
---
snes/alt/ppu-compatibility/memory/memory.cpp | 44 +++++++++++++++++++++--
snes/alt/ppu-compatibility/ppu.hpp | 6 ++++
snes/cartridge/cartridge.hpp | 4 +++
snes/smp/core/core.hpp | 2 +-
snes/smp/core/memory.hpp | 6 ++--
snes/smp/core/opcodes.cpp | 36 +++++++++----------
snes/smp/debugger/debugger.cpp | 4 +--
snes/smp/debugger/debugger.hpp | 2 +-
snes/smp/memory/memory.cpp | 54 +++++++++++++++++++---------
snes/smp/memory/memory.hpp | 4 +--
snes/smp/smp.hpp | 4 +++
snes/snes.hpp | 1 +
12 files changed, 122 insertions(+), 45 deletions(-)
diff --git a/snes/alt/ppu-compatibility/memory/memory.cpp b/snes/alt/ppu-compatibility/memory/memory.cpp
index 3f120d84..e47cf201 100755
--- a/snes/alt/ppu-compatibility/memory/memory.cpp
+++ b/snes/alt/ppu-compatibility/memory/memory.cpp
@@ -47,20 +47,31 @@ uint8 PPU::vram_mmio_read(uint16 addr) {
data = vram[addr];
}
}
-
+ if(__builtin_expect(vram_debugflags[addr] & 0x1, 0)) {
+ debug_read(13, addr, data);
+ }
return data;
}
void PPU::vram_mmio_write(uint16 addr, uint8 data) {
if(regs.display_disabled == true) {
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
+ debug_write(13, addr, data);
+ }
vram[addr] = data;
} else {
uint16 v = cpu.vcounter();
uint16 h = cpu.hcounter();
if(v == 0) {
if(h <= 4) {
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
+ debug_write(13, addr, data);
+ }
vram[addr] = data;
} else if(h == 6) {
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
+ debug_write(13, addr, cpu.regs.mdr);
+ }
vram[addr] = cpu.regs.mdr;
} else {
//no write
@@ -71,9 +82,15 @@ void PPU::vram_mmio_write(uint16 addr, uint8 data) {
if(h <= 4) {
//no write
} else {
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
+ debug_write(13, addr, data);
+ }
vram[addr] = data;
}
} else {
+ if(__builtin_expect(vram_debugflags[addr] & 0x2, 0)) {
+ debug_write(13, addr, data);
+ }
vram[addr] = data;
}
}
@@ -93,7 +110,9 @@ uint8 PPU::oam_mmio_read(uint16 addr) {
data = oam[addr];
}
}
-
+ if(__builtin_expect(oam_debugflags[addr] & 0x1, 0)) {
+ debug_read(14, addr, data);
+ }
return data;
}
@@ -104,13 +123,22 @@ void PPU::oam_mmio_write(uint16 addr, uint8 data) {
sprite_list_valid = false;
if(regs.display_disabled == true) {
+ if(__builtin_expect(oam_debugflags[addr] & 0x2, 0)) {
+ debug_write(14, addr, data);
+ }
oam[addr] = data;
update_sprite_list(addr, data);
} else {
if(cpu.vcounter() < (!overscan() ? 225 : 240)) {
+ if(__builtin_expect(oam_debugflags[regs.ioamaddr] & 0x2, 0)) {
+ debug_write(14, regs.ioamaddr, data);
+ }
oam[regs.ioamaddr] = data;
update_sprite_list(regs.ioamaddr, data);
} else {
+ if(__builtin_expect(oam_debugflags[addr] & 0x2, 0)) {
+ debug_write(14, addr, data);
+ }
oam[addr] = data;
update_sprite_list(addr, data);
}
@@ -134,6 +162,9 @@ uint8 PPU::cgram_mmio_read(uint16 addr) {
}
if(addr & 1) data &= 0x7f;
+ if(__builtin_expect(cgram_debugflags[addr] & 0x1, 0)) {
+ debug_read(15, addr, data);
+ }
return data;
}
@@ -142,13 +173,22 @@ void PPU::cgram_mmio_write(uint16 addr, uint8 data) {
if(addr & 1) data &= 0x7f;
if(1 || regs.display_disabled == true) {
+ if(__builtin_expect(cgram_debugflags[addr] & 0x2, 0)) {
+ debug_write(15, addr, data);
+ }
cgram[addr] = data;
} else {
uint16 v = cpu.vcounter();
uint16 h = cpu.hcounter();
if(v < (!overscan() ? 225 : 240) && h >= 128 && h < 1096) {
+ if(__builtin_expect(cgram_debugflags[regs.icgramaddr] & 0x2, 0)) {
+ debug_write(15, regs.icgramaddr, data & 0x7f);
+ }
cgram[regs.icgramaddr] = data & 0x7f;
} else {
+ if(__builtin_expect(cgram_debugflags[addr] & 0x2, 0)) {
+ debug_write(15, addr, data);
+ }
cgram[addr] = data;
}
}
diff --git a/snes/alt/ppu-compatibility/ppu.hpp b/snes/alt/ppu-compatibility/ppu.hpp
index cccaabba..4adac4c4 100755
--- a/snes/alt/ppu-compatibility/ppu.hpp
+++ b/snes/alt/ppu-compatibility/ppu.hpp
@@ -3,6 +3,12 @@ public:
uint8 vram[128 * 1024];
uint8 oam[544];
uint8 cgram[512];
+ //4 is read, 2 is write.
+ uint8 vram_debugflags[128 * 1024];
+ uint8 oam_debugflags[544];
+ uint8 cgram_debugflags[512];
+ function<void (uint8, unsigned, uint8)> debug_read;
+ function<void (uint8, unsigned, uint8)> debug_write;
enum : bool { Threaded = true };
alwaysinline void step(unsigned clocks);
diff --git a/snes/cartridge/cartridge.hpp b/snes/cartridge/cartridge.hpp
index 82e73c4c..2358c088 100755
--- a/snes/cartridge/cartridge.hpp
+++ b/snes/cartridge/cartridge.hpp
@@ -26,6 +26,10 @@ struct Cartridge : property<Cartridge> {
SUFAMITURBO_RAMA = 10,
SUFAMITURBO_RAMB = 11,
BSXFLASH = 12,
+ VRAM = 13,
+ OAM = 14,
+ CGRAM = 15,
+ APURAM = 16,
};
enum class Slot : unsigned {
diff --git a/snes/smp/core/core.hpp b/snes/smp/core/core.hpp
index 13d69364..03f9ac66 100755
--- a/snes/smp/core/core.hpp
+++ b/snes/smp/core/core.hpp
@@ -1,6 +1,6 @@
struct SMPcore {
virtual void op_io() = 0;
- virtual uint8 op_read(uint16 addr) = 0;
+ virtual uint8 op_read(uint16 addr, bool exec) = 0;
virtual void op_write(uint16 addr, uint8 data) = 0;
virtual void op_step();
diff --git a/snes/smp/core/memory.hpp b/snes/smp/core/memory.hpp
index c4b6d99f..c297962f 100755
--- a/snes/smp/core/memory.hpp
+++ b/snes/smp/core/memory.hpp
@@ -1,9 +1,9 @@
alwaysinline uint8 op_readpc() {
- return op_read(regs.pc++);
+ return op_read(regs.pc++, true);
}
alwaysinline uint8 op_readsp() {
- return op_read(0x0100 | ++regs.s);
+ return op_read(0x0100 | ++regs.s, false);
}
alwaysinline void op_writesp(uint8 data) {
@@ -11,7 +11,7 @@ alwaysinline void op_writesp(uint8 data) {
}
alwaysinline uint8 op_readdp(uint8 addr) {
- return op_read((regs.p.p << 8) + addr);
+ return op_read((regs.p.p << 8) + addr, false);
}
alwaysinline void op_writedp(uint8 addr, uint8 data) {
diff --git a/snes/smp/core/opcodes.cpp b/snes/smp/core/opcodes.cpp
index 95b9844f..43db081d 100755
--- a/snes/smp/core/opcodes.cpp
+++ b/snes/smp/core/opcodes.cpp
@@ -11,7 +11,7 @@ template<uint8 (SMPcore::*op)(uint8)>
void SMPcore::op_adjust_addr() {
dp.l = op_readpc();
dp.h = op_readpc();
- rd = op_read(dp);
+ rd = op_read(dp, false);
rd = call(rd);
op_write(dp, rd);
}
@@ -78,7 +78,7 @@ template<uint8 (SMPcore::*op)(uint8, uint8)>
void SMPcore::op_read_addr(uint8 &r) {
dp.l = op_readpc();
dp.h = op_readpc();
- rd = op_read(dp);
+ rd = op_read(dp, false);
r = call(r, rd);
}
@@ -87,7 +87,7 @@ void SMPcore::op_read_addri(uint8 &r) {
dp.l = op_readpc();
dp.h = op_readpc();
op_io();
- rd = op_read(dp + r);
+ rd = op_read(dp + r, false);
regs.a = call(regs.a, rd);
}
@@ -127,7 +127,7 @@ void SMPcore::op_read_idpx() {
op_io();
sp.l = op_readdp(dp++);
sp.h = op_readdp(dp++);
- rd = op_read(sp);
+ rd = op_read(sp, false);
regs.a = call(regs.a, rd);
}
@@ -137,7 +137,7 @@ void SMPcore::op_read_idpy() {
op_io();
sp.l = op_readdp(dp++);
sp.h = op_readdp(dp++);
- rd = op_read(sp + regs.y);
+ rd = op_read(sp + regs.y, false);
regs.a = call(regs.a, rd);
}
@@ -153,7 +153,7 @@ void SMPcore::op_set_addr_bit() {
dp.h = op_readpc();
bit = dp >> 13;
dp &= 0x1fff;
- rd = op_read(dp);
+ rd = op_read(dp, false);
switch(opcode >> 5) {
case 0: //orc addr:bit
case 1: //orc !addr:bit
@@ -198,10 +198,10 @@ void SMPcore::op_set_flag(bool &flag, bool data) {
void SMPcore::op_test_addr(bool set) {
dp.l = op_readpc();
dp.h = op_readpc();
- rd = op_read(dp);
+ rd = op_read(dp, false);
regs.p.n = (regs.a - rd) & 0x80;
regs.p.z = (regs.a - rd) == 0;
- op_read(dp);
+ op_read(dp, false);
op_write(dp, set ? rd | regs.a : rd & ~regs.a);
}
@@ -216,7 +216,7 @@ void SMPcore::op_transfer(uint8 &from, uint8 &to) {
void SMPcore::op_write_addr(uint8 &r) {
dp.l = op_readpc();
dp.h = op_readpc();
- op_read(dp);
+ op_read(dp, false);
op_write(dp, r);
}
@@ -225,7 +225,7 @@ void SMPcore::op_write_addri(uint8 &i) {
dp.h = op_readpc();
op_io();
dp += i;
- op_read(dp);
+ op_read(dp, false);
op_write(dp, regs.a);
}
@@ -317,8 +317,8 @@ void SMPcore::op_bne_ydec() {
}
void SMPcore::op_brk() {
- rd.l = op_read(0xffde);
- rd.h = op_read(0xffdf);
+ rd.l = op_read(0xffde, false);
+ rd.h = op_read(0xffdf, false);
op_io();
op_io();
op_writesp(regs.pc.h);
@@ -411,8 +411,8 @@ void SMPcore::op_jmp_iaddrx() {
dp.h = op_readpc();
op_io();
dp += regs.x;
- rd.l = op_read(dp++);
- rd.h = op_read(dp++);
+ rd.l = op_read(dp++, false);
+ rd.h = op_read(dp++, false);
regs.pc = rd;
}
@@ -438,8 +438,8 @@ void SMPcore::op_jsr_addr() {
void SMPcore::op_jst() {
dp = 0xffde - ((opcode >> 4) << 1);
- rd.l = op_read(dp++);
- rd.h = op_read(dp++);
+ rd.l = op_read(dp++, false);
+ rd.h = op_read(dp++, false);
op_io();
op_io();
op_io();
@@ -505,7 +505,7 @@ void SMPcore::op_sta_idpx() {
op_io();
dp.l = op_readdp(sp++);
dp.h = op_readdp(sp++);
- op_read(dp);
+ op_read(dp, false);
op_write(dp, regs.a);
}
@@ -515,7 +515,7 @@ void SMPcore::op_sta_idpy() {
dp.h = op_readdp(sp++);
op_io();
dp += regs.y;
- op_read(dp);
+ op_read(dp, false);
op_write(dp, regs.a);
}
diff --git a/snes/smp/debugger/debugger.cpp b/snes/smp/debugger/debugger.cpp
index 9546c118..894fdac9 100755
--- a/snes/smp/debugger/debugger.cpp
+++ b/snes/smp/debugger/debugger.cpp
@@ -18,8 +18,8 @@ void SMPDebugger::op_step() {
synchronize_cpu();
}
-uint8 SMPDebugger::op_read(uint16 addr) {
- uint8 data = SMP::op_read(addr);
+uint8 SMPDebugger::op_read(uint16 addr, bool exec) {
+ uint8 data = SMP::op_read(addr, exec);
usage[addr] |= UsageRead;
debugger.breakpoint_test(Debugger::Breakpoint::Source::APURAM, Debugger::Breakpoint::Mode::Read, addr, data);
return data;
diff --git a/snes/smp/debugger/debugger.hpp b/snes/smp/debugger/debugger.hpp
index d5d28e53..26bc7af9 100755
--- a/snes/smp/debugger/debugger.hpp
+++ b/snes/smp/debugger/debugger.hpp
@@ -14,7 +14,7 @@ public:
bool opcode_edge;
void op_step();
- uint8 op_read(uint16 addr);
+ uint8 op_read(uint16 addr, bool exec);
void op_write(uint16 addr, uint8 data);
SMPDebugger();
diff --git a/snes/smp/memory/memory.cpp b/snes/smp/memory/memory.cpp
index 391324c4..58c11915 100755
--- a/snes/smp/memory/memory.cpp
+++ b/snes/smp/memory/memory.cpp
@@ -19,61 +19,83 @@ void SMP::port_write(uint2 port, uint8 data) {
apuram[0xf4 + port] = data;
}
-alwaysinline uint8 SMP::op_busread(uint16 addr) {
+alwaysinline uint8 SMP::op_busread(uint16 addr, bool exec) {
unsigned result;
+ uint8 data;
switch(addr) {
case 0xf0: //TEST -- write-only register
- return 0x00;
+ data = 0x00;
+ break;
case 0xf1: //CONTROL -- write-only register
- return 0x00;
+ data = 0x00;
+ break;
case 0xf2: //DSPADDR
- return status.dsp_addr;
+ data = status.dsp_addr;
+ break;
case 0xf3: //DSPDATA
//0x80-0xff are read-only mirrors of 0x00-0x7f
- return dsp.read(status.dsp_addr & 0x7f);
+ data = dsp.read(status.dsp_addr & 0x7f);
+ break;
case 0xf4: //CPUIO0
case 0xf5: //CPUIO1
case 0xf6: //CPUIO2
case 0xf7: //CPUIO3
synchronize_cpu();
- return cpu.port_read(addr);
+ data = cpu.port_read(addr);
+ break;
case 0xf8: //RAM0
- return status.ram00f8;
+ data = status.ram00f8;
+ break;
case 0xf9: //RAM1
- return status.ram00f9;
+ data = status.ram00f9;
+ break;
case 0xfa: //T0TARGET
case 0xfb: //T1TARGET
case 0xfc: //T2TARGET -- write-only registers
- return 0x00;
+ data = 0x00;
+ break;
case 0xfd: //T0OUT -- 4-bit counter value
result = timer0.stage3_ticks;
timer0.stage3_ticks = 0;
- return result;
+ data = result;
+ break;
case 0xfe: //T1OUT -- 4-bit counter value
result = timer1.stage3_ticks;
timer1.stage3_ticks = 0;
- return result;
+ data = result;
+ break;
case 0xff: //T2OUT -- 4-bit counter value
result = timer2.stage3_ticks;
timer2.stage3_ticks = 0;
- return result;
+ data = result;
+ break;
+ default:
+ data = ram_read(addr);
+ break;
}
-
- return ram_read(addr);
+ uint8 flag = exec ? 0x04 : 0x01;
+ if(__builtin_expect(debugflags[addr] & flag, 0)) {
+ debug_read(16, addr, data, exec);
+ }
+ return data;
}
alwaysinline void SMP::op_buswrite(uint16 addr, uint8 data) {
+ if(__builtin_expect(debugflags[addr] & 0x2, 0)) {
+ debug_write(16, addr, data);
+ }
+
switch(addr) {
case 0xf0: //TEST
if(regs.p.p) break; //writes only valid when P flag is clear
@@ -180,9 +202,9 @@ void SMP::op_io() {
cycle_edge();
}
-uint8 SMP::op_read(uint16 addr) {
+uint8 SMP::op_read(uint16 addr, bool exec) {
add_clocks(12);
- uint8 r = op_busread(addr);
+ uint8 r = op_busread(addr, exec);
add_clocks(12);
cycle_edge();
return r;
diff --git a/snes/smp/memory/memory.hpp b/snes/smp/memory/memory.hpp
index 1a07445d..faa28daa 100755
--- a/snes/smp/memory/memory.hpp
+++ b/snes/smp/memory/memory.hpp
@@ -1,9 +1,9 @@
uint8 ram_read(uint16 addr);
void ram_write(uint16 addr, uint8 data);
-uint8 op_busread(uint16 addr);
+uint8 op_busread(uint16 addr, bool exec);
void op_buswrite(uint16 addr, uint8 data);
void op_io();
-debugvirtual uint8 op_read(uint16 addr);
+debugvirtual uint8 op_read(uint16 addr, bool exec);
debugvirtual void op_write(uint16 addr, uint8 data);
diff --git a/snes/smp/smp.hpp b/snes/smp/smp.hpp
index 6b387cba..6b6ae837 100755
--- a/snes/smp/smp.hpp
+++ b/snes/smp/smp.hpp
@@ -1,6 +1,10 @@
struct SMP : public Processor, public SMPcore {
static const uint8 iplrom[64];
uint8 apuram[64 * 1024];
+ uint8 debugflags[64 * 1024];
+
+ function<void (uint8, unsigned, uint8, bool)> debug_read;
+ function<void (uint8, unsigned, uint8)> debug_write;
enum : bool { Threaded = true };
alwaysinline void step(unsigned clocks);
diff --git a/snes/snes.hpp b/snes/snes.hpp
index 9589db9b..27632bff 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -1,6 +1,7 @@
#ifndef SNES_HPP
#define SNES_HPP
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
+#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
#define BSNES_SUPPORTS_ALT_TIMINGS
namespace SNES {
--
2.15.0.rc1

View file

@ -0,0 +1,53 @@
From f1106d3dffd27dab526a703aa434512495fbacea Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 14 Apr 2014 21:21:36 +0300
Subject: [PATCH 19/27] SA1 trace hook support
---
snes/chip/sa1/sa1.cpp | 2 ++
snes/chip/sa1/sa1.hpp | 3 +++
snes/snes.hpp | 1 +
3 files changed, 6 insertions(+)
diff --git a/snes/chip/sa1/sa1.cpp b/snes/chip/sa1/sa1.cpp
index 30e00809..fdec362c 100755
--- a/snes/chip/sa1/sa1.cpp
+++ b/snes/chip/sa1/sa1.cpp
@@ -32,6 +32,8 @@ void SA1::enter() {
continue;
}
+ if(__builtin_expect(trace_enabled ? 1 : 0, 0))
+ step_event();
(this->*opcode_table[op_readpc()])();
}
}
diff --git a/snes/chip/sa1/sa1.hpp b/snes/chip/sa1/sa1.hpp
index 732b2a85..efd36376 100755
--- a/snes/chip/sa1/sa1.hpp
+++ b/snes/chip/sa1/sa1.hpp
@@ -15,6 +15,9 @@ public:
uint16 hcounter;
} status;
+ bool trace_enabled;
+ nall::function<void()> step_event;
+
static void Enter();
void enter();
void tick();
diff --git a/snes/snes.hpp b/snes/snes.hpp
index 27632bff..3bdca7e5 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -3,6 +3,7 @@
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
#define BSNES_SUPPORTS_ALT_TIMINGS
+#define BSNES_SUPPORTS_TRACE_SA1
namespace SNES {
namespace Info {
--
2.15.0.rc1

View file

@ -0,0 +1,78 @@
From cf662a12578778cb50c25d5275ce58deabd7eabe Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 30 Apr 2014 00:18:58 +0300
Subject: [PATCH 20/27] Fixes to SA1 open bus emulation
---
snes/chip/sa1/memory/memory.cpp | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/snes/chip/sa1/memory/memory.cpp b/snes/chip/sa1/memory/memory.cpp
index 9bb4ff20..614dfb0c 100755
--- a/snes/chip/sa1/memory/memory.cpp
+++ b/snes/chip/sa1/memory/memory.cpp
@@ -36,6 +36,7 @@ uint8 SA1::bus_read(unsigned addr) {
synchronize_cpu();
return bitmap_read(addr & 0x0fffff);
}
+ return regs.mdr;
}
void SA1::bus_write(unsigned addr, uint8 data) {
@@ -73,29 +74,31 @@ void SA1::bus_write(unsigned addr, uint8 data) {
//to avoid syncing the S-CPU and SA-1*; as both chips are able to access
//these ports.
uint8 SA1::vbr_read(unsigned addr) {
+ //Let's share the bus state with main SA1 bus (is this correct?)
if((addr & 0x408000) == 0x008000) { //$00-3f|80-bf:8000-ffff
- return mmc_read(addr);
+ return regs.mdr = mmc_read(addr);
}
if((addr & 0xc00000) == 0xc00000) { //$c0-ff:0000-ffff
- return mmc_read(addr);
+ return regs.mdr = mmc_read(addr);
}
if((addr & 0x40e000) == 0x006000) { //$00-3f|80-bf:6000-7fff
- return cartridge.ram.read(addr & (cartridge.ram.size() - 1));
+ return regs.mdr = cartridge.ram.read(addr & (cartridge.ram.size() - 1));
}
if((addr & 0xf00000) == 0x400000) { //$40-4f:0000-ffff
- return cartridge.ram.read(addr & (cartridge.ram.size() - 1));
+ return regs.mdr = cartridge.ram.read(addr & (cartridge.ram.size() - 1));
}
if((addr & 0x40f800) == 0x000000) { //$00-3f|80-bf:0000-07ff
- return iram.read(addr & 2047);
+ return regs.mdr = iram.read(addr & 2047);
}
if((addr & 0x40f800) == 0x003000) { //$00-3f|80-bf:3000-37ff
- return iram.read(addr & 0x2047);
+ return regs.mdr = iram.read(addr & 0x2047);
}
+ return regs.mdr;
}
//ROM, I-RAM and MMIO registers are accessed at ~10.74MHz (2 clock ticks)
@@ -110,13 +113,13 @@ void SA1::op_io() {
uint8 SA1::op_read(unsigned addr, bool exec) {
tick();
if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick();
- return bus_read(addr);
+ return regs.mdr = bus_read(addr);
}
void SA1::op_write(unsigned addr, uint8 data) {
tick();
if(((addr & 0x40e000) == 0x006000) || ((addr & 0xd00000) == 0x400000)) tick();
- bus_write(addr, data);
+ bus_write(addr, regs.mdr = data);
}
uint8 SA1::mmc_read(unsigned addr) {
--
2.15.0.rc1

View file

@ -0,0 +1,25 @@
From 63fc77b07d517c2f9a0fd6ca3fa94f30fb0f5ec2 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 15 Jun 2014 22:01:26 +0300
Subject: [PATCH 21/27] Call notify latch function on alternate timings mode
too
---
snes/cpu/timing/joypad.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index ae8e94f8..3fd4d23e 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -41,6 +41,7 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
} else {
if(status.auto_joypad_counter == 1) {
status.auto_joypad_active = true;
+ interface->notifyLatched();
input.port1->latch(1);
input.port2->latch(1);
}
--
2.15.0.rc1

View file

@ -0,0 +1,288 @@
From 5bc96b8aeea26729ef4399c2d8d5e562894616e1 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Tue, 20 Jan 2015 10:04:58 +0200
Subject: [PATCH 22/27] Support DMA tracing
---
snes/alt/ppu-compatibility/mmio/mmio.cpp | 18 +++++++
snes/alt/ppu-compatibility/ppu.cpp | 1 +
snes/alt/ppu-compatibility/ppu.hpp | 4 ++
snes/cpu/cpu.cpp | 1 +
snes/cpu/cpu.hpp | 1 +
snes/cpu/dma/dma.cpp | 84 ++++++++++++++++++++++++++++++++
snes/cpu/dma/dma.hpp | 5 ++
snes/ppu/mmio/mmio.cpp | 18 +++++++
snes/ppu/ppu.cpp | 1 +
snes/ppu/ppu.hpp | 3 ++
snes/snes.hpp | 1 +
11 files changed, 137 insertions(+)
diff --git a/snes/alt/ppu-compatibility/mmio/mmio.cpp b/snes/alt/ppu-compatibility/mmio/mmio.cpp
index aedb67c1..0a269cc0 100755
--- a/snes/alt/ppu-compatibility/mmio/mmio.cpp
+++ b/snes/alt/ppu-compatibility/mmio/mmio.cpp
@@ -1,5 +1,23 @@
#ifdef PPU_CPP
+size_t PPU::get_dma_oam_subaddr(char* buf)
+{
+ return sprintf(buf, "[%03x]", regs.oam_addr);
+}
+
+size_t PPU::get_dma_cgram_subaddr(char* buf)
+{
+ return sprintf(buf, "[%02x%c]", regs.cgram_addr >> 1, (regs.cgram_addr & 1) ?
+ 'H' : 'L');
+}
+
+size_t PPU::get_dma_vram_subaddr(char* buf)
+{
+ return sprintf(buf, "[%04x map%d inc %d on %s]", regs.vram_addr << 1,
+ regs.vram_mapping, 2 * regs.vram_incsize, regs.vram_incmode ? "high" :
+ "low");
+}
+
//INIDISP
void PPU::mmio_w2100(uint8 value) {
if(regs.display_disabled == true && cpu.vcounter() == (!overscan() ? 225 : 240)) {
diff --git a/snes/alt/ppu-compatibility/ppu.cpp b/snes/alt/ppu-compatibility/ppu.cpp
index 122b1430..ac886edc 100755
--- a/snes/alt/ppu-compatibility/ppu.cpp
+++ b/snes/alt/ppu-compatibility/ppu.cpp
@@ -1,4 +1,5 @@
#include <snes/snes.hpp>
+#include <cstdio>
#define PPU_CPP
namespace SNES {
diff --git a/snes/alt/ppu-compatibility/ppu.hpp b/snes/alt/ppu-compatibility/ppu.hpp
index 4adac4c4..b0eabf7c 100755
--- a/snes/alt/ppu-compatibility/ppu.hpp
+++ b/snes/alt/ppu-compatibility/ppu.hpp
@@ -14,6 +14,10 @@ public:
alwaysinline void step(unsigned clocks);
alwaysinline void synchronize_cpu();
+ size_t get_dma_oam_subaddr(char* buf);
+ size_t get_dma_cgram_subaddr(char* buf);
+ size_t get_dma_vram_subaddr(char* buf);
+
#include "memory/memory.hpp"
#include "mmio/mmio.hpp"
#include "render/render.hpp"
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
index 39da6b16..ce112afa 100755
--- a/snes/cpu/cpu.cpp
+++ b/snes/cpu/cpu.cpp
@@ -1,4 +1,5 @@
#include <snes/snes.hpp>
+#include <cstdio>
#define CPU_CPP
namespace SNES {
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
index 49445773..fd665b1f 100755
--- a/snes/cpu/cpu.hpp
+++ b/snes/cpu/cpu.hpp
@@ -26,6 +26,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
~CPU();
bool controller_flag;
+ function<void(const char*)> dma_trace_fn;
private:
#include "dma/dma.hpp"
#include "memory/memory.hpp"
diff --git a/snes/cpu/dma/dma.cpp b/snes/cpu/dma/dma.cpp
index 0a00bfea..8f7be263 100755
--- a/snes/cpu/dma/dma.cpp
+++ b/snes/cpu/dma/dma.cpp
@@ -144,6 +144,7 @@ void CPU::dma_run() {
for(unsigned i = 0; i < 8; i++) {
if(channel[i].dma_enabled == false) continue;
+ dma_trace_start(i);
unsigned index = 0;
do {
@@ -155,6 +156,7 @@ void CPU::dma_run() {
dma_write(false);
dma_edge();
+ dma_trace_end(i);
channel[i].dma_enabled = false;
}
@@ -202,6 +204,7 @@ void CPU::hdma_run() {
channel[i].dma_enabled = false; //HDMA run during DMA will stop DMA mid-transfer
if(channel[i].hdma_do_transfer) {
+ dma_trace_hdma(i);
static const unsigned transfer_length[8] = { 1, 2, 2, 4, 4, 4, 2, 4 };
unsigned length = transfer_length[channel[i].transfer_mode];
for(unsigned index = 0; index < length; index++) {
@@ -286,4 +289,85 @@ void CPU::dma_reset() {
pipe.data = 0;
}
+size_t CPU::dma_trace_subaddr(char* buf, uint8 b_addr)
+{
+ if(b_addr == 0x04 || b_addr == 0x38) {
+ return ppu.get_dma_oam_subaddr(buf);
+ }
+ if(b_addr == 0x22 || b_addr == 0x3B) {
+ return ppu.get_dma_cgram_subaddr(buf);
+ }
+ if(b_addr == 0x18 || b_addr == 0x19 || b_addr == 0x39 || b_addr == 0x3A) {
+ return ppu.get_dma_vram_subaddr(buf);
+ }
+ if(b_addr == 0x80) {
+ return sprintf(buf, "[%06x]", 0x7e0000 | status.wram_addr);
+ }
+ return 0;
+}
+
+void CPU::dma_trace_start(unsigned i)
+{
+ if(!dma_trace_fn) return;
+ char buf[512];
+ size_t ptr = 0;
+ unsigned bytes = channel[i].transfer_size;
+ if(!bytes) bytes = 0x10000;
+ ptr += sprintf(buf + ptr, "-- DMA%i %d(%x) bytes ", i, bytes, bytes);
+ if(channel[i].direction) {
+ //B->A
+ ptr += sprintf(buf + ptr, "%02x", channel[i].dest_addr);
+ ptr += dma_trace_subaddr(buf + ptr, channel[i].dest_addr);
+ ptr += sprintf(buf + ptr, "-> %02x%04x", channel[i].source_bank,
+ channel[i].source_addr);
+ } else {
+ //A->B
+ ptr += sprintf(buf + ptr, "%02x%04x -> %02x", channel[i].source_bank,
+ channel[i].source_addr, channel[i].dest_addr);
+ ptr += dma_trace_subaddr(buf + ptr, channel[i].dest_addr);
+ }
+ if(channel[i].fixed_transfer)
+ ptr += sprintf(buf + ptr, " fixed");
+ else if(channel[i].reverse_transfer)
+ ptr += sprintf(buf + ptr, " decrement");
+ else
+ ptr += sprintf(buf + ptr, " incrment");
+ ptr += sprintf(buf + ptr, " mode%d --", channel[i].transfer_mode);
+ dma_trace_fn(buf);
+}
+
+void CPU::dma_trace_end(unsigned i)
+{
+ if(!dma_trace_fn) return;
+ if(!channel[i].transfer_size) return; //No message for complete DMA.
+ char buf[512];
+ size_t ptr = 0;
+ sprintf(buf, "-- DMA%i aborted with %d(0x%x) bytes remaining --", i,
+ (int)channel[i].transfer_size, (unsigned)channel[i].transfer_size);
+ dma_trace_fn(buf);
+}
+
+void CPU::dma_trace_hdma(unsigned i)
+{
+ if(!dma_trace_fn) return;
+ char buf[512];
+ size_t ptr = 0;
+ unsigned addr = channel[i].indirect ?
+ (channel[i].indirect_bank << 16) | (channel[i].indirect_addr) :
+ (channel[i].source_bank << 16) | (channel[i].hdma_addr);
+ ptr += sprintf(buf + ptr, "-- HDMA%i %06x -> %02x", i, addr,
+ channel[i].dest_addr);
+ ptr += dma_trace_subaddr(buf + ptr, channel[i].dest_addr);
+ if(channel[i].indirect)
+ ptr += sprintf(buf + ptr, " indirect");
+ if(channel[i].fixed_transfer)
+ ptr += sprintf(buf + ptr, " fixed");
+ else if(channel[i].reverse_transfer)
+ ptr += sprintf(buf + ptr, " decrement");
+ else
+ ptr += sprintf(buf + ptr, " incrment");
+ ptr += sprintf(buf + ptr, " mode%d --", channel[i].transfer_mode);
+ dma_trace_fn(buf);
+}
+
#endif
diff --git a/snes/cpu/dma/dma.hpp b/snes/cpu/dma/dma.hpp
index 33755bde..8740bb3a 100755
--- a/snes/cpu/dma/dma.hpp
+++ b/snes/cpu/dma/dma.hpp
@@ -77,3 +77,8 @@ void hdma_init();
void dma_power();
void dma_reset();
+
+size_t dma_trace_subaddr(char* buf, uint8 b_addr);
+void dma_trace_start(unsigned i);
+void dma_trace_end(unsigned i);
+void dma_trace_hdma(unsigned i);
diff --git a/snes/ppu/mmio/mmio.cpp b/snes/ppu/mmio/mmio.cpp
index 302f74f8..4a4fb9ce 100755
--- a/snes/ppu/mmio/mmio.cpp
+++ b/snes/ppu/mmio/mmio.cpp
@@ -1,5 +1,23 @@
#ifdef PPU_CPP
+size_t PPU::get_dma_oam_subaddr(char* buf)
+{
+ return sprintf(buf, "[%03x]", regs.oam_addr);
+}
+
+size_t PPU::get_dma_cgram_subaddr(char* buf)
+{
+ return sprintf(buf, "[%02x%c]", regs.cgram_addr >> 1, (regs.cgram_addr & 1) ?
+ 'H' : 'L');
+}
+
+size_t PPU::get_dma_vram_subaddr(char* buf)
+{
+ return sprintf(buf, "[%04x map%d inc %d on %s]", regs.vram_addr << 1,
+ regs.vram_mapping, 2 * regs.vram_incsize, regs.vram_incmode ? "high" :
+ "low");
+}
+
bool PPU::interlace() const {
return display.interlace;
}
diff --git a/snes/ppu/ppu.cpp b/snes/ppu/ppu.cpp
index 13e231cf..58742098 100755
--- a/snes/ppu/ppu.cpp
+++ b/snes/ppu/ppu.cpp
@@ -1,4 +1,5 @@
#include <snes/snes.hpp>
+#include <cstdio>
#define PPU_CPP
namespace SNES {
diff --git a/snes/ppu/ppu.hpp b/snes/ppu/ppu.hpp
index fdba113c..0addb775 100755
--- a/snes/ppu/ppu.hpp
+++ b/snes/ppu/ppu.hpp
@@ -21,6 +21,9 @@ struct PPU : public Processor, public PPUcounter {
PPU();
~PPU();
+ size_t get_dma_oam_subaddr(char* buf);
+ size_t get_dma_cgram_subaddr(char* buf);
+ size_t get_dma_vram_subaddr(char* buf);
private:
uint32 *surface;
uint32 *output;
diff --git a/snes/snes.hpp b/snes/snes.hpp
index 3bdca7e5..7c48ebb3 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -4,6 +4,7 @@
#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
#define BSNES_SUPPORTS_ALT_TIMINGS
#define BSNES_SUPPORTS_TRACE_SA1
+#define BSNES_SUPPORTS_DMA_TRACE
namespace SNES {
namespace Info {
--
2.15.0.rc1

View file

@ -0,0 +1,86 @@
From 9682df9e33c366dfe047a99c8bcefc2c8ab29620 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 24 Jan 2015 16:46:18 +0200
Subject: [PATCH 23/27] Add autopoller and IRQ/NMI tracing
---
snes/cpu/cpu.cpp | 3 +++
snes/cpu/timing/joypad.cpp | 16 ++++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
index ce112afa..e11fc882 100755
--- a/snes/cpu/cpu.cpp
+++ b/snes/cpu/cpu.cpp
@@ -69,14 +69,17 @@ void CPU::enter() {
if(status.interrupt_pending) {
status.interrupt_pending = false;
if(status.nmi_pending) {
+ if(dma_trace_fn) dma_trace_fn("-- NMI occured --");
status.nmi_pending = false;
regs.vector = (regs.e == false ? 0xffea : 0xfffa);
op_irq();
} else if(status.irq_pending) {
+ if(dma_trace_fn) dma_trace_fn("-- IRQ occured --");
status.irq_pending = false;
regs.vector = (regs.e == false ? 0xffee : 0xfffe);
op_irq();
} else if(status.reset_pending) {
+ if(dma_trace_fn) dma_trace_fn("-- RESET occured --");
status.reset_pending = false;
add_clocks(186);
regs.pc.l = bus.read(0xfffc, false);
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index 3fd4d23e..afca7504 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -6,9 +6,9 @@ void CPU::step_auto_joypad_poll() {
//cache enable state at first iteration
if(status.auto_joypad_counter == 0) status.auto_joypad_latch = status.auto_joypad_poll;
status.auto_joypad_active = status.auto_joypad_counter <= 15;
-
if(status.auto_joypad_active && status.auto_joypad_latch) {
if(status.auto_joypad_counter == 0) {
+ if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
interface->notifyLatched();
input.port1->latch(1);
input.port2->latch(1);
@@ -23,6 +23,12 @@ void CPU::step_auto_joypad_poll() {
status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
+ if(status.auto_joypad_counter == 15) {
+ char buf[512];
+ sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
+ status.joy1, status.joy2, status.joy3, status.joy4);
+ if(dma_trace_fn) dma_trace_fn(buf);
+ }
}
status.auto_joypad_counter++;
@@ -40,6 +46,7 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
status.auto_joypad_active = false;
} else {
if(status.auto_joypad_counter == 1) {
+ if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
status.auto_joypad_active = true;
interface->notifyLatched();
input.port1->latch(1);
@@ -58,8 +65,13 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
}
- if(status.auto_joypad_counter == 34)
+ if(status.auto_joypad_counter == 34) {
status.auto_joypad_active = false;
+ char buf[512];
+ sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
+ status.joy1, status.joy2, status.joy3, status.joy4);
+ if(dma_trace_fn) dma_trace_fn(buf);
+ }
}
status.auto_joypad_counter++;
}
--
2.15.0.rc1

View file

@ -0,0 +1,50 @@
From f2bbef8a4e12e05190a68dfe410cff3e4b1eb13f Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 8 Aug 2015 11:09:41 +0300
Subject: [PATCH 24/27] Build fixes for GCC 5.X
---
nall/bit.hpp | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/nall/bit.hpp b/nall/bit.hpp
index 67a35ad6..11d9d8de 100755
--- a/nall/bit.hpp
+++ b/nall/bit.hpp
@@ -8,18 +8,27 @@ namespace nall {
}
template<int bits> constexpr inline unsigned uclip(const unsigned x) {
- enum { m = (1U << (bits - 1)) + ((1U << (bits - 1)) - 1) };
- return (x & m);
+ return x & ((1U << (bits - 1)) + ((1U << (bits - 1)) - 1));
+ }
+
+ template<int bits> constexpr inline signed sclamp_b() {
+ return 1U << (bits - 1);
+ }
+
+ template<int bits> constexpr inline signed sclamp_m() {
+ return (1U << (bits - 1)) - 1;
}
template<int bits> constexpr inline signed sclamp(const signed x) {
- enum { b = 1U << (bits - 1), m = (1U << (bits - 1)) - 1 };
- return (x > m) ? m : (x < -b) ? -b : x;
+ return (x > sclamp_m<bits>()) ? sclamp_m<bits>() : (x < -sclamp_b<bits>()) ? -sclamp_b<bits>() : x;
+ }
+
+ template<int bits> constexpr inline signed sclip_m() {
+ return (1U << (bits)) - 1;
}
template<int bits> constexpr inline signed sclip(const signed x) {
- enum { b = 1U << (bits - 1), m = (1U << bits) - 1 };
- return ((x & m) ^ b) - b;
+ return ((x & sclip_m<bits>()) ^ sclamp_b<bits>()) - sclamp_b<bits>();
}
namespace bit {
--
2.15.0.rc1

View file

@ -0,0 +1,26 @@
From d39571de650d49636778a73c66414aff372c08af Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 7 Sep 2015 20:48:14 +0300
Subject: [PATCH 25/27] Fix MSU-1 bug where write to MSU1BASE+4 is mirred to
MSUBASE+5
---
snes/chip/msu1/msu1.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/snes/chip/msu1/msu1.cpp b/snes/chip/msu1/msu1.cpp
index 71700e60..ec1cf46a 100755
--- a/snes/chip/msu1/msu1.cpp
+++ b/snes/chip/msu1/msu1.cpp
@@ -107,7 +107,7 @@ void MSU1::mmio_write(unsigned addr, uint8 data) {
if(datafile.open()) datafile.seek(mmio.data_offset);
mmio.data_busy = false;
break;
- case 4: mmio.audio_track = (mmio.audio_track & 0xff00) | (data << 0);
+ case 4: mmio.audio_track = (mmio.audio_track & 0xff00) | (data << 0); break;
case 5: mmio.audio_track = (mmio.audio_track & 0x00ff) | (data << 8);
if(audiofile.open()) audiofile.close();
if(audiofile.open(interface->path(Cartridge::Slot::Base, { "-", (unsigned)mmio.audio_track, ".pcm" }), file::mode::read)) {
--
2.15.0.rc1

View file

@ -0,0 +1,25 @@
From c0a2270cfd5f56e8a311b36011e1f15fac6c54ca Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilariliusvaara@welho.com>
Date: Tue, 9 Aug 2016 18:54:57 +0300
Subject: [PATCH 26/27] Add <vector> to avoid compile error due to missing
std::vector
---
snes/snes.hpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/snes/snes.hpp b/snes/snes.hpp
index 7c48ebb3..3a65e360 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -22,6 +22,7 @@ namespace SNES {
#include <libco/libco.h>
+#include <vector>
#include <nall/platform.hpp>
#include <nall/algorithm.hpp>
#include <nall/any.hpp>
--
2.15.0.rc1

View file

@ -0,0 +1,377 @@
From 4cfbbeadc3abe3e3911f7f59ce57b715edc76563 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilariliusvaara@welho.com>
Date: Wed, 25 Oct 2017 14:18:34 +0300
Subject: [PATCH 27/27] Bus fixes: Do not update MDR on read from CPU MMIO
space
Also, updates the controller read timings to be more accurate.
---
snes/config/config.cpp | 1 +
snes/config/config.hpp | 1 +
snes/cpu/cpu.cpp | 2 +
snes/cpu/memory/memory.cpp | 26 ++++++++-
snes/cpu/mmio/mmio.cpp | 14 +++--
snes/cpu/timing/joypad.cpp | 132 +++++++++++++++++++++++++++++++++++++++------
snes/cpu/timing/timing.cpp | 11 ++--
snes/cpu/timing/timing.hpp | 3 +-
snes/snes.hpp | 1 +
9 files changed, 166 insertions(+), 25 deletions(-)
diff --git a/snes/config/config.cpp b/snes/config/config.cpp
index 19831370..8dcfd7e8 100755
--- a/snes/config/config.cpp
+++ b/snes/config/config.cpp
@@ -15,6 +15,7 @@ Configuration::Configuration() {
cpu.pal_frequency = 21281370;
cpu.wram_init_value = 0x55;
cpu.alt_poll_timings = false;
+ cpu.bus_fixes = false;
smp.ntsc_frequency = 24607104; //32040.5 * 768
smp.pal_frequency = 24607104;
diff --git a/snes/config/config.hpp b/snes/config/config.hpp
index 68fe0bde..d8577e39 100755
--- a/snes/config/config.hpp
+++ b/snes/config/config.hpp
@@ -14,6 +14,7 @@ struct Configuration {
unsigned pal_frequency;
unsigned wram_init_value;
bool alt_poll_timings;
+ bool bus_fixes;
} cpu;
struct SMP {
diff --git a/snes/cpu/cpu.cpp b/snes/cpu/cpu.cpp
index e11fc882..5e8e3137 100755
--- a/snes/cpu/cpu.cpp
+++ b/snes/cpu/cpu.cpp
@@ -1,5 +1,7 @@
#include <snes/snes.hpp>
#include <cstdio>
+#include <iostream>
+#include <cassert>
#define CPU_CPP
namespace SNES {
diff --git a/snes/cpu/memory/memory.cpp b/snes/cpu/memory/memory.cpp
index 31f82c31..df439c22 100755
--- a/snes/cpu/memory/memory.cpp
+++ b/snes/cpu/memory/memory.cpp
@@ -14,10 +14,32 @@ uint8 CPU::op_read(uint32 addr, bool exec) {
status.clock_count = speed(addr);
dma_edge();
add_clocks(status.clock_count - 4);
- regs.mdr = bus.read(addr, exec);
+ //MDR presents the state held by parasitic capacitance of the external bus.
+ //This bus is not affected by reads from CPU-internal registers, only if
+ //some external device responds. SDD1 does hook some of these addresses, but
+ //passes read straight through, as expected (as the CPU probably won't
+ //monitor if external device responds, even if it broadcasts a read).
+ //
+ //We use 4000-43FF as CPU register range, and not 4000-437F it likely is
+ //for quickness of checking. This will only affect things if some device
+ //tries to map the 4380-43FF range (that device will still work correctly,
+ //but openbus in that range won't).
+ //
+ //This was discovered while investigating why one Super Metroid glitch
+ //worked on emulator but crashed on real console.
+ //
+ //a word fetch from 2f4017 AND 0xfffc results in 2f3c and a word fetch from
+ //2f4210 AND 0x7f7f results in 2f22. This also extends to long fetches
+ //by arguments. E.g. long argument fetch from 94420F with 2F already on
+ //the bus AND 0x7f7fff results in 2f222f.
+ //
+ //The reason for masking some bits in above explanation was to ignore some
+ //known bits in those registers (bits 7 of 4210 and 4211, bits 0&1 of 4017).
+ uint8_t tmp = bus.read(addr, exec);
+ if(!config.cpu.bus_fixes || (addr & 0x40FC00) != 0x004000) regs.mdr = tmp;
add_clocks(4);
alu_edge();
- return regs.mdr;
+ return tmp;
}
void CPU::op_write(uint32 addr, uint8 data) {
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index 30048c19..be2990a3 100755
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -33,9 +33,17 @@ void CPU::mmio_w2183(uint8 data) {
//strobing $4016.d0 affects both controller port latches.
//$4017 bit 0 writes are ignored.
void CPU::mmio_w4016(uint8 data) {
- if(data&1) interface->notifyLatched();
- input.port1->latch(data & 1);
- input.port2->latch(data & 1);
+ //Only consider autoassert if both busfix and auto flags are set.
+ auto auto_asserted = (status.auto_joypad_counter & 384) == 384;
+ //Bit 6 of status.auto_joypad_counter follows "manual" latch.
+ auto oldstatus = auto_asserted || (status.auto_joypad_counter & 64) != 0;
+ status.auto_joypad_counter &= ~64;
+ status.auto_joypad_counter |= (data & 1) << 6;
+ auto newstatus = auto_asserted || (status.auto_joypad_counter & 64) != 0;
+ //If !oldstatus and newstatus, signal latch.
+ if(!oldstatus && newstatus) interface->notifyLatched();
+ input.port1->latch(newstatus);
+ input.port2->latch(newstatus);
}
//JOYSER0
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index afca7504..b60be020 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -3,11 +3,14 @@
//called every 256 clocks; see CPU::add_clocks()
void CPU::step_auto_joypad_poll() {
if(vcounter() >= (ppu.overscan() == false ? 225 : 240)) {
+ auto cycle = status.auto_joypad_counter & 63;
//cache enable state at first iteration
- if(status.auto_joypad_counter == 0) status.auto_joypad_latch = status.auto_joypad_poll;
- status.auto_joypad_active = status.auto_joypad_counter <= 15;
+ if(cycle == 0) status.auto_joypad_latch = status.auto_joypad_poll;
+ status.auto_joypad_active = cycle <= 15;
if(status.auto_joypad_active && status.auto_joypad_latch) {
- if(status.auto_joypad_counter == 0) {
+ if(cycle == 0) {
+ if(status.auto_joypad_counter & 128)
+ std::cerr << "step_auto_joypad_poll(): bus fixes set (counter=" << status.auto_joypad_counter << ")???" << std::endl;
if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
interface->notifyLatched();
input.port1->latch(1);
@@ -23,7 +26,7 @@ void CPU::step_auto_joypad_poll() {
status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
- if(status.auto_joypad_counter == 15) {
+ if(cycle == 15) {
char buf[512];
sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
status.joy1, status.joy2, status.joy3, status.joy4);
@@ -31,32 +34,129 @@ void CPU::step_auto_joypad_poll() {
}
}
- status.auto_joypad_counter++;
+ //Only bits 0-5 are supposed to increment.
+ if(cycle < 60)
+ status.auto_joypad_counter++;
}
}
//called every 128 clocks; see CPU::add_clocks()
-void CPU::step_auto_joypad_poll_NEW(bool polarity) {
- if(status.auto_joypad_counter > 0 && status.auto_joypad_counter <= 34) {
+void CPU::step_auto_joypad_poll_NEW2(bool polarity) {
+ //Poll starts on multiple of 128 mod 256 clocks (polarity=false) on first
+ //vblank scanline. If autopoller is off, mark as done for the frame.
+ if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && !polarity &&
+ (status.auto_joypad_counter & 63) == 0) {
+ if(!(status.auto_joypad_counter & 128))
+ std::cerr << "step_auto_joypad_poll_NEW2(): bus fixes clear???" << std::endl;
+ //Preserve high bits of autopoll counter.
+ auto x = status.auto_joypad_counter & ~63;
+ status.auto_joypad_counter = x | (status.auto_joypad_poll ? 1 : 36);
+ status.auto_joypad_latch = status.auto_joypad_poll;
+ }
+ //Abuse bit 6 of counter for "manual" poll flag. Bit 7 is supposed to be
+ //always set.
+ auto cycle = status.auto_joypad_counter & 63;
+ auto old_latchstate = (status.auto_joypad_counter & 320) != 0;
+ //If not enabled... This is not latched, as autopoll can be aborted.
+ if(!status.auto_joypad_poll && cycle > 0 && cycle < 36) {
+ if(dma_trace_fn) dma_trace_fn("-- Automatic polling ABORTED --");
+ status.auto_joypad_counter += (36 - cycle);
+ status.auto_joypad_active = false;
+ status.auto_joypad_latch = false;
+ //Release autopoll latch.
+ status.auto_joypad_counter &= ~256; //Autopoll clears latch.
+ auto new_latchstate = (status.auto_joypad_counter & 320) != 0;
+ if(old_latchstate && !new_latchstate) {
+ input.port1->latch(0);
+ input.port2->latch(0);
+ }
+ return;
+ }
+ //On cycle #1, latch is asserted (unless latch is already high, in this
+ //case the autopoller is supposed to force latch high too).
+ if(cycle == 1) {
+ if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
+ //Assert autopoll latch.
+ status.auto_joypad_counter |= 256;
+ auto new_latchstate = (status.auto_joypad_counter & 320) != 0;
+ if(!old_latchstate && new_latchstate) {
+ interface->notifyLatched();
+ input.port1->latch(1);
+ input.port2->latch(1);
+ }
+ }
+ //On cycle #2, busy is asserted and controllers are cleared.
+ if(cycle == 2) {
+ status.joy1 = 0;
+ status.joy2 = 0;
+ status.joy3 = 0;
+ status.joy4 = 0;
+ status.auto_joypad_active = true;
+ }
+ //Then, on cycle #3, latch is deasserted, unless "manual" latch forces
+ //real latch high.
+ if(cycle == 3) {
+ //Release autopoll latch.
+ status.auto_joypad_counter &= ~256;
+ auto new_latchstate = (status.auto_joypad_counter & 320) != 0;
+ if(old_latchstate && !new_latchstate) {
+ input.port1->latch(0);
+ input.port2->latch(0);
+ }
+ }
+ //Then on cycles #4, #6, #8, ..., #34, a bit is shifted. Also, clock would
+ //go low, but we can not emulate that.
+ if(cycle >= 4 && cycle <= 34 && cycle % 2 == 0) {
+ uint2 port0 = input.port1->data();
+ uint2 port1 = input.port2->data();
+ status.joy1 = (status.joy1 << 1) | (bool)(port0 & 1);
+ status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
+ status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
+ status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
+ }
+ //Then on cycles #5, #7, #9, ..., #35, clock drops high, But we can not
+ //emulate that.
+ //Then on cycle #35, busy flag is deasserted and poll is complete.
+ if(cycle == 35) {
+ status.auto_joypad_active = false;
+ char buf[512];
+ sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
+ status.joy1, status.joy2, status.joy3, status.joy4);
+ if(dma_trace_fn) dma_trace_fn(buf);
+ }
+ //The entiere train is 35 cycles.
+ if(cycle > 0 && cycle < 36) {
+ status.auto_joypad_counter++;
+ }
+}
+
+
+//called every 128 clocks; see CPU::add_clocks()
+void CPU::step_auto_joypad_poll_NEW(bool polarity, bool new2) {
+ if(new2) return step_auto_joypad_poll_NEW2(polarity);
+ auto cycle = status.auto_joypad_counter & 63;
+ if(cycle > 0 && cycle <= 34) {
if(!status.auto_joypad_latch) {
//FIXME: Is this right, busy flag goes on even if not enabled???
- if(status.auto_joypad_counter == 1)
+ if(cycle == 1)
status.auto_joypad_active = true;
- if(status.auto_joypad_counter == 34)
+ if(cycle == 34)
status.auto_joypad_active = false;
} else {
- if(status.auto_joypad_counter == 1) {
+ if(cycle == 1) {
+ if(status.auto_joypad_counter & 128)
+ std::cerr << "step_auto_joypad_poll_NEW(): bus fixes set???" << std::endl;
if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
status.auto_joypad_active = true;
interface->notifyLatched();
input.port1->latch(1);
input.port2->latch(1);
}
- if(status.auto_joypad_counter == 3) {
+ if(cycle == 3) {
input.port1->latch(0);
input.port2->latch(0);
}
- if((status.auto_joypad_counter & 1) != 0 && status.auto_joypad_counter != 1) {
+ if((cycle & 1) != 0 && cycle != 1) {
uint2 port0 = input.port1->data();
uint2 port1 = input.port2->data();
@@ -65,7 +165,7 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
}
- if(status.auto_joypad_counter == 34) {
+ if(cycle == 34) {
status.auto_joypad_active = false;
char buf[512];
sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
@@ -75,9 +175,11 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
}
status.auto_joypad_counter++;
}
- if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && status.auto_joypad_counter == 0 && !polarity) {
+ if(vcounter() >= (ppu.overscan() == false ? 225 : 240) && cycle == 0 && !polarity) {
+ //Preserve high bits of autopoller counter.
+ auto x = status.auto_joypad_counter & ~63;
status.auto_joypad_latch = status.auto_joypad_poll;
- status.auto_joypad_counter = 1;
+ status.auto_joypad_counter = x | 1;
}
}
diff --git a/snes/cpu/timing/timing.cpp b/snes/cpu/timing/timing.cpp
index d7cf24f3..ef81d891 100755
--- a/snes/cpu/timing/timing.cpp
+++ b/snes/cpu/timing/timing.cpp
@@ -17,12 +17,12 @@ void CPU::add_clocks(unsigned clocks) {
step(clocks);
- if(config.cpu.alt_poll_timings) {
+ if(config.cpu.alt_poll_timings || config.cpu.bus_fixes) {
bool opolarity = (status.auto_joypad_clock & 128);
status.auto_joypad_clock = (status.auto_joypad_clock + clocks) & 0xFF;
bool npolarity = (status.auto_joypad_clock & 128);
if(opolarity != npolarity)
- step_auto_joypad_poll_NEW(opolarity);
+ step_auto_joypad_poll_NEW(opolarity, config.cpu.bus_fixes);
} else {
status.auto_joypad_clock += clocks;
if(status.auto_joypad_clock >= 256) {
@@ -53,7 +53,8 @@ void CPU::scanline() {
status.hdma_init_position = (cpu_version == 1 ? 12 + 8 - dma_counter() : 12 + dma_counter());
status.hdma_init_triggered = false;
- status.auto_joypad_counter = 0;
+ //Only clear the low 6 bits (counter).
+ status.auto_joypad_counter &= ~63;
}
//DRAM refresh occurs once every scanline
@@ -200,7 +201,9 @@ void CPU::timing_reset() {
status.auto_joypad_active = false;
status.auto_joypad_latch = false;
- status.auto_joypad_counter = 0;
+ //Set bit 7 of joypad counter if bus fixes are active (for combined
+ //latch behavior).
+ status.auto_joypad_counter = config.cpu.bus_fixes ? 128 : 0;
status.auto_joypad_clock = 0;
}
diff --git a/snes/cpu/timing/timing.hpp b/snes/cpu/timing/timing.hpp
index bf15a727..8be2b830 100755
--- a/snes/cpu/timing/timing.hpp
+++ b/snes/cpu/timing/timing.hpp
@@ -22,4 +22,5 @@ alwaysinline bool irq_test();
//joypad.cpp
void step_auto_joypad_poll();
-void step_auto_joypad_poll_NEW(bool polarity);
+void step_auto_joypad_poll_NEW(bool polarity, bool new2);
+void step_auto_joypad_poll_NEW2(bool polarity);
diff --git a/snes/snes.hpp b/snes/snes.hpp
index 3a65e360..961842b3 100755
--- a/snes/snes.hpp
+++ b/snes/snes.hpp
@@ -3,6 +3,7 @@
#define BSNES_SUPPORTS_ADV_BREAKPOINTS
#define BSNES_SUPPORTS_ADV_BREAKPOINTS_PPU
#define BSNES_SUPPORTS_ALT_TIMINGS
+#define BSNES_SUPPORTS_BUS_FIXES
#define BSNES_SUPPORTS_TRACE_SA1
#define BSNES_SUPPORTS_DMA_TRACE
--
2.15.0.rc1

View file

@ -1,17 +1,17 @@
From f66f4b9ecfcccb22b113acc6e5e92c93ed8890a9 Mon Sep 17 00:00:00 2001
From 6c3da8eb6516d25e97b46d97fb0d3d24ca9ecfd0 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:37:44 +0200
Subject: [PATCH 1/4] Don't use time() in emulating chips
Subject: [PATCH 1/8] Don't use time() in emulating chips
Instead of using time() in chip emulation, create new interface method
currentTime(), defaulting to time(0). This way frontend can cleanly
override the current time bsnes is using.
---
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
5 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
extern Interface *interface;
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,26 +1,26 @@
From b02a77dd57546588a44b70bec3d6772e8ed5c11d Mon Sep 17 00:00:00 2001
From c87e7d9288a91db3b32b5ba4b2b74e52c0d3c11d Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 01:52:08 +0200
Subject: [PATCH 2/4] Save controller state when savestating
Subject: [PATCH 2/8] Save controller state when savestating
When savestating, save the controller state and restore it upon loadstate.
Prevents libsnes from mixing up buttons.
---
snes/controller/controller.cpp | 8 ++++++
snes/controller/controller.hpp | 2 +
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 ++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/system/input.cpp | 16 +++++++++++++
snes/system/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
snes/controller/controller.cpp | 8 +++++++
snes/controller/controller.hpp | 2 ++
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 +++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/system/input.cpp | 16 ++++++++++++++
snes/system/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
15 files changed, 142 insertions(+), 3 deletions(-)
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
@ -342,5 +342,5 @@ index 9f5273d..005e731 100755
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
#if defined(GAMEBOY)
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,13 +1,13 @@
From a47431385fedf705a3c9c1b820c116c230632943 Mon Sep 17 00:00:00 2001
From a62794b0bfa1d2bfc8907a1e4d4e5aa6fe3ee426 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Fri, 11 Nov 2011 19:49:46 +0200
Subject: [PATCH 3/4] Allow frontend to control random number seed
Subject: [PATCH 3/8] Allow frontend to control random number seed
---
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletions(-)
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index b3017c9..0a21a13 100755
@ -49,5 +49,5 @@ index 284e389..99901ff 100755
region = config.region;
expansion = config.expansion_port;
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,60 +1,63 @@
From 395130ad02c50c329c0290b675086ff104839943 Mon Sep 17 00:00:00 2001
From 33ecd422954b7e15d9e83b7035b07ffb52f4e1e8 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 7 Mar 2012 16:57:18 +0200
Subject: [PATCH 4/4] Fix mouse polling
Subject: [PATCH 4/8] Fix mouse polling
Don't poll for mouse motion excessive number of times (no need to poll it for
each bit!)
---
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 12 insertions(+), 2 deletions(-)
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
index 6b26fae..824ecd3 100755
index 6b26fae..1a066b9 100755
--- a/snes/controller/mouse/mouse.cpp
+++ b/snes/controller/mouse/mouse.cpp
@@ -3,8 +3,10 @@
@@ -3,9 +3,13 @@
uint2 Mouse::data() {
if(counter >= 32) return 1;
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ if(counter == 0) {
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ }
+ int position_x = _position_x;
+ int position_y = _position_y;
bool direction_x = position_x < 0; //0 = right, 1 = left
bool direction_y = position_y < 0; //0 = down, 1 = up
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
unsigned char block[Controller::SaveSize] = {0};
block[0] = latched ? 1 : 0;
block[1] = counter;
+ block[2] = (unsigned short)position_x >> 8;
+ block[3] = (unsigned short)position_x;
+ block[4] = (unsigned short)position_y >> 8;
+ block[5] = (unsigned short)position_y;
+ block[2] = (unsigned short)_position_x >> 8;
+ block[3] = (unsigned short)_position_x;
+ block[4] = (unsigned short)_position_y >> 8;
+ block[5] = (unsigned short)_position_y;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
}
}
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
index b66ea51..6074f34 100755
index b66ea51..b07c8ab 100755
--- a/snes/controller/mouse/mouse.hpp
+++ b/snes/controller/mouse/mouse.hpp
@@ -6,4 +6,6 @@ struct Mouse : Controller {
private:
bool latched;
unsigned counter;
+ int position_x;
+ int position_y;
+ int _position_x;
+ int _position_y;
};
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,18 +1,18 @@
From 574754de0ed7da044d3c559bb2c8bbca895c1e97 Mon Sep 17 00:00:00 2001
From 52a1a595f4473b4de0cdedcb018aef68108a2c73 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 24 Sep 2012 21:46:09 +0300
Subject: [PATCH] Add needed support for detecting true polls as opposed to
Subject: [PATCH 5/8] Add needed support for detecting true polls as opposed to
just autopolling
---
bsnes/snes/cpu/cpu.hpp | 1 +
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
snes/cpu/cpu.hpp | 1 +
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
index 5eb963e..f6466cc 100755
--- a/bsnes/snes/cpu/cpu.hpp
+++ b/bsnes/snes/cpu/cpu.hpp
--- a/snes/cpu/cpu.hpp
+++ b/snes/cpu/cpu.hpp
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
CPU();
~CPU();
@ -21,10 +21,10 @@ index 5eb963e..f6466cc 100755
privileged:
#include "dma/dma.hpp"
#include "memory/memory.hpp"
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index 8b6aaa6..c5ee930 100755
--- a/bsnes/snes/cpu/mmio/mmio.cpp
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
//1-0 = Joypad serial data
uint8 CPU::mmio_r4016() {
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
//DMAPx
uint8 CPU::mmio_r43x0(uint8 i) {
--
1.7.10.4
1.8.4.4

View file

@ -1,17 +1,17 @@
From 919c8935121c2ec7cb96ce561044981526c1ca7e Mon Sep 17 00:00:00 2001
From 74b67f36961839fcbc1caa23930151bd9b3e9d7e Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 14 Oct 2012 23:29:40 +0300
Subject: [PATCH] Fix compiling on GCC 4.7
Subject: [PATCH 6/8] Fix compiling on GCC 4.7
---
bsnes/nall/string.hpp | 2 +-
bsnes/ui-libsnes/libsnes.cpp | 1 +
nall/string.hpp | 2 +-
ui-libsnes/libsnes.cpp | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/bsnes/nall/string.hpp b/bsnes/nall/string.hpp
diff --git a/nall/string.hpp b/nall/string.hpp
index 996cd68..4747e4c 100755
--- a/bsnes/nall/string.hpp
+++ b/bsnes/nall/string.hpp
--- a/nall/string.hpp
+++ b/nall/string.hpp
@@ -25,8 +25,8 @@
#include <nall/string/base.hpp>
#include <nall/string/bml.hpp>
@ -22,10 +22,10 @@ index 996cd68..4747e4c 100755
#include <nall/string/compare.hpp>
#include <nall/string/convert.hpp>
#include <nall/string/cstring.hpp>
diff --git a/bsnes/ui-libsnes/libsnes.cpp b/bsnes/ui-libsnes/libsnes.cpp
diff --git a/ui-libsnes/libsnes.cpp b/ui-libsnes/libsnes.cpp
index 3b2be7a..ca90762 100755
--- a/bsnes/ui-libsnes/libsnes.cpp
+++ b/bsnes/ui-libsnes/libsnes.cpp
--- a/ui-libsnes/libsnes.cpp
+++ b/ui-libsnes/libsnes.cpp
@@ -1,5 +1,6 @@
#include "libsnes.hpp"
#include <snes/snes.hpp>
@ -34,5 +34,5 @@ index 3b2be7a..ca90762 100755
#include <nall/snes/cartridge.hpp>
#include <nall/gameboy/cartridge.hpp>
--
1.7.10.4
1.8.4.4

View file

@ -0,0 +1,65 @@
From 5dc532e67245f1e83504be4a21fef1ab15b08af2 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 27 Oct 2013 10:52:45 +0200
Subject: [PATCH 7/8] Support notifying latches
---
snes/cpu/mmio/mmio.cpp | 1 +
snes/cpu/timing/joypad.cpp | 1 +
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
4 files changed, 8 insertions(+)
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index c5ee930..b7afff0 100755
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
//strobing $4016.d0 affects both controller port latches.
//$4017 bit 0 writes are ignored.
void CPU::mmio_w4016(uint8 data) {
+ if(data&1) interface->notifyLatched();
input.port1->latch(data & 1);
input.port2->latch(data & 1);
}
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index 179df27..6a98de0 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -9,6 +9,7 @@ void CPU::step_auto_joypad_poll() {
if(status.auto_joypad_active && status.auto_joypad_latch) {
if(status.auto_joypad_counter == 0) {
+ interface->notifyLatched();
input.port1->latch(1);
input.port2->latch(1);
input.port1->latch(0);
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index 0a21a13..6685556 100755
--- a/snes/interface/interface.cpp
+++ b/snes/interface/interface.cpp
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
return time(0);
}
+void Interface::notifyLatched()
+{
+ //Nothing.
+}
+
}
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
index 30ee7fd..203f7b0 100755
--- a/snes/interface/interface.hpp
+++ b/snes/interface/interface.hpp
@@ -7,6 +7,7 @@ struct Interface {
virtual void message(const string &text);
virtual time_t currentTime();
virtual time_t randomSeed();
+ virtual void notifyLatched();
};
extern Interface *interface;
--
1.8.4.4

View file

@ -0,0 +1,22 @@
From ce0634fe5a8dea973ca9c357ec788740fbcfcf09 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 30 Nov 2013 10:28:05 +0200
Subject: [PATCH 8/8] Support auto-detecting bsnes version
---
bsnes.mk | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 bsnes.mk
diff --git a/bsnes.mk b/bsnes.mk
new file mode 100644
index 0000000..2248b71
--- /dev/null
+++ b/bsnes.mk
@@ -0,0 +1,3 @@
+BSNES_SUPPORTS_DEBUGGER=
+LIBSNES_DIR=ui-libsnes
+BSNES_VERSION=086
--
1.8.4.4

View file

@ -1,17 +1,17 @@
From 22205d4d339cfa11f6d53e644eae1c859a56d349 Mon Sep 17 00:00:00 2001
From a8018b3c90314bd0c112842fe81b27e978b891eb Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 00:37:44 +0200
Subject: [PATCH 1/4] Don't use time() in emulating chips
Subject: [PATCH 1/8] Don't use time() in emulating chips
Instead of using time() in chip emulation, create new interface method
currentTime(), defaulting to time(0). This way frontend can cleanly
override the current time bsnes is using.
---
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/chip/bsx/satellaview/satellaview.cpp | 2 +-
snes/chip/spc7110/spc7110.cpp | 2 +-
snes/chip/srtc/srtc.cpp | 2 +-
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
5 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/snes/chip/bsx/satellaview/satellaview.cpp b/snes/chip/bsx/satellaview/satellaview.cpp
@ -80,5 +80,5 @@ index f1a48c0..df975e8 100755
extern Interface *interface;
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,26 +1,26 @@
From fe11984ad18561506a7cc874cb7c0421f1e21ad1 Mon Sep 17 00:00:00 2001
From de423d6ec33a20f33652c6b9c8ce703b867b51bd Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 9 Nov 2011 01:52:08 +0200
Subject: [PATCH 2/4] Save controller state when savestating
Subject: [PATCH 2/8] Save controller state when savestating
When savestating, save the controller state and restore it upon loadstate.
Prevents libsnes from mixing up buttons.
---
snes/controller/controller.cpp | 8 ++++++
snes/controller/controller.hpp | 2 +
snes/controller/gamepad/gamepad.cpp | 13 ++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 ++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 +++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 +++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/system/input.cpp | 16 +++++++++++++
snes/system/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
snes/controller/controller.cpp | 8 +++++++
snes/controller/controller.hpp | 2 ++
snes/controller/gamepad/gamepad.cpp | 13 +++++++++++
snes/controller/gamepad/gamepad.hpp | 2 +-
snes/controller/justifier/justifier.cpp | 36 +++++++++++++++++++++++++++++++
snes/controller/justifier/justifier.hpp | 1 +
snes/controller/mouse/mouse.cpp | 13 +++++++++++
snes/controller/mouse/mouse.hpp | 2 +-
snes/controller/multitap/multitap.cpp | 16 ++++++++++++++
snes/controller/multitap/multitap.hpp | 2 +-
snes/controller/superscope/superscope.cpp | 31 ++++++++++++++++++++++++++
snes/controller/superscope/superscope.hpp | 1 +
snes/system/input.cpp | 16 ++++++++++++++
snes/system/input.hpp | 1 +
snes/system/serialization.cpp | 1 +
15 files changed, 142 insertions(+), 3 deletions(-)
diff --git a/snes/controller/controller.cpp b/snes/controller/controller.cpp
@ -342,5 +342,5 @@ index f746c3a..67e08a2 100755
if(cartridge.mode() == Cartridge::Mode::SufamiTurbo) sufamiturbo.serialize(s);
#if defined(GAMEBOY)
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,13 +1,13 @@
From 5f76449a70c9a546e18c2fdebe7588bbe90b56d2 Mon Sep 17 00:00:00 2001
From e1fce124df0a1ea43324df65b9d0ee7262eda988 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Fri, 11 Nov 2011 19:49:46 +0200
Subject: [PATCH 3/4] Allow frontend to control random number seed
Subject: [PATCH 3/8] Allow frontend to control random number seed
---
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletions(-)
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
snes/system/system.cpp | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index b3017c9..0a21a13 100755
@ -49,5 +49,5 @@ index 9b70bbf..cbd096c 100755
region = config.region;
expansion = config.expansion_port;
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,60 +1,63 @@
From 160dedf35571478781737ee35307b9321cfb41bb Mon Sep 17 00:00:00 2001
From 21e21c3b953f499bb3e309ff6a04b38763e7910a Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Wed, 7 Mar 2012 16:57:18 +0200
Subject: [PATCH 4/4] Fix mouse polling
Subject: [PATCH 4/8] Fix mouse polling
Don't poll for mouse motion excessive number of times (no need to poll it for
each bit!)
---
snes/controller/mouse/mouse.cpp | 12 ++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 12 insertions(+), 2 deletions(-)
snes/controller/mouse/mouse.cpp | 14 ++++++++++++--
snes/controller/mouse/mouse.hpp | 2 ++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/snes/controller/mouse/mouse.cpp b/snes/controller/mouse/mouse.cpp
index 6b26fae..824ecd3 100755
index 6b26fae..1a066b9 100755
--- a/snes/controller/mouse/mouse.cpp
+++ b/snes/controller/mouse/mouse.cpp
@@ -3,8 +3,10 @@
@@ -3,9 +3,13 @@
uint2 Mouse::data() {
if(counter >= 32) return 1;
- int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
- int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ if(counter == 0) {
+ position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ _position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
+ _position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
+ }
+ int position_x = _position_x;
+ int position_y = _position_y;
bool direction_x = position_x < 0; //0 = right, 1 = left
bool direction_y = position_y < 0; //0 = down, 1 = up
@@ -67,10 +69,16 @@ void Mouse::serialize(serializer& s) {
@@ -67,10 +71,16 @@ void Mouse::serialize(serializer& s) {
unsigned char block[Controller::SaveSize] = {0};
block[0] = latched ? 1 : 0;
block[1] = counter;
+ block[2] = (unsigned short)position_x >> 8;
+ block[3] = (unsigned short)position_x;
+ block[4] = (unsigned short)position_y >> 8;
+ block[5] = (unsigned short)position_y;
+ block[2] = (unsigned short)_position_x >> 8;
+ block[3] = (unsigned short)_position_x;
+ block[4] = (unsigned short)_position_y >> 8;
+ block[5] = (unsigned short)_position_y;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
+ position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
+ _position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
+ _position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
}
}
diff --git a/snes/controller/mouse/mouse.hpp b/snes/controller/mouse/mouse.hpp
index b66ea51..6074f34 100755
index b66ea51..b07c8ab 100755
--- a/snes/controller/mouse/mouse.hpp
+++ b/snes/controller/mouse/mouse.hpp
@@ -6,4 +6,6 @@ struct Mouse : Controller {
private:
bool latched;
unsigned counter;
+ int position_x;
+ int position_y;
+ int _position_x;
+ int _position_y;
};
--
1.7.9.48.g85da4d
1.8.4.4

View file

@ -1,18 +1,18 @@
From f22d7a2b57d57959ac947465323870a8772d15ad Mon Sep 17 00:00:00 2001
From 9b14075f51587694015f8507f1c7cb565fee8225 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Mon, 24 Sep 2012 21:46:09 +0300
Subject: [PATCH] Add needed support for detecting true polls as opposed to
Subject: [PATCH 5/8] Add needed support for detecting true polls as opposed to
just autopolling
---
bsnes/snes/cpu/cpu.hpp | 1 +
bsnes/snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
snes/cpu/cpu.hpp | 1 +
snes/cpu/mmio/mmio.cpp | 18 ++++++++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/bsnes/snes/cpu/cpu.hpp b/bsnes/snes/cpu/cpu.hpp
diff --git a/snes/cpu/cpu.hpp b/snes/cpu/cpu.hpp
index 5eb963e..f6466cc 100755
--- a/bsnes/snes/cpu/cpu.hpp
+++ b/bsnes/snes/cpu/cpu.hpp
--- a/snes/cpu/cpu.hpp
+++ b/snes/cpu/cpu.hpp
@@ -25,6 +25,7 @@ struct CPU : public Processor, public CPUcore, public PPUcounter {
CPU();
~CPU();
@ -21,10 +21,10 @@ index 5eb963e..f6466cc 100755
privileged:
#include "dma/dma.hpp"
#include "memory/memory.hpp"
diff --git a/bsnes/snes/cpu/mmio/mmio.cpp b/bsnes/snes/cpu/mmio/mmio.cpp
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index 8b6aaa6..c5ee930 100755
--- a/bsnes/snes/cpu/mmio/mmio.cpp
+++ b/bsnes/snes/cpu/mmio/mmio.cpp
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -42,6 +42,7 @@ void CPU::mmio_w4016(uint8 data) {
//1-0 = Joypad serial data
uint8 CPU::mmio_r4016() {
@ -65,5 +65,5 @@ index 8b6aaa6..c5ee930 100755
//DMAPx
uint8 CPU::mmio_r43x0(uint8 i) {
--
1.7.10.4
1.8.4.4

View file

@ -1,16 +1,16 @@
From d4a3678c9cfbca544af8069b42b9eaa0205f8ea3 Mon Sep 17 00:00:00 2001
From 8c41bf9b792c08ecbf22a87d4e85f3e4801e62d2 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 14 Oct 2012 23:25:33 +0300
Subject: [PATCH] Add missing include to libsnes.cpp
Subject: [PATCH 6/8] Add missing include to libsnes.cpp
---
bsnes/target-libsnes/libsnes.cpp | 1 +
target-libsnes/libsnes.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/bsnes/target-libsnes/libsnes.cpp b/bsnes/target-libsnes/libsnes.cpp
diff --git a/target-libsnes/libsnes.cpp b/target-libsnes/libsnes.cpp
index 3b2be7a..ca90762 100755
--- a/bsnes/target-libsnes/libsnes.cpp
+++ b/bsnes/target-libsnes/libsnes.cpp
--- a/target-libsnes/libsnes.cpp
+++ b/target-libsnes/libsnes.cpp
@@ -1,5 +1,6 @@
#include "libsnes.hpp"
#include <snes/snes.hpp>
@ -19,5 +19,5 @@ index 3b2be7a..ca90762 100755
#include <nall/snes/cartridge.hpp>
#include <nall/gameboy/cartridge.hpp>
--
1.7.10.4
1.8.4.4

View file

@ -0,0 +1,65 @@
From 13643c86bfff3871968cf6e8b4f991465d4e81e7 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sun, 27 Oct 2013 10:52:45 +0200
Subject: [PATCH 7/8] Support notifying latches
---
snes/cpu/mmio/mmio.cpp | 1 +
snes/cpu/timing/joypad.cpp | 1 +
snes/interface/interface.cpp | 5 +++++
snes/interface/interface.hpp | 1 +
4 files changed, 8 insertions(+)
diff --git a/snes/cpu/mmio/mmio.cpp b/snes/cpu/mmio/mmio.cpp
index c5ee930..b7afff0 100755
--- a/snes/cpu/mmio/mmio.cpp
+++ b/snes/cpu/mmio/mmio.cpp
@@ -33,6 +33,7 @@ void CPU::mmio_w2183(uint8 data) {
//strobing $4016.d0 affects both controller port latches.
//$4017 bit 0 writes are ignored.
void CPU::mmio_w4016(uint8 data) {
+ if(data&1) interface->notifyLatched();
input.port1->latch(data & 1);
input.port2->latch(data & 1);
}
diff --git a/snes/cpu/timing/joypad.cpp b/snes/cpu/timing/joypad.cpp
index 179df27..6a98de0 100755
--- a/snes/cpu/timing/joypad.cpp
+++ b/snes/cpu/timing/joypad.cpp
@@ -9,6 +9,7 @@ void CPU::step_auto_joypad_poll() {
if(status.auto_joypad_active && status.auto_joypad_latch) {
if(status.auto_joypad_counter == 0) {
+ interface->notifyLatched();
input.port1->latch(1);
input.port2->latch(1);
input.port1->latch(0);
diff --git a/snes/interface/interface.cpp b/snes/interface/interface.cpp
index 0a21a13..6685556 100755
--- a/snes/interface/interface.cpp
+++ b/snes/interface/interface.cpp
@@ -28,4 +28,9 @@ time_t Interface::randomSeed()
return time(0);
}
+void Interface::notifyLatched()
+{
+ //Nothing.
+}
+
}
diff --git a/snes/interface/interface.hpp b/snes/interface/interface.hpp
index 30ee7fd..203f7b0 100755
--- a/snes/interface/interface.hpp
+++ b/snes/interface/interface.hpp
@@ -7,6 +7,7 @@ struct Interface {
virtual void message(const string &text);
virtual time_t currentTime();
virtual time_t randomSeed();
+ virtual void notifyLatched();
};
extern Interface *interface;
--
1.8.4.4

View file

@ -0,0 +1,22 @@
From e74f6d6ce7b369d82abf1eed6d7c3e99af0d8f64 Mon Sep 17 00:00:00 2001
From: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Date: Sat, 30 Nov 2013 10:28:40 +0200
Subject: [PATCH 8/8] Support auto-dectecting bsnes version
---
bsnes.mk | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 bsnes.mk
diff --git a/bsnes.mk b/bsnes.mk
new file mode 100644
index 0000000..c31911f
--- /dev/null
+++ b/bsnes.mk
@@ -0,0 +1,3 @@
+BSNES_SUPPORTS_DEBUGGER=
+LIBSNES_DIR=target-libsnes
+BSNES_VERSION=087
--
1.8.4.4

124
buildaux/mkdeps.cpp Normal file
View file

@ -0,0 +1,124 @@
#include <boost/filesystem.hpp>
#include <sys/time.h>
#include <fstream>
#include <cctype>
#include <set>
#include <map>
#include <iostream>
#include <string>
namespace boost_fs = boost::filesystem;
bool is_cmdhelp_file(const std::string& filename)
{
std::string _filename = filename;
return (_filename.length() > 8 && _filename.substr(0, 8) == "cmdhelp/");
}
std::string search_include(const std::list<std::string>& searchpath, const std::string& _filename,
const std::string& ref_by)
{
std::string filename = _filename;
//Hack: process cmdhelp includes internally as the date were for the JSON include.
if(is_cmdhelp_file(filename)) {
if(filename != "cmdhelp/inverselist.hpp") {
filename = "../src/" + filename;
//Replace the extension with .json.
size_t split = filename.find_last_of("./\\");
if(split < filename.length() && filename[split] == '.') {
filename = filename.substr(0, split) + ".json";
}
}
}
size_t p = ref_by.find_last_of("/");
if(p < ref_by.length()) {
std::string i = ref_by;
i = i.substr(0, p);
std::string real_fn = i + "/" + filename;
boost_fs::path p(real_fn);
if(boost_fs::exists(p) && boost_fs::is_regular_file(p))
return real_fn;
}
for(auto& i : searchpath) {
std::string real_fn = i + "/" + filename;
boost_fs::path p(real_fn);
if(boost_fs::exists(p) && boost_fs::is_regular_file(p))
return real_fn;
}
std::cerr << "WARNING: Include file '" << filename << "' not found." << std::endl;
return "";
}
time_t get_timestamp(const std::string& path)
{
boost_fs::path p(path);
if(!boost_fs::exists(p)) return 0;
return boost_fs::last_write_time(p);
}
time_t recursive_scan(const std::list<std::string>& searchpath, const std::string& filename,
std::map<std::string, time_t>& scanned)
{
if(filename == "")
return 0;
if(scanned.count(filename))
return 0;
std::ifstream fp(filename);
if(!fp) {
std::cerr << "WARNING: File '" << filename << "' can't be opened." << std::endl;
return 0;
}
time_t newest = get_timestamp(filename);
scanned[filename] = newest;
std::string tmp;
while(std::getline(fp, tmp)) {
if(tmp.length() > 0 && tmp[0] == '#') {
//Possibly include.
std::string included;
if(strncmp(tmp.c_str(), "#include", 8))
continue;
size_t ptr = 8;
while(ptr < tmp.length() && isspace((unsigned char)tmp[ptr]))
ptr++;
if(ptr == tmp.length())
continue;
if(tmp[ptr] != '\"')
continue;
size_t iptr = ++ptr;
while(ptr < tmp.length() && tmp[ptr] != '\"')
ptr++;
if(ptr == tmp.length())
continue;
included = tmp.substr(iptr, ptr - iptr);
newest = std::max(newest, recursive_scan(searchpath, search_include(searchpath, included,
filename), scanned));
}
}
return newest;
}
int main(int argc, char** argv)
{
std::list<std::string> searchpath;
std::list<std::string> files;
bool step = false;
for(int i = 1; i < argc; i++) {
if(!step && !strcmp(argv[i], "--"))
step = true;
else if(!step)
searchpath.push_back(argv[i]);
else
files.push_back(argv[i]);
}
searchpath.push_back(".");
for(auto& i : files) {
std::map<std::string, time_t> x;
time_t t = recursive_scan(searchpath, i, x);
if(get_timestamp(i + ".dep") < t) {
std::ofstream y(i + ".dep");
for(auto& j : x)
y << j.second << " " << j.first << std::endl;
}
}
return 0;
}

91
buildaux/txt2cstr.cpp Normal file
View file

@ -0,0 +1,91 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstring>
const char* hexes = "0123456789ABCDEF";
struct encoder
{
encoder(std::ostream& _output) : output(_output)
{
have_quote = false;
}
size_t operator()(unsigned char* buf, size_t bufuse, bool eof)
{
if(!bufuse) return 0;
std::ostringstream out;
size_t i = 0;
while(i < bufuse) {
if(!have_quote) {
out << "\"";
have_quote = true;
}
unsigned char ch = buf[i];
if(ch == 9) {
out << "\\t";
} else if(ch == 10) {
out << "\\n\"" << std::endl;
have_quote = false;
} else if(ch == 13) {
out << "\\r";
} else if(ch < 32) {
out << "\\x" << hexes[(ch >> 4)] << hexes[ch & 15];
} else if(ch == '\"') {
out << "\\\"";
} else if(ch == '\\') {
out << "\\\\";
} else if(ch < 127) {
out << ch;
} else {
out << "\\x" << hexes[(ch >> 4)] << hexes[ch & 15];
}
i++;
}
output << out.str();
return i;
}
size_t operator()()
{
if(have_quote) {
output << "\"";
have_quote = false;
}
}
private:
std::ostream& output;
bool have_quote;
};
void do_encode(std::istream& input, std::ostream& output)
{
char buf[4096];
size_t bufuse = 0;
bool eof = false;
encoder e(output);
while(true) {
if(!eof) {
input.read(buf + bufuse, 4096 - bufuse);
bufuse += input.gcount();
}
if(!input)
eof = true;
size_t bytes = e(reinterpret_cast<unsigned char*>(buf), bufuse, eof);
memmove(buf, buf + bytes, bufuse - bytes);
bufuse -= bytes;
if(eof && !bufuse) break;
}
e();
}
int main(int argc, char** argv)
{
if(argc != 3) {
std::cerr << "Usage: txt2cstr <symbol> <file>" << std::endl;
return 1;
}
std::ifstream in(argv[2], std::ios::binary);
std::cout << "const char* " << argv[1] << " =" << std::endl;
do_encode(in, std::cout);
std::cout << ";" << std::endl;
}

BIN
data/snes9xlua.font Normal file

Binary file not shown.

BIN
data/snes9xluaclever.font Normal file

Binary file not shown.

BIN
data/snes9xluasmall.font Normal file

Binary file not shown.

BIN
data/snes9xtext.font Normal file

Binary file not shown.

BIN
data/verysmall.font Normal file

Binary file not shown.

1
gambatte Submodule

@ -0,0 +1 @@
Subproject commit a77b5548ae91cf66d1d18d4fbe2aa76eb39c7ea3

View file

@ -0,0 +1,2 @@
#pragma once
namespace STUBS { extern const char* inverse_cmd_list[]; }

View file

@ -4,30 +4,48 @@
#include <string>
#include <set>
#include <stdexcept>
#include <iostream>
#include <functional>
#include "library/framebuffer.hpp"
#include "library/dispatch.hpp"
#include "library/threads.hpp"
class adv_dumper
class master_dumper;
class dumper_factory_base;
class dumper_base;
class lua_state;
class dumper_factory_base
{
public:
/**
* Notifier base.
*/
class notifier
{
public:
virtual ~notifier() throw();
virtual void dumpers_updated() throw() = 0;
};
/**
* Detail flags.
*/
static unsigned target_type_mask;
static unsigned target_type_file;
static unsigned target_type_prefix;
static unsigned target_type_special;
static const unsigned target_type_mask;
static const unsigned target_type_file;
static const unsigned target_type_prefix;
static const unsigned target_type_special;
/**
* Register a dumper.
*
* Parameter id: The ID of dumper.
* Throws std::bad_alloc: Not enough memory.
*/
adv_dumper(const std::string& id) throw(std::bad_alloc);
dumper_factory_base(const std::string& id) throw(std::bad_alloc);
/**
* Unregister a dumper.
*/
~adv_dumper();
~dumper_factory_base();
/**
* Get ID of dumper.
*
@ -40,7 +58,7 @@ public:
* Returns: The set.
* Throws std::bad_alloc: Not enough memory.
*/
static std::set<adv_dumper*> get_dumper_set() throw(std::bad_alloc);
static std::set<dumper_factory_base*> get_dumper_set() throw(std::bad_alloc);
/**
* List all valid submodes.
*
@ -77,30 +95,193 @@ public:
* Throws std::bad_alloc: Not enough memory.
*/
virtual std::string modename(const std::string& mode) throw(std::bad_alloc) = 0;
/**
* Is this dumper busy dumping?
*
* Return: True if busy, false if not.
*/
virtual bool busy() = 0;
/**
* Start dump.
*
* parameter mode: The mode to dump using.
* parameter targetname: The target filename or prefix.
* returns: The dumper object.
* Throws std::bad_alloc: Not enough memory.
* Throws std::runtime_error: Can't start dump.
*/
virtual void start(const std::string& mode, const std::string& targetname) throw(std::bad_alloc,
std::runtime_error) = 0;
virtual dumper_base* start(master_dumper& _mdumper, const std::string& mode, const std::string& targetname)
throw(std::bad_alloc, std::runtime_error) = 0;
/**
* End current dump.
* Is hidden?
*/
virtual void end() throw() = 0;
virtual bool hidden() const { return false; }
/**
* Add dumper update notifier object.
*/
static void add_notifier(notifier& n);
/**
* Remove dumper update notifier object.
*/
static void drop_notifier(notifier& n);
/**
* Notify ctor finished.
*/
void ctor_notify();
/**
* Notify dumper change.
*/
static void run_notify();
private:
std::string d_id;
};
class master_dumper
{
public:
/**
* Information about run.
*/
struct gameinfo
{
public:
/**
* Construct game info.
*/
gameinfo() throw(std::bad_alloc);
/**
* Game name.
*/
std::string gamename;
/**
* Run length in seconds.
*/
double length;
/**
* Rerecord count (base 10 ASCII)
*/
std::string rerecords;
/**
* Authors. The first components are real names, the second components are nicknames. Either (but not both) may be
* blank.
*/
std::vector<std::pair<std::string, std::string>> authors;
/**
* Format human-redable representation of the length.
*
* Parameter digits: Number of sub-second digits to use.
* Returns: The time formated.
* Throws std::bad_alloc: Not enough memory.
*/
std::string get_readable_time(unsigned digits) const throw(std::bad_alloc);
/**
* Get number of authors.
*
* Returns: Number of authors.
*/
size_t get_author_count() const throw();
/**
* Get short name of author (nickname if present, otherwise full name).
*
* Parameter idx: Index of author (0-based).
* Returns: The short name.
* Throws std::bad_alloc: Not enough memory.
*/
std::string get_author_short(size_t idx) const throw(std::bad_alloc);
/**
* Get long name of author (full name and nickname if present).
*
* Parameter idx: Index of author (0-based).
* Returns: The long name.
* Throws std::bad_alloc: Not enough memory.
*/
std::string get_author_long(size_t idx) const throw(std::bad_alloc);
/**
* Get rerecord count as a number. If rerecord count is too high, returns the maximum representatible count.
*
* Returns: The rerecord count.
*/
uint64_t get_rerecords() const throw();
};
/**
* Notifier.
*/
class notifier
{
public:
virtual ~notifier() throw();
virtual void dump_status_change() = 0;
};
/**
* Ctor.
*/
master_dumper(lua_state& _lua2);
/**
* Get instance for specified dumper.
*/
dumper_base* get_instance(dumper_factory_base* dumper) throw();
/**
* Is dumper busy in this instance?
*/
bool busy(dumper_factory_base* dumper) throw()
{
return get_instance(dumper) != NULL;
}
/**
* Call start on dumper.
*/
dumper_base* start(dumper_factory_base& factory, const std::string& mode, const std::string& targetname)
throw(std::bad_alloc, std::runtime_error);
/**
* Add dumper update notifier object.
*/
void add_notifier(notifier& n);
/**
* Remove dumper update notifier object.
*/
void drop_notifier(notifier& n);
/**
* Add dumper update notifier object.
*/
void add_dumper(dumper_base& n);
/**
* Remove dumper update notifier object.
*/
void drop_dumper(dumper_base& n);
/**
* Get number of active dumpers.
*/
unsigned get_dumper_count() throw();
/**
* Call all notifiers (on_frame).
*/
void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d);
/**
* Call all notifiers (on_sample).
*/
void on_sample(short l, short r);
/**
* Call all notifiers (on_rate_change)
*
* Also changes builtin rate variables.
*/
void on_rate_change(uint32_t n, uint32_t d);
/**
* Call all notifiers (on_gameinfo_change)
*
* Also changes builtin gameinfo structure.
*/
void on_gameinfo_change(const gameinfo& gi);
/**
* Get current sound rate in effect.
*/
std::pair<uint32_t, uint32_t> get_rate();
/**
* Get current gameinfo in effect.
*/
const gameinfo& get_gameinfo();
/**
* End all dumps.
*/
void end_dumps();
/**
* Set output stream.
*/
void set_output(std::ostream* _output);
/**
* Render Lua HUD on video.
*
@ -108,17 +289,91 @@ private:
* Parameter source: The source screen to read.
* Parameter hscl: The horizontal scale factor.
* Parameter vscl: The vertical scale factor.
* Parameter roffset: Red offset.
* Parameter goffset: Green offset.
* Parameter boffset: Blue offset.
* Parameter lgap: Left gap.
* Parameter tgap: Top gap.
* Parameter rgap: Right gap
* Parameter bgap: Bottom gap.
* Parameter fn: Function to call between running lua hooks and actually rendering.
* Returns: True if frame should be dumped, false if not.
*/
template<bool X> void render_video_hud(struct framebuffer<X>& target, struct framebuffer_raw& source, uint32_t hscl,
uint32_t vscl, uint32_t roffset, uint32_t goffset, uint32_t boffset, uint32_t lgap, uint32_t tgap,
uint32_t rgap, uint32_t bgap, void(*fn)());
template<bool X> bool render_video_hud(struct framebuffer::fb<X>& target, struct framebuffer::raw& source,
uint32_t hscl, uint32_t vscl, uint32_t lgap, uint32_t tgap, uint32_t rgap, uint32_t bgap,
std::function<void()> fn);
/**
* Calculate number of sound samples to drop due to dropped frame.
*/
uint64_t killed_audio_length(uint32_t fps_n, uint32_t fps_d, double& fraction);
private:
void statuschange();
friend class dumper_base;
std::map<dumper_factory_base*, dumper_base*> dumpers;
std::set<notifier*> notifications;
std::set<dumper_base*> sdumpers;
uint32_t current_rate_n;
uint32_t current_rate_d;
gameinfo current_gi;
std::ostream* output;
threads::rlock lock;
lua_state& lua2;
};
class dumper_base
{
public:
dumper_base();
dumper_base(master_dumper& _mdumper, dumper_factory_base& _fbase);
virtual ~dumper_base() throw();
/**
* New frame available.
*/
virtual void on_frame(struct framebuffer::raw& _frame, uint32_t fps_n, uint32_t fps_d) = 0;
/**
* New sample available.
*/
virtual void on_sample(short l, short r) = 0;
/**
* Sample rate is changing.
*/
virtual void on_rate_change(uint32_t n, uint32_t d) = 0;
/**
* Gameinfo is changing.
*/
virtual void on_gameinfo_change(const master_dumper::gameinfo& gi) = 0;
/**
* Dump is being forcibly ended.
*/
virtual void on_end() = 0;
/**
* Render Lua HUD on video. samples_killed is incremented if needed.
*
* Parameter target: The target screen to render on.
* Parameter source: The source screen to read.
* Parameter fps_n: Fps numerator.
* Parameter fps_d: Fps denominator.
* Parameter hscl: The horizontal scale factor.
* Parameter vscl: The vertical scale factor.
* Parameter lgap: Left gap.
* Parameter tgap: Top gap.
* Parameter rgap: Right gap
* Parameter bgap: Bottom gap.
* Parameter fn: Function to call between running lua hooks and actually rendering.
* Returns: True if frame should be dumped, false if not.
*/
template<bool X> bool render_video_hud(struct framebuffer::fb<X>& target, struct framebuffer::raw& source,
uint32_t fps_n, uint32_t fps_d, uint32_t hscl, uint32_t vscl, uint32_t lgap, uint32_t tgap,
uint32_t rgap, uint32_t bgap, std::function<void()> fn)
{
bool r = mdumper->render_video_hud(target, source, hscl, vscl, lgap, tgap, rgap, bgap, fn);
if(!r)
samples_killed += mdumper->killed_audio_length(fps_n, fps_d, akillfrac);
return r;
}
private:
friend class master_dumper;
uint64_t samples_killed;
master_dumper* mdumper;
dumper_factory_base* fbase;
double akillfrac;
};
#endif

View file

@ -0,0 +1,109 @@
#ifndef _audioapi_driver__hpp__included__
#define _audioapi_driver__hpp__included__
#include <stdexcept>
#include <string>
#include <map>
class audioapi_instance;
//All the following need to be implemented by the sound driver itself
struct _audioapi_driver
{
//These correspond to various audioapi_driver_* functions.
void (*init)() throw();
void (*quit)() throw();
void (*enable)(bool enable);
bool (*initialized)();
void (*set_device)(const std::string& pdev, const std::string& rdev);
std::string (*get_device)(bool rec);
std::map<std::string, std::string> (*get_devices)(bool rec);
const char* (*name)();
};
struct audioapi_driver
{
audioapi_driver(struct _audioapi_driver driver);
};
/**
* Initialize the driver.
*/
void audioapi_driver_init() throw();
/**
* Deinitialize the driver.
*/
void audioapi_driver_quit() throw();
/**
* Enable or disable sound.
*
* parameter enable: Enable sounds if true, otherwise disable sounds.
*/
void audioapi_driver_enable(bool enable) throw();
/**
* Has the sound system been successfully initialized?
*
* Returns: True if sound system has successfully initialized, false otherwise.
*/
bool audioapi_driver_initialized();
/**
* Set sound device (playback).
*
* - If new sound device is invalid, the sound device is not changed.
*
* Parameter pdev: The new sound device (playback).
* Parameter rdev: The new sound device (recording)
*/
void audioapi_driver_set_device(const std::string& pdev, const std::string& rdev) throw(std::bad_alloc,
std::runtime_error);
/**
* Get current sound device (playback).
*
* Returns: The current sound device.
*/
std::string audioapi_driver_get_device(bool rec) throw(std::bad_alloc);
/**
* Get available sound devices (playback).
*
* Returns: The map of devices. Keyed by name of the device, values are human-readable names for devices.
*/
std::map<std::string, std::string> audioapi_driver_get_devices(bool rec) throw(std::bad_alloc);
/**
* Identification for sound plugin.
*/
const char* audioapi_driver_name() throw();
/**
* Add an instance to be mixed.
*/
void audioapi_connect_instance(audioapi_instance& instance);
/**
* Remove an instance from being mixed.
*/
void audioapi_disconnect_instance(audioapi_instance& instance);
/**
* Send a rate change.
*/
void audioapi_send_rate_change(unsigned rrate, unsigned prate);
/**
* Broadcast voice input to all instances.
*/
void audioapi_put_voice(float* samples, size_t count);
/**
* Get mixed music + voice out from all instances.
*/
void audioapi_get_mixed(int16_t* samples, size_t count, bool stereo);
#endif

View file

@ -1,56 +1,93 @@
#ifndef _audioapi__hpp__included__
#define _audioapi__hpp__included__
#include "library/threads.hpp"
#include <map>
#include <cstdint>
#include <cstdlib>
#include <string>
#include <stdexcept>
class audioapi_instance
{
public:
/**
* Audio API music buffer.
*/
struct audioapi_buffer
{
struct buffer
{
/**
* The samples.
*
* Note: May be NULL if no samples are available..
*/
int16_t* samples;
int16_t* samples;
/**
* Playback pointer in samples structure.
*/
size_t pointer;
size_t pointer;
/**
* Total number of samples in this buffer.
*/
size_t total;
size_t total;
/**
* True if buffer is stereo, false if mono.
*/
bool stereo;
bool stereo;
/**
* The rate in samples per second the buffer is supposed to be played at.
*/
double rate;
};
//Resampler.
class audioapi_resampler
{
public:
audioapi_resampler();
//After call, either insize or outsize is zero.
void resample(float*& in, size_t& insize, float*& out, size_t& outsize, double ratio, bool stereo);
private:
double position;
double vAl, vBl, vCl, vDl, vAr, vBr, vCr, vDr;
};
double rate;
};
/**
* Audio API VU calculator.
*/
struct vumeter
{
/**
* Initialize.
*/
vumeter();
/**
* Submit samples.
*
* Parameter samples: The samples to submit. If NULL, reads all samples as 0.
* Parameter count: Number of samples.
* Parameter stereo: If true, read only every other sample (but still read count samples).
* Parameter rate: Sound sampling rate.
* Parameter scale: Value to scale the samples by.
*/
void operator()(float* samples, size_t count, bool stereo, double rate, double scale);
/**
* Get VU value in dB.
*/
operator float() const throw() { return vu; }
private:
double accumulator;
size_t samples;
float vu;
void update_vu();
};
//Resampler.
class resampler
{
public:
resampler();
//After call, either insize or outsize is zero.
void resample(float*& in, size_t& insize, float*& out, size_t& outsize, double ratio, bool stereo);
private:
double position;
double vAl, vBl, vCl, vDl, vAr, vBr, vCr, vDr;
};
/**
* Ctor.
*/
audioapi_instance();
~audioapi_instance();
//The following are intended to be used by the emulator core.
/**
/**
* Submit a buffer for playback on music channel.
*
* Parameter samples: The samples in the buffer. If stereo is true, each sample takes two elements (L, R).
@ -58,118 +95,97 @@ private:
* Parameter stereo: If true, the signal is stereo. If false, mono.
* Parameter rate: Rate of buffer in samples per second.
*/
void audioapi_submit_buffer(int16_t* samples, size_t count, bool stereo, double rate);
void submit_buffer(int16_t* samples, size_t count, bool stereo, double rate);
/**
* Get the voice channel playback/record rate.
*
* Returns: The rate in samples per second (first for recording, then for playback).
*/
std::pair<unsigned,unsigned> voice_rate();
/**
* Get the voice channel nominal playback/record rate.
*
* Returns: The rate in samples per second.
*/
unsigned audioapi_voice_rate();
unsigned orig_voice_rate();
/**
* Get the voice channel playback status register.
*
* Returns: The number of samples free for playback.
*/
unsigned audioapi_voice_p_status();
unsigned voice_p_status();
/**
* Get the voice channel playback status register2.
*
* Returns: The number of samples in playback buffer.
*/
unsigned audioapi_voice_p_status2();
unsigned voice_p_status2();
/**
* Get the voice channel record status register.
*
* Returns: The number of samples in capture buffer.
*/
unsigned audioapi_voice_r_status();
unsigned voice_r_status();
/**
* Play sound on voice channel.
*
* Parameter samples: The samples to play.
* Parameter count: Number of samples to play. Must be less than number of samples free for playback.
*/
void audioapi_play_voice(float* samples, size_t count);
void play_voice(float* samples, size_t count);
/**
* Capture sound on voice channel.
*
* Parameter samples: The buffer to store captured samples to.
* Parameter count: Number of samples to capture. Must be less than number of samples used for capture.
*/
void audioapi_record_voice(float* samples, size_t count);
void record_voice(float* samples, size_t count);
/**
* Init the audio. Call on emulator startup.
*/
void audioapi_init();
void init();
/**
* Quit the audio. Call on emulator shutdown.
*/
void audioapi_quit();
void quit();
/**
* Set music volume.
*
* Parameter volume: The volume (0-1).
*/
void audioapi_music_volume(float volume);
void music_volume(float volume);
/**
* Get music volume.
*
* Returns: The music volume.
*/
float audioapi_music_volume();
float music_volume();
/**
* Set voice playback volume.
*
* Parameter volume: The volume (0-1).
*/
void audioapi_voicep_volume(float volume);
void voicep_volume(float volume);
/**
* Get voice playback volume.
*
* Returns: The voice playback volume.
*/
float audioapi_voicep_volume();
float voicep_volume();
/**
* Set voice capture volume.
*
* Parameter volume: The volume (0-1).
*/
void audioapi_voicer_volume(float volume);
void voicer_volume(float volume);
/**
* Get voice capture volume.
*
* Returns: The voice capture volume.
*/
float audioapi_voicer_volume();
//The following are intender to be used by the driver.
/**
* Set dummy CB enable flag.
*
* Parameter enable: The new state for enable flag.
*
* Note: Dummy CB enable should be set when the audio driver itself does not have active CB running.
* Note: After negative edge, reprogram voice rate.
*/
void audioapi_set_dummy_cb(bool enable);
float voicer_volume();
//The following are intended to be used by the driver from the callback
/**
* Get mixed music + voice buffer to play (at voice rate).
*
@ -177,8 +193,7 @@ void audioapi_set_dummy_cb(bool enable);
* Parameter count: Number of samples to generate.
* Parameter stereo: If true, return stereo buffer, else mono.
*/
void audioapi_get_mixed(int16_t* samples, size_t count, bool stereo);
void get_mixed(int16_t* samples, size_t count, bool stereo);
/**
* Get music channel buffer to play.
*
@ -187,8 +202,7 @@ void audioapi_get_mixed(int16_t* samples, size_t count, bool stereo);
*
* Note: This should only be called from the sound driver.
*/
struct audioapi_buffer audioapi_get_music(size_t played);
struct buffer get_music(size_t played);
/**
* Get voice channel buffer to play.
*
@ -197,8 +211,7 @@ struct audioapi_buffer audioapi_get_music(size_t played);
*
* Note: This should only be called from the sound driver.
*/
void audioapi_get_voice(float* samples, size_t count);
void get_voice(float* samples, size_t count);
/**
* Put recorded voice channel buffer.
*
@ -208,69 +221,66 @@ void audioapi_get_voice(float* samples, size_t count);
* Note: Even if audio driver does not support capture, one should send in silence.
* Note: This should only be called from the sound driver.
*/
void audioapi_put_voice(float* samples, size_t count);
void put_voice(float* samples, size_t count);
/**
* Set the voice channel playback/record rate.
*
* Parameter rate: The rate in samples per second.
* Parameter rate_r: The recording rate in samples per second.
* Parameter rate_p: The playback rate in samples per second.
*
* Note: This should only be called from the sound driver.
* Note: Setting rate to 0 enables dummy callbacks.
*/
void audioapi_voice_rate(unsigned rate);
//All the following need to be implemented by the sound driver itself
void voice_rate(unsigned rate_r, unsigned rate_p);
/**
* Initialize the driver.
* Suppress all future VU updates.
*/
void audioapi_driver_init() throw();
static void disable_vu_updates();
//Vu values.
vumeter vu_mleft;
vumeter vu_mright;
vumeter vu_vout;
vumeter vu_vin;
private:
struct dummy_cb_proc
{
dummy_cb_proc(audioapi_instance& _parent);
int operator()();
audioapi_instance& parent;
};
dummy_cb_proc dummyproc;
threads::thread* dummythread;
//3 music buffers is not enough due to huge blocksizes used by SDL.
const static unsigned MUSIC_BUFFERS = 8;
const static unsigned voicep_bufsize = 65536;
const static unsigned voicer_bufsize = 65536;
const static unsigned music_bufsize = 8192;
float voicep_buffer[voicep_bufsize];
float voicer_buffer[voicer_bufsize];
int16_t music_buffer[MUSIC_BUFFERS * music_bufsize];
volatile bool music_stereo[MUSIC_BUFFERS];
volatile double music_rate[MUSIC_BUFFERS];
volatile size_t music_size[MUSIC_BUFFERS];
unsigned music_ptr;
unsigned last_complete_music_seen;
volatile unsigned last_complete_music;
volatile unsigned voicep_get;
volatile unsigned voicep_put;
volatile unsigned voicer_get;
volatile unsigned voicer_put;
volatile unsigned voice_rate_play;
volatile unsigned orig_voice_rate_play;
volatile unsigned voice_rate_rec;
volatile bool dummy_cb_active_record;
volatile bool dummy_cb_active_play;
volatile bool dummy_cb_quit;
volatile float _music_volume;
volatile float _voicep_volume;
volatile float _voicer_volume;
resampler music_resampler;
bool last_adjust; //Adjusting consequtively is too hard.
static bool vu_disabled;
};
/**
* Deinitialize the driver.
*/
void audioapi_driver_quit() throw();
/**
* Enable or disable sound.
*
* parameter enable: Enable sounds if true, otherwise disable sounds.
*/
void audioapi_driver_enable(bool enable) throw();
/**
* Has the sound system been successfully initialized?
*
* Returns: True if sound system has successfully initialized, false otherwise.
*/
bool audioapi_driver_initialized();
/**
* Set sound device.
*
* - If new sound device is invalid, the sound device is not changed.
*
* Parameter dev: The new sound device.
*/
void audioapi_driver_set_device(const std::string& dev) throw(std::bad_alloc, std::runtime_error);
/**
* Get current sound device.
*
* Returns: The current sound device.
*/
std::string audioapi_driver_get_device() throw(std::bad_alloc);
/**
* Get available sound devices.
*
* Returns: The map of devices. Keyed by name of the device, values are human-readable names for devices.
*/
std::map<std::string, std::string> audioapi_driver_get_devices() throw(std::bad_alloc);
/**
* Identification for sound plugin.
*/
extern const char* audioapi_driver_name;
#endif

View file

@ -1,11 +1,31 @@
#ifndef _command__hpp__included__
#define _command__hpp__included__
#include "library/command.hpp"
#include "library/threads.hpp"
#include <stdexcept>
#include <string>
#include <set>
#include "library/commands.hpp"
extern command_group lsnes_cmd;
extern command::set lsnes_cmds;
namespace keyboard
{
class mapper;
class invbind;
}
class alias_binds_manager
{
public:
alias_binds_manager(keyboard::mapper& _mapper, command::group& _command);
~alias_binds_manager();
void operator()();
private:
keyboard::mapper& mapper;
command::group& command;
threads::lock mut;
std::map<std::string, keyboard::invbind*> alias_binds;
};
#endif

View file

@ -1,11 +1,154 @@
#ifndef _controller__hpp__included__
#define _controller__hpp__included__
#include "controllerframe.hpp"
#include <string>
#include <map>
#include "library/dispatch.hpp"
#include "library/command.hpp"
struct project_info;
struct controller_state;
struct emu_framebuffer;
struct emulator_dispatch;
struct lua_state;
struct core_core;
namespace keyboard { class invbind; }
namespace keyboard { class ctrlrkey; }
namespace keyboard { class mapper; }
namespace keyboard { class keyboard; }
namespace portctrl { struct type; }
namespace portctrl { struct controller; }
class button_mapping
{
public:
struct controller_bind
{
std::string cclass;
unsigned number;
std::string name;
int mode; //0 => Button, 1 => Axis pair, 2 => Single axis.
bool xrel;
bool yrel;
unsigned control1;
unsigned control2; //Axis only, UINT_MAX if not valid.
int16_t rmin;
int16_t rmax;
bool centered;
};
struct active_bind
{
unsigned port;
unsigned controller;
struct controller_bind bind;
};
struct controller_triple
{
std::string cclass;
unsigned port;
unsigned controller;
bool operator<(const struct controller_triple& t) const throw()
{
if(cclass < t.cclass) return true;
if(cclass > t.cclass) return false;
if(port < t.port) return true;
if(port > t.port) return false;
if(controller < t.controller) return true;
if(controller > t.controller) return false;
return false;
}
bool operator==(const struct controller_triple& t) const throw()
{
return (cclass == t.cclass && port == t.port && controller == t.controller);
}
};
/**
* Ctor.
*/
button_mapping(controller_state& _controls, keyboard::mapper& mapper, keyboard::keyboard& keyboard,
emu_framebuffer& fbuf, emulator_dispatch& _dispatch, lua_state& _lua2, command::group& _cmd);
/**
* Dtor.
*/
~button_mapping();
/**
* Reread active buttons.
*/
void reread();
/**
* Reinitialize buttons.
*/
void reinit();
/**
* Load macros.
*/
void load(controller_state& ctrlstate);
/**
* Load macros (from project).
*/
void load(controller_state& ctrlstate, project_info& pinfo);
/**
* Cleanup memory used.
*/
void cleanup();
/**
* Lookup button by name.
*/
std::pair<int, int> byname(const std::string& name);
/**
* Map of button keys.
*/
std::map<std::string, std::string> button_keys;
private:
void do_analog_action(const std::string& a);
void do_autofire_action(const std::string& a, int mode);
void do_action(const std::string& name, short state, int mode);
void promote_key(keyboard::ctrlrkey& k);
void add_button(const std::string& name, const controller_bind& binding);
void process_controller(portctrl::controller& controller, unsigned number);
void process_controller(std::map<std::string, unsigned>& allocated,
std::map<controller_triple, unsigned>& assigned, portctrl::controller& controller, unsigned port,
unsigned number_in_port);
void process_port(std::map<std::string, unsigned>& allocated,
std::map<controller_triple, unsigned>& assigned, unsigned port, portctrl::type& ptype);
void init();
bool check_button_active(const std::string& name);
void do_button_action(const std::string& name, short newstate, int mode);
void send_analog(const std::string& name, int32_t x, int32_t y);
std::map<std::string, keyboard::invbind*> macro_binds;
std::map<std::string, keyboard::invbind*> macro_binds2;
std::map<std::string, controller_bind> all_buttons;
std::map<std::string, active_bind> active_buttons;
std::map<std::string, keyboard::ctrlrkey*> added_keys;
std::set<core_core*> cores_done;
bool promote_autohold;
bool promote_autofire;
bool promote_typed;
controller_state& controls;
keyboard::mapper& mapper;
keyboard::keyboard& keyboard;
emu_framebuffer& fbuf;
emulator_dispatch& edispatch;
lua_state& lua2;
command::group& cmd;
struct dispatch::target<> ncore;
command::_fnptr<const std::string&> button_p;
command::_fnptr<const std::string&> button_r;
command::_fnptr<const std::string&> button_h;
command::_fnptr<const std::string&> button_t;
command::_fnptr<const std::string&> button_d;
command::_fnptr<const std::string&> button_ap;
command::_fnptr<const std::string&> button_ar;
command::_fnptr<const std::string&> button_at;
command::_fnptr<const std::string&> button_a;
command::_fnptr<> afire_p;
command::_fnptr<> afire_n;
command::_fnptr<> ahold_p;
command::_fnptr<> ahold_n;
command::_fnptr<> typed_p;
command::_fnptr<> typed_n;
};
void reread_active_buttons();
void reinitialize_buttonmap();
extern controller_state controls;
extern std::map<std::string, std::string> button_keys;
#endif

View file

@ -15,13 +15,15 @@
#include <vector>
#include <map>
#include <list>
#include "library/controller-data.hpp"
/**
* Analog indices.
*/
#define MAX_ANALOG 3
#include "library/portctrl-data.hpp"
#include "library/command.hpp"
#include "library/threads.hpp"
class project_state;
class movie_logic;
class button_mapping;
class emulator_dispatch;
class status_updater;
/**
* Controllers state.
@ -32,7 +34,8 @@ public:
/**
* Constructor.
*/
controller_state() throw();
controller_state(project_state& _project, movie_logic& _mlogic, button_mapping& _buttons,
emulator_dispatch& _dispatch, status_updater& _supdater, command::group& _cmd) throw();
/**
* Convert lcid (Logical Controller ID) into pcid (Physical Controler ID).
*
@ -62,37 +65,29 @@ public:
* Parameter ptype: The new types for ports.
* Throws std::runtime_error: Illegal port type.
*/
void set_ports(const port_type_set& ptype) throw(std::runtime_error);
void set_ports(const portctrl::type_set& ptype) throw(std::runtime_error);
/**
* Get status of current controls (with autohold/autofire factored in).
*
* Parameter framenum: Number of current frame (for evaluating autofire).
* Returns: The current controls.
*/
controller_frame get(uint64_t framenum) throw();
/**
* Commit given controls (autohold/autofire is factored in).
*
* Parameter framenum: Number of current frame (for evaluating autofire).
* Returns: The committed controls.
*/
controller_frame commit(uint64_t framenum) throw();
portctrl::frame get(uint64_t framenum) throw();
/**
* Commit given controls (autohold/autofire is ignored).
*
* Parameter controls: The controls to commit
* Returns: The committed controls.
*/
controller_frame commit(controller_frame controls) throw();
void commit(portctrl::frame controls) throw();
/**
* Get status of committed controls.
* Returns: The committed controls.
*/
controller_frame get_committed() throw();
portctrl::frame get_committed() throw();
/**
* Get blank frame.
*/
controller_frame get_blank() throw();
portctrl::frame get_blank() throw();
/**
* Send analog input to given controller.
*
@ -161,34 +156,95 @@ public:
*/
bool button2(unsigned port, unsigned controller, unsigned pbid) throw();
/**
* Set autofire pattern.
* Manipulate autofire.
*
* Parameter pattern: The new pattern.
* Throws std::bad_alloc: Not enough memory.
* Parameter port: The port.
* Parameter controller: The controller.
* Parameter pbid: The physical button ID to manipulate.
* Parameter duty: The new duty cycle for autofire.
* Parameter cyclelen: The new cycle length.
*/
void autofire(std::vector<controller_frame> pattern) throw(std::bad_alloc);
void autofire2(unsigned port, unsigned controller, unsigned pbid, unsigned duty, unsigned cyclelen) throw();
/**
* Query autofire.
*
* Parameter port: The port.
* Parameter controller: The controller.
* Parameter pbid: The physical button ID to query.
* Returns: The state of autofire.
*/
std::pair<unsigned, unsigned> autofire2(unsigned port, unsigned controller, unsigned pbid) throw();
/**
* Manipulate TASinput.
*
* Parameter port: The port.
* Parameter controller: The controller.
* Parameter pbid: The physical button ID to manipulate.
* Parameter state: The new state.
*/
void tasinput(unsigned port, unsigned controller, unsigned pbid, int16_t state) throw();
/**
* Query tasinput.
*
* Parameter port: The port.
* Parameter controller: The controller.
* Parameter pbid: The physical button ID to query.
* Returns: The state of tasinput.
*/
int16_t tasinput(unsigned port, unsigned controller, unsigned pbid) throw();
/**
* Enage/Disenage tasinput.
*/
void tasinput_enable(bool enabled);
/**
* TODO: Document.
*/
bool is_present(unsigned port, unsigned controller) throw();
void erase_macro(const std::string& macro);
std::set<std::string> enumerate_macro();
portctrl::macro& get_macro(const std::string& macro);
void set_macro(const std::string& macro, const portctrl::macro& m);
void apply_macro(portctrl::frame& f);
void rename_macro(const std::string& old, const std::string& newn);
std::set<std::string> active_macro_set();
void advance_macros();
std::map<std::string, uint64_t> get_macro_frames();
void set_macro_frames(const std::map<std::string, uint64_t>& f);
private:
const port_type_set* types;
controller_frame _input;
controller_frame _autohold;
controller_frame _framehold;
controller_frame _committed;
std::vector<controller_frame> _autofire;
void do_macro(const std::string& a, int mode);
struct autofire_info
{
uint64_t first_frame;
unsigned duty;
unsigned cyclelen;
bool eval_at(uint64_t frame);
};
struct tasinput_info
{
int mode;
int16_t state;
};
void reread_tasinput_mode(const portctrl::type_set& ptype);
const portctrl::type_set* types;
portctrl::frame _input;
portctrl::frame _autohold;
portctrl::frame _framehold;
std::map<unsigned, autofire_info> _autofire;
std::map<unsigned, tasinput_info> _tasinput;
bool tasinput_enaged;
portctrl::frame _committed;
std::map<std::string, portctrl::macro> all_macros;
std::list<std::pair<uint64_t, portctrl::macro*>> active_macros;
threads::lock macro_lock;
project_state& project;
movie_logic& mlogic;
button_mapping& buttons;
emulator_dispatch& edispatch;
status_updater& supdater;
command::group& cmd;
command::_fnptr<const std::string&> macro_p;
command::_fnptr<const std::string&> macro_r;
command::_fnptr<const std::string&> macro_t;
};
/**
* Generic port controller name function.
*/
template<unsigned controllers, const char** name>
inline const char* generic_controller_name(unsigned controller)
{
if(controller >= controllers)
return NULL;
return *name;
}
#endif

203
include/core/debug.hpp Normal file
View file

@ -0,0 +1,203 @@
#ifndef _debug__hpp__included__
#define _debug__hpp__included__
#include <functional>
#include <fstream>
#include <cstdint>
#include "library/command.hpp"
#include "library/dispatch.hpp"
class emulator_dispatch;
class loaded_rom;
class memory_space;
/**
* Debugging context.
*/
class debug_context
{
public:
debug_context(emulator_dispatch& _dispatch, loaded_rom& _rom, memory_space& _mspace, command::group& _cmd);
/**
* Type of event.
*/
enum etype
{
DEBUG_READ,
DEBUG_WRITE,
DEBUG_EXEC,
DEBUG_TRACE,
DEBUG_FRAME,
};
/**
* Parameters for read/write/execute event.
*/
struct params_rwx
{
uint64_t addr; //Address.
uint64_t value; //Value/CPU.
};
/**
* Parameters for trace event.
*/
struct params_trace
{
uint64_t cpu; //CPU number.
const char* decoded_insn; //Decoded instruction
bool true_insn; //True instruction flag.
};
/**
* Parameters for frame event.
*/
struct params_frame
{
uint64_t frame; //Frame number.
bool loadstated; //Loadstate flag.
};
/**
* Parameters for debug callback.
*/
struct params
{
etype type;
union {
params_rwx rwx; //READ/WRITE/EXECUTE
params_trace trace; //TRACE.
params_frame frame; //FRAME.
};
};
/**
* Base class of debugging callbacks.
*/
struct callback_base
{
/**
* Destructor.
*/
virtual ~callback_base();
/**
* Do a callback.
*/
virtual void callback(const params& p) = 0;
/**
* Notify about killed callback.
*/
virtual void killed(uint64_t addr, etype type) = 0;
};
/**
* Placeholder for all addresses.
*/
static const uint64_t all_addresses;
/**
* Add a callback.
*/
void add_callback(uint64_t addr, etype type, callback_base& cb);
/**
* Remove a callback.
*/
void remove_callback(uint64_t addr, etype type, callback_base& cb);
/**
* Fire a read callback.
*/
void do_callback_read(uint64_t addr, uint64_t value);
/**
* Fire a write callback.
*/
void do_callback_write(uint64_t addr, uint64_t value);
/**
* Fire a exec callback.
*/
void do_callback_exec(uint64_t addr, uint64_t value);
/**
* Fire a trace callback.
*/
void do_callback_trace(uint64_t cpu, const char* str, bool true_insn = true);
/**
* Fire a frame callback.
*/
void do_callback_frame(uint64_t frame, bool loadstate);
/**
* Set a cheat.
*/
void set_cheat(uint64_t addr, uint64_t value);
/**
* Clear a cheat.
*/
void clear_cheat(uint64_t addr);
/**
* Set execute callback mask.
*/
void setxmask(uint64_t mask);
/**
* Set tracelog file.
*/
void tracelog(uint64_t cpu, const std::string& filename);
/**
* Tracelogging on?
*/
bool is_tracelogging(uint64_t cpu);
/**
* Change tracelog change callback.
*/
void set_tracelog_change_cb(std::function<void()> cb);
/**
* Notify a core change.
*/
void core_change();
/**
* Request a break.
*/
void request_break();
//These are public only for some debugging stuff.
typedef std::list<callback_base*> cb_list;
std::map<uint64_t, cb_list> read_cb;
std::map<uint64_t, cb_list> write_cb;
std::map<uint64_t, cb_list> exec_cb;
std::map<uint64_t, cb_list> trace_cb;
std::map<uint64_t, cb_list> frame_cb;
private:
void do_showhooks();
void do_genevent(const std::string& a);
void do_tracecmd(const std::string& a);
cb_list dummy_cb; //Always empty.
uint64_t xmask = 1;
std::function<void()> tracelog_change_cb;
emulator_dispatch& edispatch;
loaded_rom& rom;
memory_space& mspace;
command::group& cmd;
struct dispatch::target<> corechange;
bool corechange_r = false;
bool requesting_break = false;
command::_fnptr<> showhooks;
command::_fnptr<const std::string&> genevent;
command::_fnptr<const std::string&> tracecmd;
struct tracelog_file : public callback_base
{
std::ofstream stream;
std::string full_filename;
unsigned refcnt;
tracelog_file(debug_context& parent);
~tracelog_file();
void callback(const params& p);
void killed(uint64_t addr, etype type);
private:
debug_context& parent;
};
std::map<uint64_t, tracelog_file*> trace_outputs;
std::map<uint64_t, cb_list>& get_lists(etype type)
{
switch(type) {
case DEBUG_READ: return read_cb;
case DEBUG_WRITE: return write_cb;
case DEBUG_EXEC: return exec_cb;
case DEBUG_TRACE: return trace_cb;
case DEBUG_FRAME: return frame_cb;
default: throw std::runtime_error("Invalid debug callback type");
}
}
};
#endif

View file

@ -1,8 +1,8 @@
#ifndef _dispatch__hpp__included__
#define _dispatch__hpp__included__
#include "core/keymapper.hpp"
#include "library/framebuffer.hpp"
#include "library/dispatch.hpp"
#include <cstdint>
#include <string>
@ -10,388 +10,32 @@
#include <set>
#include <map>
/**
* Video data region is NTSC.
*/
#define VIDEO_REGION_NTSC 0
/**
* Video data region is PAL.
*/
#define VIDEO_REGION_PAL 1
/**
* Information about run.
*/
struct gameinfo_struct
struct emulator_dispatch
{
public:
/**
* Construct game info.
*/
gameinfo_struct() throw(std::bad_alloc);
/**
* Game name.
*/
std::string gamename;
/**
* Run length in seconds.
*/
double length;
/**
* Rerecord count (base 10 ASCII)
*/
std::string rerecords;
/**
* Authors. The first components are real names, the second components are nicknames. Either (but not both) may be
* blank.
*/
std::vector<std::pair<std::string, std::string>> authors;
/**
* Format human-redable representation of the length.
*
* Parameter digits: Number of sub-second digits to use.
* Returns: The time formated.
* Throws std::bad_alloc: Not enough memory.
*/
std::string get_readable_time(unsigned digits) const throw(std::bad_alloc);
/**
* Get number of authors.
*
* Returns: Number of authors.
*/
size_t get_author_count() const throw();
/**
* Get short name of author (nickname if present, otherwise full name).
*
* Parameter idx: Index of author (0-based).
* Returns: The short name.
* Throws std::bad_alloc: Not enough memory.
*/
std::string get_author_short(size_t idx) const throw(std::bad_alloc);
/**
* Get rerecord count as a number. If rerecord count is too high, returns the maximum representatible count.
*
* Returns: The rerecord count.
*/
uint64_t get_rerecords() const throw();
emulator_dispatch();
void set_error_streams(std::ostream* stream);
dispatch::source<> autohold_reconfigure;
dispatch::source<unsigned, unsigned, unsigned, bool> autohold_update;
dispatch::source<unsigned, unsigned, unsigned, unsigned, unsigned> autofire_update;
dispatch::source<> close;
dispatch::source<std::pair<std::string, std::string>> sound_change;
dispatch::source<> screen_update;
dispatch::source<> status_update;
dispatch::source<bool> sound_unmute;
dispatch::source<bool> mode_change;
dispatch::source<> core_change;
dispatch::source<> title_change;
dispatch::source<> branch_change;
dispatch::source<> mbranch_change;
dispatch::source<bool> core_changed;
dispatch::source<> voice_stream_change;
dispatch::source<> vu_change;
dispatch::source<> subtitle_change;
dispatch::source<unsigned, unsigned, int> multitrack_change;
dispatch::source<> action_update;
};
extern dispatch::source<> notify_new_core;
/**
* Information dispatch.
*
* This class handles dispatching information between the components of the emulator.
*
* Each kind of information has virtual method on_foo() which can be overridden to handle events of that type, and
* static method do_foo(), which calls on_foo on all known objects.
*
* The information is delivered to each instance of this class.
*/
class information_dispatch
{
public:
/**
* Create new object to receive information dispatch events.
*
* Parameter name: The name for the object.
* Throws std::bad_alloc: Not enough memory.
*/
information_dispatch(const std::string& name) throw(std::bad_alloc);
/**
* Destroy object.
*/
~information_dispatch() throw();
/**
* Window close event received (this is not emulator close!)
*
* The default handler does nothing.
*/
virtual void on_close();
/**
* Call all on_close() handlers.
*/
static void do_close() throw();
/**
* Sound mute/unmute status might have been changed.
*
* The default handler does nothing.
*
* Parameter unmuted: If true, the sound is now enabled. If false, the sound is now disabled.
*/
virtual void on_sound_unmute(bool unmuted);
/**
* Call all on_sound_unmute() handlers.
*/
static void do_sound_unmute(bool unmuted) throw();
/**
* Sound device might have been changed.
*
* The default handler does nothing.
*
* Parameter dev: The device name sound is now playing (if enabled) from.
*/
virtual void on_sound_change(const std::string& dev);
/**
* Call all on_sound_change() handlers.
*/
static void do_sound_change(const std::string& dev) throw();
/**
* Emulator mode might have been changed.
*
* The default handler does nothing.
*
* Parameter readonly: True if readonly mode is now active, false if now in readwrite mode.
*/
virtual void on_mode_change(bool readonly);
/**
* Call all on_mode_change() handlers.
*/
static void do_mode_change(bool readonly) throw();
/**
* Autohold on button might have been changed.
*
* The default handler does nothing.
*
* Parameter port: The port.
* Parameter controller: The controller
* Parameter ctrlnum: Physical control number (0-15).
* Parameter newstate: True if autohold is now active, false if autohold is now inactive.
*/
virtual void on_autohold_update(unsigned port, unsigned controller, unsigned ctrlnum, bool newstate);
/**
* Call all on_autohold_update() handlers.
*/
static void do_autohold_update(unsigned port, unsigned controller, unsigned ctrlnum, bool newstate) throw();
/**
* Controller configuration may have been changed.
*
* The default handler does nothing.
*/
virtual void on_autohold_reconfigure();
/**
* Call all on_autohold_reconfigure() handlers.
*/
static void do_autohold_reconfigure() throw();
/**
* A raw frame has been received.
*
* The default handler does nothing.
*
* Parameter raw: The raw frame data. 512*512 element array.
* Parameter hires: True if in hires mode (512 wide), false if not (256-wide).
* Parameter interlaced: True if in interlaced mode (448/478 high), false if not (224/239 high).
* Parameter overscan: True if overscan is active, false if not.
* Parameter region: One of VIDEO_REGION_* contstants, giving the region this frame is from.
*/
virtual void on_raw_frame(const uint32_t* raw, bool hires, bool interlaced, bool overscan, unsigned region);
/**
* Call all on_raw_frame() handlers.
*
* Calls on_new_dumper() on dumpers that had that not yet called.
*/
static void do_raw_frame(const uint32_t* raw, bool hires, bool interlaced, bool overscan, unsigned region)
throw();
/**
* A frame has been received.
*
* The default handler does nothing.
*
* Parameter _frame: The frame object.
* Parameter fps_n: Numerator of current video fps.
* Parameter fps_d: Denominator of current video fps.
*/
virtual void on_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d);
/**
* Call all on_frame() handlers.
*
* Calls on_new_dumper() on dumpers that had that not yet called.
*/
static void do_frame(struct framebuffer_raw& _frame, uint32_t fps_n, uint32_t fps_d) throw();
/**
* A sample has been received.
*
* The default handler does nothing.
*
* Parameter l: The left channel sample (16 bit signed).
* Parameter r: The right channel sample (16 bit signed).
*/
virtual void on_sample(short l, short r);
/**
* Call all on_sample() handlers.
*
* Calls on_new_dumper() on dumpers that had that not yet called.
*/
static void do_sample(short l, short r) throw();
/**
* Dump is ending.
*
* Calls on_new_dumper() on dumpers that had that not yet called.
*
* The default handler does nothing.
*/
virtual void on_dump_end();
/**
* Call all on_dump_end() handlers.
*/
static void do_dump_end() throw();
/**
* Sound sampling rate is changing
*
* The default handler prints warning if dumper flag is set.
*
* Parameter rate_n: Numerator of the new sampling rate in Hz.
* Parameter rate_d: Denominator of the new sampling rate in Hz.
*/
virtual void on_sound_rate(uint32_t rate_n, uint32_t rate_d);
/**
* Call all on_sound_rate() methods and save the parameters.
*
* Calls on_new_dumper() on dumpers that had that not yet called.
*/
static void do_sound_rate(uint32_t rate_n, uint32_t rate_d) throw();
/**
* Get the sound rate most recently set by on_sound_rate().
*
* Returns: The first component is the numerator, the second is the denominator.
*/
static std::pair<uint32_t, uint32_t> get_sound_rate() throw();
/**
* Game information is changing.
*
* The default handler does nothing.
*
* Parameter gi: The new game info.
*/
virtual void on_gameinfo(const struct gameinfo_struct& gi);
/**
* Call all on_gameinfo() handlers and save the gameinfo.
*/
static void do_gameinfo(const struct gameinfo_struct& gi) throw();
/**
* Get the gameinfo most recently set by do_gameinfo().
*
* Returns: The gameinfo.
*/
static const struct gameinfo_struct& get_gameinfo() throw();
/**
* Return the dumper flag for this dispatch target.
*
* The default implementation returns false.
*
* If dumper flag is set:
* - on_sound_rate() default handler prints a warning.
* - All dumping related do_* functions triggers calls to to on_new_dumper() on all handlers the next time they
* are called.
* - Destroying the handler triggers calls to on_destroy_dumper() on all handlers (if on_new_dumper() has been
* called).
*/
virtual bool get_dumper_flag() throw();
/**
* Notify that a new dumper is joining.
*
* Parameter dumper: The name of the dumper object.
*/
virtual void on_new_dumper(const std::string& dumper);
/**
* Notify that a dumper is leaving.
*
* Parameter dumper: The name of the dumper object.
*/
virtual void on_destroy_dumper(const std::string& dumper);
/**
* Get number of active dumpers.
*
* Calls on_new_dumper() on dumpers that had that not yet called.
*
* Returns: The dumper count.
*/
static unsigned get_dumper_count() throw();
/**
* Get set of active dumpers.
*
* Calls on_new_dumper() on dumpers that had that not yet called.
*
* Returns: The set of dumper names.
* Throws std::bad_alloc: Not enough memory.
*/
static std::set<std::string> get_dumpers() throw(std::bad_alloc);
/**
* Get name of target.
*/
const std::string& get_name() throw();
/**
* Render buffer needs to be (possibly) resized, so that graphics plugin can update the mappings.
*
* Default implementation does nothing.
*
* parameter scr: The render buffer object.
*/
virtual void on_set_screen(framebuffer<false>& scr);
/**
* Call on_set_screen on all objects.
*/
static void do_set_screen(framebuffer<false>& scr) throw();
/**
* Notify that new frame is available.
*
* Default implementation does nothing.
*/
virtual void on_screen_update();
/**
* Call on_screen_update() in all objects.
*/
static void do_screen_update() throw();
/**
* Notify that status buffer has been updated.
*
* Default implementation does nothing.
*/
virtual void on_status_update();
/**
* Call on_status_update() in all objects.
*/
static void do_status_update() throw();
/**
* Notify that some dumper has attached, deattached, popped into existence or disappeared.
*
* Default implementation does nothing.
*/
virtual void on_dumper_update();
/**
* Call on_dumper_update on on all objects.
*/
static void do_dumper_update() throw();
/**
* Notify that core changed.
*
* Default implementation does nothing.
*/
virtual void on_core_change();
/**
* Call on_core_change on on all objects.
*/
static void do_core_change() throw();
/**
* Notify that there is a new core.
*
* Default implementation does nothing.
*/
virtual void on_new_core();
/**
* Call on_new_core on on all objects.
*/
static void do_new_core() throw();
protected:
/**
* Call to indicate this target is interested in sound sample data.
*/
void enable_send_sound() throw(std::bad_alloc);
private:
static void update_dumpers(bool nocalls = false) throw();
bool known_if_dumper;
bool marked_as_dumper;
std::string target_name;
bool notified_as_dumper;
};
#endif

View file

@ -0,0 +1,99 @@
#ifndef _emustatus__hpp__included__
#define _emustatus__hpp__included__
#include <stdexcept>
#include <string>
#include <set>
#include <map>
#include "library/command.hpp"
#include "library/triplebuffer.hpp"
class movie_logic;
class project_state;
class voice_commentary;
class emulator_runmode;
class master_dumper;
class save_jukebox;
class slotinfo_cache;
class framerate_regulator;
class controller_state;
class multitrack_edit;
class lua_state;
class loaded_rom;
class memwatch_set;
class emulator_dispatch;
struct _lsnes_status
{
const static int pause_none; //pause: No pause.
const static int pause_normal; //pause: Normal pause.
const static int pause_break; //pause: Break pause.
const static uint64_t subframe_savepoint; //subframe: Point of save.
const static uint64_t subframe_video; //subframe: Point of video output.
bool valid;
bool movie_valid; //The movie state variables are valid?
uint64_t curframe; //Current frame number.
uint64_t length; //Movie length.
uint64_t lag; //Lag counter.
uint64_t subframe; //Subframe number.
bool dumping; //Video dump active.
unsigned speed; //Speed%
bool saveslot_valid; //Save slot number/info valid.
uint64_t saveslot; //Save slot number.
std::u32string slotinfo; //Save slot info.
bool branch_valid; //Branch info valid?
std::u32string branch; //Current branch.
bool mbranch_valid; //Movie branch info valid?
std::u32string mbranch; //Current movie branch.
std::u32string macros; //Currently active macros.
int pause; //Pause mode.
char mode; //Movie mode: C:Corrupt, R:Readwrite, P:Readonly, F:Finished.
bool rtc_valid; //RTC time valid?
std::u32string rtc; //RTC time.
std::vector<std::u32string> inputs; //Input display.
std::map<std::string, std::u32string> mvars; //Memory watches.
std::map<std::string, std::u32string> lvars; //Lua variables.
};
struct slotinfo_cache
{
slotinfo_cache(movie_logic& _mlogic, command::group& _cmd);
std::string get(const std::string& _filename);
void flush(const std::string& _filename);
void flush();
private:
std::map<std::string, std::string> cache;
movie_logic& mlogic;
command::group& cmd;
command::_fnptr<> flushcmd;
};
struct status_updater
{
public:
status_updater(project_state& _project, movie_logic& _mlogic, voice_commentary& _commentary,
triplebuffer::triplebuffer<_lsnes_status>& _status, emulator_runmode& _runmode, master_dumper& _mdumper,
save_jukebox& _jukebox, slotinfo_cache& _slotcache, framerate_regulator& _framerate,
controller_state& _controls, multitrack_edit& _mteditor, lua_state& _lua2, loaded_rom& _rom,
memwatch_set& _mwatch, emulator_dispatch& _dispatch);
void update();
private:
project_state& project;
movie_logic& mlogic;
voice_commentary& commentary;
triplebuffer::triplebuffer<_lsnes_status>& status;
emulator_runmode& runmode;
master_dumper& mdumper;
save_jukebox& jukebox;
slotinfo_cache& slotcache;
framerate_regulator& framerate;
controller_state& controls;
multitrack_edit& mteditor;
lua_state& lua2;
loaded_rom& rom;
memwatch_set& mwatch;
emulator_dispatch& dispatch;
};
#endif

View file

@ -0,0 +1,39 @@
#ifndef _filedownload__hpp__included__
#define _filedownload__hpp__included__
#include "library/threads.hpp"
#include "library/httpreq.hpp"
#include "library/urirewrite.hpp"
#include <string>
#include <list>
#include <vector>
class loaded_rom;
struct file_download
{
//Variables.
std::string url;
std::string target_slot;
//Ctor
file_download();
~file_download();
//Lauch.
void do_async(loaded_rom& rom);
void cancel();
//Status.
volatile bool finished; //This signals download finishing, call finish().
std::string errormsg;
http_async_request req;
std::string statusmsg();
threads::cv cond;
threads::lock m;
//Internal.
void _do_async(loaded_rom& rom);
std::string tempname;
std::string tempname2;
};
extern urirewrite::rewriter lsnes_uri_rewrite;
#endif

View file

@ -0,0 +1,44 @@
#ifndef _fileupload__hpp__included__
#define _fileupload__hpp__included__
#include "library/threads.hpp"
#include "library/httpreq.hpp"
#include "library/httpauth.hpp"
#include <string>
#include <list>
#include <vector>
struct file_upload
{
//Variables.
std::string base_url;
std::vector<char> content;
std::string filename;
std::string title;
std::string description;
std::string gamename;
bool hidden;
//Ctor
file_upload();
~file_upload();
//Lauch.
void do_async();
void _do_async();
void cancel();
//Status.
std::list<std::string> get_messages();
int get_progress_ppm(); //-1 => No progress.
volatile bool finished;
volatile bool success;
std::string final_url;
//Vars.
dh25519_http_auth* dh25519;
http_async_request* req;
std::list<std::string> msgs;
threads::lock m;
void add_msg(const std::string& msg);
};
void get_dh25519_pubkey(uint8_t* out);
#endif

View file

@ -2,96 +2,117 @@
#define _framebuffer__hpp__included__
#include "core/window.hpp"
#include "core/queue.hpp"
#include "library/command.hpp"
#include "library/framebuffer.hpp"
#include "library/triplebuffer.hpp"
#include <stdexcept>
class subtitle_commentary;
class memwatch_set;
class emulator_dispatch;
class lua_state;
class loaded_rom;
class status_updater;
namespace settingvar
{
class group;
}
namespace keyboard
{
class keyboard;
}
/**
* Triple buffering logic.
* Emulator frame buffer.
*/
class triplebuffer_logic
class emu_framebuffer
{
public:
/**
* Create new triple buffer logic.
*/
triplebuffer_logic() throw(std::bad_alloc);
/**
* Destructor.
*/
~triplebuffer_logic() throw();
/**
* Get index for write buffer.Also starts write cycle.
*
* Returns: Write buffer index (0-2).
*/
unsigned start_write() throw();
/**
* Notify that write cycle has ended.
*/
void end_write() throw();
/**
* Get index for read buffer. Also starts read cycle.
*
* Returns: Read buffer index (0-2).
*/
unsigned start_read() throw();
/**
* Notify that read cycle has ended.
*/
void end_read() throw();
private:
triplebuffer_logic(triplebuffer_logic&);
triplebuffer_logic& operator=(triplebuffer_logic&);
mutex* mut;
unsigned read_active;
unsigned write_active;
unsigned read_active_slot;
unsigned write_active_slot;
unsigned last_complete_slot;
};
emu_framebuffer(subtitle_commentary& _subtitles, settingvar::group& _settings, memwatch_set& _mwatch,
keyboard::keyboard& _keyboard, emulator_dispatch& _dispatch, lua_state& _lua2, loaded_rom& _rom,
status_updater& _supdater, command::group& _cmd, input_queue& _iqueue);
/**
* The main framebuffer.
*/
extern framebuffer_raw main_framebuffer;
framebuffer::raw main_framebuffer;
/**
* Special screen: "SYSTEM STATE CORRUPT".
*/
extern framebuffer_raw screen_corrupt;
static framebuffer::raw screen_corrupt;
/**
* The main screen to draw on.
*/
extern framebuffer<false> main_screen;
framebuffer::fb<false> main_screen;
/**
* Initialize special screens.
*
* throws std::bad_alloc: Not enough memory.
*/
void init_special_screens() throw(std::bad_alloc);
static void init_special_screens() throw(std::bad_alloc);
/**
* Copy framebuffer to backing store, running Lua hooks if any.
*/
void redraw_framebuffer(framebuffer_raw& torender, bool no_lua = false, bool spontaneous = false);
void redraw_framebuffer(framebuffer::raw& torender, bool no_lua = false, bool spontaneous = false);
/**
* Redraw the framebuffer, reusing contents from last redraw. Runs lua hooks if last redraw ran them.
*/
void redraw_framebuffer();
void redraw_framebuffer();
/**
* Return last complete framebuffer.
*/
framebuffer_raw get_framebuffer() throw(std::bad_alloc);
framebuffer::raw get_framebuffer() throw(std::bad_alloc);
/**
* Render framebuffer to main screen.
*/
void render_framebuffer();
void render_framebuffer();
/**
* Get the size of current framebuffer.
*/
std::pair<uint32_t, uint32_t> get_framebuffer_size();
std::pair<uint32_t, uint32_t> get_framebuffer_size();
/**
* Take a screenshot to specified file.
*/
void take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error);
void take_screenshot(const std::string& file) throw(std::bad_alloc, std::runtime_error);
/**
* Kill pending requests associated with object.
*/
void render_kill_request(void* obj);
/**
* Get latest screen received from core.
*/
framebuffer::raw& render_get_latest_screen();
void render_get_latest_screen_end();
private:
void do_screenshot(command::arg_filename a);
struct render_info
{
framebuffer::raw fbuf;
framebuffer::queue rq;
uint32_t hscl;
uint32_t vscl;
uint32_t lgap;
uint32_t rgap;
uint32_t tgap;
uint32_t bgap;
};
render_info buffer1;
render_info buffer2;
render_info buffer3;
triplebuffer::triplebuffer<render_info> buffering;
bool last_redraw_no_lua;
subtitle_commentary& subtitles;
settingvar::group& settings;
memwatch_set& mwatch;
keyboard::keyboard& keyboard;
emulator_dispatch& edispatch;
lua_state& lua2;
loaded_rom& rom;
status_updater& supdater;
command::group& cmd;
input_queue& iqueue;
command::_fnptr<command::arg_filename> screenshot;
};
#endif

View file

@ -2,41 +2,75 @@
#define _framerate__hpp__included__
#include <cstdint>
#include "library/threads.hpp"
#include "library/command.hpp"
#define FRAMERATE_HISTORY_FRAMES 10
/**
* Framerate regulator.
*/
class framerate_regulator
{
public:
framerate_regulator(command::group& _cmd);
/**
* Set the target speed multiplier.
*
* Parameter multiplier: The multiplier target. May be INFINITE.
*/
void set_speed_multiplier(double multiplier) throw();
/**
* Increase the speed to next step.
*/
void increase_speed() throw();
/**
* Decrease the speed to next step.
*/
void decrease_speed() throw();
/**
* Get the target speed multiplier.
*
* Returns: The multiplier. May be INFINITE.
*/
double get_speed_multiplier() throw();
/**
* Sets the nominal frame rate. Framerate limiting tries to maintain the nominal framerate when there is no other
* explict framerate to maintain.
*/
void set_nominal_framerate(double fps) throw();
void set_nominal_framerate(double fps) throw();
/**
* Returns the current realized framerate.
* Returns the current realized framerate multiplier.
*
* returns: The framerate the system is currently archiving.
* returns: The framerate multiplier the system is currently archiving.
*/
double get_framerate() throw();
double get_realized_multiplier() throw();
/**
* Freeze time.
*
* Parameter usec: Current time in microseconds.
*/
void freeze_time(uint64_t usec);
void freeze_time(uint64_t usec);
/**
* Unfreeze time.
*
* Parameter usec: Current time in microseconds.
*/
void unfreeze_time(uint64_t usec);
void unfreeze_time(uint64_t usec);
/**
* Acknowledge frame start for timing purposes. If time is frozen, it is automatically unfrozen.
*
* parameter usec: Current time (relative to some unknown epoch) in microseconds.
*/
void ack_frame_tick(uint64_t usec) throw();
void ack_frame_tick(uint64_t usec) throw();
/**
* Computes the number of microseconds to wait for next frame.
@ -44,16 +78,48 @@ void ack_frame_tick(uint64_t usec) throw();
* parameter usec: Current time (relative to some unknown epoch) in microseconds.
* returns: Number of more microseconds to wait.
*/
uint64_t to_wait_frame(uint64_t usec) throw();
uint64_t to_wait_frame(uint64_t usec) throw();
/**
* Return microsecond-resolution time since unix epoch.
*/
uint64_t get_utime();
static uint64_t get_utime();
/**
* Wait specified number of microseconds.
*/
void wait_usec(uint64_t usec);
void wait_usec(uint64_t usec);
/**
* Turbo flag.
*/
bool turboed;
private:
void set_speed_cmd(const std::string& args);
uint64_t get_time(uint64_t curtime, bool update);
double get_realized_fps();
void add_frame(uint64_t linear_time);
std::pair<bool, double> read_fps();
//Step should be ODD.
void set_speedstep(unsigned step);
//Step can be EVEN if between steps.
unsigned get_speedstep();
uint64_t last_time_update;
uint64_t time_at_last_update;
bool time_frozen;
uint64_t frame_number;
uint64_t frame_start_times[FRAMERATE_HISTORY_FRAMES];
//Framerate.
double nominal_framerate;
double multiplier_framerate;
bool framerate_realtime_locked;
threads::lock framerate_lock;
command::group& cmd;
command::_fnptr<> turbo_p;
command::_fnptr<> turbo_r;
command::_fnptr<> turbo_t;
command::_fnptr<const std::string&> setspeed_t;
command::_fnptr<> spd_inc;
command::_fnptr<> spd_dec;
};
#endif

View file

@ -0,0 +1,74 @@
#ifndef _instance_map__hpp__included__
#define _instance_map__hpp__included__
#include <map>
class emulator_instance;
template<typename T> class instance_map
{
public:
/**
* Destroy a instance map.
*/
~instance_map()
{
for(auto i : instances)
delete i.second;
instances.clear();
}
/**
* Does this instance exist?
*/
bool exists(emulator_instance& inst)
{
return instances.count(&inst);
}
/**
* Lookup a instance. Returns NULL if none.
*/
T* lookup(emulator_instance& inst)
{
if(!instances.count(&inst))
return NULL;
return instances[&inst];
}
/**
* Create a new instance.
*/
template<typename... U> T* create(emulator_instance& inst, U... args)
{
T* out = NULL;
try {
out = new T(inst, args...);
instances[&inst] = out;
return out;
} catch(...) {
if(out) delete out;
throw;
}
}
/**
* Erase a instance.
*/
void destroy(emulator_instance& inst)
{
if(instances.count(&inst)) {
delete instances[&inst];
instances.erase(&inst);
}
}
/**
* Remove a instance.
*/
void remove(emulator_instance& inst)
{
if(instances.count(&inst)) {
instances.erase(&inst);
}
}
private:
std::map<emulator_instance*, T*> instances;
};
#endif

142
include/core/instance.hpp Normal file
View file

@ -0,0 +1,142 @@
#ifndef _instance__hpp__included__
#define _instance__hpp__included__
#include "library/threads.hpp"
class movie_logic;
class memory_space;
class memwatch_set;
class voice_commentary;
class subtitle_commentary;
class movie_branches;
class multitrack_edit;
class _lsnes_status;
class alias_binds_manager;
class rrdata;
class cart_mappings_refresher;
class controller_state;
class project_state;
class debug_context;
class framerate_regulator;
class emu_framebuffer;
class input_queue;
class master_dumper;
class button_mapping;
class emulator_dispatch;
class slotinfo_cache;
class lua_state;
class audioapi_instance;
class loaded_rom;
class save_jukebox;
class emulator_runmode;
class status_updater;
namespace command { class group; }
namespace lua { class state; }
namespace settingvar { class group; }
namespace settingvar { class cache; }
namespace keyboard { class keyboard; }
namespace keyboard { class mapper; }
namespace triplebuffer { template<typename T> class triplebuffer; }
class dtor_list
{
struct entry
{
void* ptr;
void (*free1)(void* ptr);
void (*free2)(void* ptr);
entry* prev;
};
public:
dtor_list();
~dtor_list();
void destroy();
template<typename T> void prealloc(T*& ptr)
{
entry e;
e.ptr = ptr = reinterpret_cast<T*>(new char[sizeof(T) + 32]);
memset(ptr, 0, sizeof(T) + 32);
e.free1 = null;
e.free2 = free2;
e.prev = list;
list = new entry(e);
}
template<typename T, typename... U> void init(T*& ptr, U&... args)
{
if(ptr) {
//Find the entry.
entry* e = list;
while(e->ptr != ptr)
e = e->prev;
new(ptr) T(args...);
e->free1 = free1_p<T>;
} else {
entry e;
e.ptr = ptr = new T(args...);
e.free1 = free1<T>;
e.free2 = null;
e.prev = list;
list = new entry(e);
}
}
private:
entry* list;
static void null(void* ptr) {}
static void free2(void* ptr) { delete[] reinterpret_cast<char*>(ptr); }
template<typename T> static void free1(void* ptr) { delete reinterpret_cast<T*>(ptr); }
template<typename T> static void free1_p(void* ptr) { reinterpret_cast<T*>(ptr)->~T(); }
};
struct emulator_instance
{
emulator_instance();
~emulator_instance();
emulator_dispatch* dispatch;
movie_logic* mlogic;
memory_space* memory;
lua::state* lua;
lua_state* lua2;
memwatch_set* mwatch;
settingvar::group* settings;
settingvar::cache* setcache;
voice_commentary* commentary;
subtitle_commentary* subtitles;
movie_branches* mbranch;
controller_state* controls;
button_mapping* buttons;
multitrack_edit* mteditor;
_lsnes_status* status_A;
_lsnes_status* status_B;
_lsnes_status* status_C;
triplebuffer::triplebuffer<_lsnes_status>* status;
keyboard::keyboard* keyboard;
command::group* command;
keyboard::mapper* mapper;
alias_binds_manager* abindmanager;
rrdata* nrrdata;
cart_mappings_refresher* cmapper;
project_state* project;
debug_context* dbg;
framerate_regulator* framerate;
emu_framebuffer* fbuf;
input_queue* iqueue;
master_dumper* mdumper;
slotinfo_cache* slotcache;
audioapi_instance* audio;
loaded_rom* rom;
save_jukebox* jukebox;
emulator_runmode* runmode;
status_updater* supdater;
threads::id emu_thread;
time_t random_seed_value;
dtor_list D;
private:
emulator_instance(const emulator_instance&);
emulator_instance& operator=(const emulator_instance&);
};
extern emulator_instance lsnes_instance;
emulator_instance& CORE();
#endif

View file

@ -4,36 +4,60 @@
#include <list>
#include <cstdint>
#include <string>
#include "library/command.hpp"
void voicethread_task();
void voicethread_kill();
void voice_frame_number(uint64_t newframe, double rate);
class emulator_dispatch;
enum external_stream_format
namespace settingvar
{
EXTFMT_OPUSDEMO,
EXTFMT_SOX,
EXTFMT_OGGOPUS
};
class group;
}
struct playback_stream_info
class voice_commentary
{
uint64_t id;
uint64_t base;
uint64_t length;
};
public:
enum external_stream_format
{
EXTFMT_SOX,
EXTFMT_OGGOPUS
};
bool voicesub_collection_loaded();
std::list<playback_stream_info> voicesub_get_stream_info();
void voicesub_play_stream(uint64_t id);
void voicesub_export_stream(uint64_t id, const std::string& filename, external_stream_format fmt);
uint64_t voicesub_import_stream(uint64_t ts, const std::string& filename, external_stream_format fmt);
void voicesub_delete_stream(uint64_t id);
void voicesub_export_superstream(const std::string& filename);
void voicesub_load_collection(const std::string& filename);
void voicesub_unload_collection();
void voicesub_alter_timebase(uint64_t id, uint64_t ts);
uint64_t voicesub_parse_timebase(const std::string& n);
double voicesub_ts_seconds(uint64_t ts);
struct playback_stream_info
{
uint64_t id;
uint64_t base;
uint64_t length;
};
voice_commentary(settingvar::group& _settings, emulator_dispatch& _dispatch, audioapi_instance& _audio,
command::group& _cmd);
~voice_commentary();
void init();
void kill();
void frame_number(uint64_t newframe, double rate);
bool collection_loaded();
std::list<playback_stream_info> get_stream_info();
void play_stream(uint64_t id);
void export_stream(uint64_t id, const std::string& filename, external_stream_format fmt);
uint64_t import_stream(uint64_t ts, const std::string& filename, external_stream_format fmt);
void delete_stream(uint64_t id);
void export_superstream(const std::string& filename);
void load_collection(const std::string& filename);
void unload_collection();
void alter_timebase(uint64_t id, uint64_t ts);
uint64_t parse_timebase(const std::string& n);
double ts_seconds(uint64_t ts);
float get_gain(uint64_t id);
void set_gain(uint64_t id, float gain);
void set_active_flag(bool flag);
private:
void* internal;
settingvar::group& settings;
emulator_dispatch& edispatch;
audioapi_instance& audio;
command::group& cmd;
command::_fnptr<> tangentp;
command::_fnptr<> tangentr;
};
#endif

View file

@ -1,104 +0,0 @@
#ifndef _joystick__hpp__included__
#define _joystick__hpp__included__
#include "core/keymapper.hpp"
/**
* Create a new joystick.
*
* Parameter id: The id of new joystick.
* Parameter xname: The name of new joystick.
*/
void joystick_create(uint64_t id, const std::string& xname);
/**
* Free all joysticks.
*/
void joystick_quit();
/**
* Create a new axis.
*
* Parameter jid: The id of joystick.
* Parameter id: The id of the axis.
* Parameter minv: The minimal calibration value.
* Parameter maxv: The maximal calibration value.
* Parameter xname: The name of axis.
* Parameter atype: The axis type (-1 => Disabled, 0 => Pressure, 1 => Axis).
*/
void joystick_new_axis(uint64_t jid, uint64_t id, int64_t minv, int64_t maxv, const std::string& xname, int atype);
/**
* Create a new button.
*
* Parameter jid: The id of joystick.
* Parameter id: The id of button.
* Parameter xname: The name of button.
* Returns: The number of button.
*/
void joystick_new_button(uint64_t jid, uint64_t id, const std::string& xname);
/**
* Create a new hat from pair of axes.
*
* Parameter jid: The id of joystick.
* Parameter id_x: The id of x axis of the hat.
* Parameter id_y: The id of y axis of the hat.
* Parameter min_dev: The smallest deviation from zero to react to.
* Parameter xname_x: The name of x axis.
* Parameter xname_y: The name of y axis.
* Returns: The number of hat.
*/
void joystick_new_hat(uint64_t jid, uint64_t id_x, uint64_t id_y, int64_t min_dev, const std::string& xname_x,
const std::string& xname_y);
/**
* Create a new hat from POV control.
*
* Parameter jid: The id of joystick.
* Parameter id: The id of POV control.
* Parameter xname: The name of POV control.
* Returns: The number of hat.
*/
void joystick_new_hat(uint64_t jid, uint64_t id, const std::string& xname);
/**
* Report possible change in axis value.
*
* Requests to update unknown axes are ignored.
*
* Parameter jid: The id of joystick.
* Parameter id: The ID of axis.
* Parameter value: The value.
*/
void joystick_report_axis(uint64_t jid, uint64_t id, int64_t value);
/**
* Report possible change in button value.
*
* Requests to update unknown buttons are ignored.
*
* Parameter jid: The id of joystick.
* Parameter id: The ID of button.
* Parameter value: The value.
*/
void joystick_report_button(uint64_t jid, uint64_t id, bool value);
/**
* Report possible change in POV value.
*
* Requests to update unknown POVs are ignored.
*
* Parameter jid: The id of joystick.
* Parameter id: The ID of POV.
* Parameter value: The angle in hundredths of degree clockwise from up, or negative if centered.
*/
void joystick_report_pov(uint64_t jid, uint64_t id, int angle);
/**
* Print message about joystick.
*
* Parameter jid: The joystick id.
*/
void joystick_message(uint64_t jid);
/**
* Get set of all joysticks.
*/
std::set<uint64_t> joystick_set();
/**
* Flush all pending joystick requests.
*/
void joystick_flush();
#endif

View file

@ -0,0 +1,44 @@
#ifndef _joystickapi__hpp__included__
#define _joystickapi__hpp__included__
//These correspond to various joystick_driver_* functions.
struct _joystick_driver
{
void (*init)();
void (*quit)();
void (*thread_fn)();
void (*signal)();
const char* (*name)();
};
struct joystick_driver
{
joystick_driver(_joystick_driver drv);
};
/**
* Joystick initialization function.
*
* - The third initialization function to be called by window_init().
* - The call occurs in the main thread.
* - Implemented by the joystick plugin.
*/
void joystick_driver_init(bool soft = false) throw();
/**
* Joystick quit function.
*
* - The third last quit function to be called by window_quit().
* - The call occurs in the main thread.
* - Implemented by the joystick plugin.
*/
void joystick_driver_quit(bool soft = false) throw();
/**
* Signal the joystick thread to quit.
*/
void joystick_driver_signal() throw();
/**
* Identification for joystick plugin.
*/
const char* joystick_driver_name();
#endif

88
include/core/jukebox.hpp Normal file
View file

@ -0,0 +1,88 @@
#ifndef _jukebox__hpp__included__
#define _jukebox__hpp__included__
#include <functional>
#include <cstdlib>
#include <string>
namespace settingvar { class group; }
class save_jukebox_listener;
/**
* Save jukebox.
*/
class save_jukebox
{
public:
/**
* Ctor.
*/
save_jukebox(settingvar::group& _settings, command::group& _cmd);
/**
* Dtor.
*/
~save_jukebox();
/**
* Get current slot.
*
* Throws std::runtime_exception: No slot selected.
*/
size_t get_slot();
/**
* Set current slot.
*
* Parameter slot: The slot to select.
* Throws std::runtime_exception: Slot out of range.
*/
void set_slot(size_t slot);
/**
* Cycle next slot.
*
* Throws std::runtime_exception: No slot selected.
*/
void cycle_next();
/**
* Cycle previous slot.
*
* Throws std::runtime_exception: No slot selected.
*/
void cycle_prev();
/**
* Get save as binary flag.
*/
bool save_binary();
/**
* Get name of current jukebox slot.
*
* Throws std::runtime_exception: No slot selected.
*/
std::string get_slot_name();
/**
* Set size of jukebox.
*
* Parameter size: The new size.
*/
void set_size(size_t size);
/**
* Set update function.
*/
void set_update(std::function<void()> _update);
/**
* Unset update function.
*/
void unset_update();
private:
void do_slotsel(const std::string& arg);
settingvar::group& settings;
size_t current_slot;
size_t current_size;
std::function<void()> update;
save_jukebox_listener* listener;
command::group& cmd;
command::_fnptr<const std::string&> slotsel;
command::_fnptr<> cycleprev;
command::_fnptr<> cyclenext;
};
#endif

View file

@ -10,20 +10,28 @@
#include <iostream>
#include "misc.hpp"
#include "library/keyboard.hpp"
#include "library/keymapper.hpp"
#include "library/keyboard-mapper.hpp"
#include "library/gamepad.hpp"
/**
* Our keyboard
* Inverse bindings set.
*/
extern keyboard lsnes_kbd;
extern keyboard::invbind_set lsnes_invbinds;
/**
* Our key mapper.
* Gamepad HW.
*/
extern keyboard_mapper lsnes_mapper;
extern gamepad::set lsnes_gamepads;
/**
* Translate axis calibration into mode name.
* Initialize gamepads (need to be called before initializing joysticks).
*/
std::string calibration_to_mode(keyboard_axis_calibration p);
void lsnes_gamepads_init();
/**
* Deinitialize gamepads (need to be called after deinitializing joysticks).
*/
void lsnes_gamepads_deinit();
/**
* Cleanup the keymapper stuff.
*/
void cleanup_keymapper();
#endif

View file

@ -4,6 +4,11 @@
#include "library/loadlib.hpp"
void handle_post_loadlibrary();
void autoload_libraries();
void autoload_libraries(void(*on_error)(const std::string& libname, const std::string& err, bool system) = NULL);
void with_loaded_library(const loadlib::module& l);
bool with_unloaded_library(loadlib::module& l);
std::string loadlib_debug_get_user_library_dir();
std::string loadlib_debug_get_system_library_dir();
#endif

View file

@ -1,6 +1,7 @@
#ifndef _mainloop__hpp__included__
#define _mainloop__hpp__included__
#include "settings.hpp"
#include "rom.hpp"
#include "moviefile.hpp"
#include "movie.hpp"
@ -12,7 +13,7 @@ void main_loop(struct loaded_rom& rom, struct moviefile& settings, bool load_has
throw(std::bad_alloc, std::runtime_error);
std::vector<std::string> get_jukebox_names();
void set_jukebox_names(const std::vector<std::string>& newj);
void update_movie_state();
void init_main_callbacks();
extern std::string msu1_base_path;
/**
@ -23,4 +24,15 @@ extern std::string msu1_base_path;
*/
void mainloop_signal_need_rewind(void* ptr);
void set_stop_at_frame(uint64_t frame = 0);
void switch_projects(const std::string& newproj);
void close_rom();
void load_new_rom(const romload_request& req);
void reload_current_rom();
void do_break_pause();
void convert_break_to_pause();
extern settingvar::supervariable<settingvar::model_bool<settingvar::yes_no>> movie_dflt_binary;
extern settingvar::supervariable<settingvar::model_bool<settingvar::yes_no>> save_dflt_binary;
#endif

32
include/core/mbranch.hpp Normal file
View file

@ -0,0 +1,32 @@
#ifndef _mbranch__hpp__included__
#define _mbranch__hpp__included__
#define MBRANCH_IMPORT_TEXT 0
#define MBRANCH_IMPORT_BINARY 1
#define MBRANCH_IMPORT_MOVIE 2
class emulator_dispatch;
class status_updater;
class movie_logic;
struct movie_branches
{
movie_branches(movie_logic& _mlogic, emulator_dispatch& _dispatch, status_updater& _supdater);
std::string name(const std::string& internal);
std::set<std::string> enumerate();
std::string get();
void set(const std::string& branch);
void _new(const std::string& branch, const std::string& from);
void rename(const std::string& oldn, const std::string& newn);
void _delete(const std::string& branch);
std::set<std::string> _movie_branches(const std::string& filename);
void import_branch(const std::string& filename, const std::string& ibranch, const std::string& branchname,
int mode);
void export_branch(const std::string& filename, const std::string& branchname, bool binary);
private:
movie_logic& mlogic;
emulator_dispatch& edispatch;
status_updater& supdater;
};
#endif

View file

@ -6,10 +6,20 @@
#include <vector>
#include <cstdint>
#include <stdexcept>
#include "library/memoryspace.hpp"
extern memory_space lsnes_memory;
class memory_space;
class movie_logic;
class loaded_rom;
void refresh_cart_mappings() throw(std::bad_alloc);
class cart_mappings_refresher
{
public:
cart_mappings_refresher(memory_space& _mspace, movie_logic& _mlogic, loaded_rom& _rom);
void operator()() throw(std::bad_alloc);
private:
memory_space& mspace;
movie_logic& mlogic;
loaded_rom& rom;
};
#endif

View file

@ -4,11 +4,189 @@
#include <string>
#include <stdexcept>
#include <set>
#include <functional>
#include "library/memorywatch.hpp"
#include "library/json.hpp"
std::string evaluate_watch(const std::string& expr) throw(std::bad_alloc);
std::set<std::string> get_watches() throw(std::bad_alloc);
std::string get_watchexpr_for(const std::string& w) throw(std::bad_alloc);
void set_watchexpr_for(const std::string& w, const std::string& expr) throw(std::bad_alloc);
void do_watch_memory();
class memory_space;
class project_state;
class loaded_rom;
class emu_framebuffer;
namespace framebuffer { class queue; }
#endif
/**
* lsnes memory watch printer variables.
*/
struct memwatch_printer
{
/**
* Ctor.
*/
memwatch_printer();
/**
* Serialize the printer to JSON value.
*/
JSON::node serialize();
/**
* Unserialize the printer from JSON value.
*/
void unserialize(const JSON::node& node);
/**
* Get a printer object corresponding to this object.
*/
GC::pointer<memorywatch::item_printer> get_printer_obj(
std::function<GC::pointer<mathexpr::mathexpr>(const std::string& n)> vars);
//Fields.
enum position_category {
PC_DISABLED,
PC_MEMORYWATCH,
PC_ONSCREEN
} position;
bool cond_enable; //Ignored for disabled.
std::string enabled; //Ignored for disabled.
std::string onscreen_xpos;
std::string onscreen_ypos;
bool onscreen_alt_origin_x;
bool onscreen_alt_origin_y;
bool onscreen_cliprange_x;
bool onscreen_cliprange_y;
std::string onscreen_font; //"" is system default.
int64_t onscreen_fg_color;
int64_t onscreen_bg_color;
int64_t onscreen_halo_color;
};
/**
* lsnes memory watch item.
*/
struct memwatch_item
{
/**
* Ctor.
*/
memwatch_item();
/**
* Serialize the item to JSON value.
*/
JSON::node serialize();
/**
* Unserialize the item from JSON value.
*/
void unserialize(const JSON::node& node);
/**
* Get memory read operator.
*
* If bytes == 0, returns NULL.
*/
mathexpr::operinfo* get_memread_oper(memory_space& memory, loaded_rom& rom);
/**
* Translate compatiblity item.
*/
void compatiblity_unserialize(memory_space& memory, const std::string& item);
//Fields
memwatch_printer printer; //The printer.
std::string expr; //The main expression.
std::string format; //Format.
unsigned bytes; //Number of bytes to read (0 => Not memory read operator).
bool signed_flag; //Is signed?
bool float_flag; //Is float?
int endianess; //Endianess (-1 => little, 0 => host, 1 => Big).
uint64_t scale_div; //Scale divisor.
uint64_t addr_base; //Address base.
uint64_t addr_size; //Address size (0 => All).
};
struct memwatch_set
{
memwatch_set(memory_space& _memory, project_state& _project, emu_framebuffer& _fbuf,
loaded_rom& rom);
/**
* Get the specified memory watch item.
*/
memwatch_item& get(const std::string& name);
/**
* Get the specified memory watch item as JSON serialization.
*
* Parameter name: The item name.
* Parameter printer: JSON pretty-printer to use.
*/
std::string get_string(const std::string& name, JSON::printer* printer = NULL);
/**
* Set the specified memory watch item. Fills the runtime variables.
*
* Parameter name: The name of the new item.
* Parameter item: The item to insert. Fields are shallow-copied.
*/
void set(const std::string& name, memwatch_item& item);
/**
* Set the specified memory watch item from JSON serialization. Fills the runtime variables.
*
* Parameter name: The name of the new item.
* Parameter item: The serialization of item to insert.
*/
void set(const std::string& name, const std::string& item);
/**
* Set multiple items at once.
*
* Parameter list: The list of items.
*/
void set_multi(std::list<std::pair<std::string, memwatch_item>>& list);
/**
* Set multiple items at once from JSON descriptions.
*
* Parameter list: The list of items.
*/
void set_multi(std::list<std::pair<std::string, std::string>>& list);
/**
* Rename a memory watch item.
*
* Parameter oname: The old name.
* Parameter newname: The new name.
* Returns: True on success, false if failed (new item already exists).
*/
bool rename(const std::string& oname, const std::string& newname);
/**
* Delete an item.
*
* Parameter name: The name of the item to delete.
*/
void clear(const std::string& name);
/**
* Delete multiple items.
*
* Parameter names: The names of the items to delete.
*/
void clear_multi(const std::set<std::string>& name);
/**
* Enumerate item names.
*/
std::set<std::string> enumerate();
/**
* Get value of specified memory watch as a string.
*/
std::string get_value(const std::string& name);
/**
* Watch all the items.
*
* Parameter rq: The render queue to use.
*/
void watch(struct framebuffer::queue& rq);
/**
* Get memory watch vars that go to window.
*/
const std::map<std::string, std::u32string>& get_window_vars() { return window_vars; }
private:
void rebuild(std::map<std::string, memwatch_item>& nitems);
std::map<std::string, memwatch_item> items;
std::map<std::string, std::u32string> window_vars;
std::map<std::string, bool> used_memorywatches;
void erase_unused_watches();
void watch_output(const std::string& name, const std::string& value);
memorywatch::set watch_set;
memory_space& memory;
project_state& project;
emu_framebuffer& fbuf;
loaded_rom& rom;
};
#endif

25
include/core/messages.hpp Normal file
View file

@ -0,0 +1,25 @@
#ifndef _messages__hpp__included__
#define _messages__hpp__included__
#include <iostream>
/**
* messages -> window::out().
*/
class messages_relay_class
{
public:
operator std::ostream&() { return getstream(); }
static std::ostream& getstream();
};
template<typename T> inline std::ostream& operator<<(messages_relay_class& x, T value)
{
return messages_relay_class::getstream() << value;
};
inline std::ostream& operator<<(messages_relay_class& x, std::ostream& (*fn)(std::ostream& o))
{
return fn(messages_relay_class::getstream());
};
extern messages_relay_class messages;
#endif

View file

@ -5,57 +5,7 @@
#include <vector>
#include <stdexcept>
#include "library/string.hpp"
/**
* \brief Get random hexes
*
* Get string of random hex characters of specified length.
*
* \param length The number of hex characters to return.
* \return The random hexadecimal string.
* \throws std::bad_alloc Not enough memory.
*/
std::string get_random_hexstring(size_t length) throw(std::bad_alloc);
/**
* \brief Set random seed
*
* This function sets the random seed to use.
*
* \param seed The value to use as seed.
* \throw std::bad_alloc Not enough memory.
*/
void set_random_seed(const std::string& seed) throw(std::bad_alloc);
/**
* \brief Set random seed to (hopefully) unique value
*
* This function sets the random seed to value that should only be used once. Note, the value is not necressarily
* crypto-secure, even if it is unique.
*
* \throw std::bad_alloc Not enough memory.
*/
void set_random_seed() throw(std::bad_alloc);
/**
* \brief Load a ROM.
*
* Given commandline arguments, load a ROM.
*
* \param cmdline The command line.
* \return The loaded ROM set.
* \throws std::bad_alloc Not enough memory.
* \throws std::runtime_error Can't load the ROMset.
*/
struct loaded_rom load_rom_from_commandline(std::vector<std::string> cmdline) throw(std::bad_alloc,
std::runtime_error);
/**
* \brief Dump listing of regions to graphics system messages.
*
* \throws std::bad_alloc Not enough memory.
*/
void dump_region_map() throw(std::bad_alloc);
#include "library/memtracker.hpp"
/**
* \brief Fatal error.
@ -77,29 +27,9 @@ std::string get_config_path() throw(std::bad_alloc);
*/
void OOM_panic();
/**
* messages -> window::out().
*/
class messages_relay_class
{
public:
operator std::ostream&() { return getstream(); }
static std::ostream& getstream();
};
template<typename T> inline std::ostream& operator<<(messages_relay_class& x, T value)
{
return messages_relay_class::getstream() << value;
};
inline std::ostream& operator<<(messages_relay_class& x, std::ostream& (*fn)(std::ostream& o))
{
return fn(messages_relay_class::getstream());
};
extern messages_relay_class messages;
uint32_t gcd(uint32_t a, uint32_t b) throw();
void create_lsnesrc();
/**
* Return hexadecimal representation of address
*/
@ -114,4 +44,19 @@ bool in_global_ctors();
*/
void reached_main();
/**
* Clean up filename from dangerous chars
*/
std::string safe_filename(const std::string& str);
/**
* Mangle some characters ()|/
*/
std::string mangle_name(const std::string& orig);
/**
* Return a new temporary file. The file will be created.
*/
std::string get_temp_file();
#endif

View file

@ -5,10 +5,12 @@
#include <cstdint>
#include <stdexcept>
#include "core/controllerframe.hpp"
#include "core/moviefile.hpp"
#include "library/rrdata.hpp"
#include "library/movie.hpp"
/**
* Class encapsulating bridge logic between bsnes interface and movie code.
* Class encapsulating bridge logic between core interface and movie code.
*/
class movie_logic
{
@ -17,13 +19,41 @@ public:
* Create new bridge.
*/
movie_logic() throw();
/**
* Has movie?
*/
operator bool() throw() { return mov; }
bool operator!() throw() { return !mov; }
/**
* Get the movie instance associated.
*
* returns: The movie instance.
*/
movie& get_movie() throw();
movie& get_movie() throw(std::runtime_error);
/**
* Set the movie instance associated.
*/
void set_movie(movie& _mov, bool free_old = false) throw();
/**
* Get the current movie file.
*/
moviefile& get_mfile() throw(std::runtime_error);
/**
* Set the current movie file.
*/
void set_mfile(moviefile& _mf, bool free_old = false) throw();
/**
* Get current rrdata.
*/
rrdata_set& get_rrdata() throw(std::runtime_error);
/**
* Set current rrdata.
*/
void set_rrdata(rrdata_set& _rrd, bool free_old = false) throw();
/**
* Notify about new frame starting.
@ -47,9 +77,24 @@ public:
*
* parameter subframe: True if this is for subframe update, false if for frame update.
*/
controller_frame update_controls(bool subframe) throw(std::bad_alloc, std::runtime_error);
portctrl::frame update_controls(bool subframe, bool forced = false) throw(std::bad_alloc, std::runtime_error);
/**
* Notify user poll (exit poll advance).
*
* returns: If true, update_controls is forced.
*/
bool notify_user_poll() throw(std::bad_alloc, std::runtime_error);
/**
* Release memory for mov, mf and rrd.
*/
void release_memory();
private:
movie mov;
movie_logic(const movie_logic&);
movie_logic& operator=(const movie_logic&);
movie* mov;
moviefile* mf;
rrdata_set* rrd;
};
#endif

View file

@ -1,39 +1,48 @@
#ifndef _moviedata__hpp__included__
#define _moviedata__hpp__included__
#include "moviefile.hpp"
#include "movie.hpp"
#include "core/emustatus.hpp"
#include "core/moviefile.hpp"
#include "core/movie.hpp"
#include "library/rrdata.hpp"
//Load state, always switch to Readwrite.
#define LOAD_STATE_RW 0
//Load state, never switch to Readwrite.
#define LOAD_STATE_RO 1
//Load state, don't muck with movie data.
#define LOAD_STATE_PRESERVE 2
//Load state, ignoring the actual state.
#define LOAD_STATE_MOVIE 3
//Load state, switch to readwrite if previously there and loaded state is at the end.
#define LOAD_STATE_DEFAULT 4
//Load state, switch to readwrite if previously there.
#define LOAD_STATE_CURRENT 5
//No load state, rewind movie to start.
#define LOAD_STATE_BEGINNING 6
//No load state, reload ROM.
#define LOAD_STATE_ROMRELOAD 7
//Load state, loading everything, switch to readwrite if loaded state is at the end.
#define LOAD_STATE_INITIAL 8
//Load state, along with all branches, switch to readwrite if loaded state is at the end.
#define LOAD_STATE_ALLBRANCH 9
#define SAVE_STATE 0
#define SAVE_MOVIE 1
extern struct moviefile our_movie;
extern struct loaded_rom* our_rom;
extern bool system_corrupt;
std::vector<char>& get_host_memory();
movie& get_movie();
std::string resolve_relative_path(const std::string& path);
std::pair<std::string, std::string> split_author(const std::string& author) throw(std::bad_alloc,
std::runtime_error);
void do_save_state(const std::string& filename) throw(std::bad_alloc, std::runtime_error);
void do_save_movie(const std::string& filename) throw(std::bad_alloc, std::runtime_error);
void do_load_beginning(bool reloading = false) throw(std::bad_alloc, std::runtime_error);
void do_load_state(struct moviefile& _movie, int lmode);
void do_save_state(const std::string& filename, int binary) throw(std::bad_alloc, std::runtime_error);
void do_save_movie(const std::string& filename, int binary) throw(std::bad_alloc, std::runtime_error);
void do_load_rom() throw(std::bad_alloc, std::runtime_error);
void do_load_rewind() throw(std::bad_alloc, std::runtime_error);
void do_load_state(struct moviefile& _movie, int lmode, bool& used);
bool do_load_state(const std::string& filename, int lmode);
std::string translate_name_mprefix(std::string original, bool forio = false);
std::string translate_name_mprefix(std::string original, int& binary, int save);
extern std::string last_save;
extern movie_logic movb;
/**
* Restore the actual core state from quicksave. Only call in rewind callback.
@ -42,7 +51,21 @@ extern movie_logic movb;
* Parameter secs: The seconds counter.
* Parameter ssecs: The subsecond counter.
*/
void mainloop_restore_state(const std::vector<char>& state, uint64_t secs, uint64_t ssecs);
void mainloop_restore_state(const dynamic_state& state);
std::string get_mprefix_for_project();
void set_mprefix_for_project(const std::string& pfx);
void set_mprefix_for_project(const std::string& prjid, const std::string& pfx);
class rrdata
{
public:
rrdata();
rrdata_set::instance operator()();
static std::string filename(const std::string& projectid);
private:
bool init;
rrdata_set::instance next;
};
#endif

View file

@ -0,0 +1,31 @@
#ifndef _moviefile_binary__hpp__included__
#define _moviefile_binary__hpp__included__
/**
* The binary movie extension tags.
*/
enum lsnes_movie_tags
{
TAG_ANCHOR_SAVE = 0xf5e0fad7,
TAG_AUTHOR = 0xafff97b4,
TAG_CORE_VERSION = 0xe4344c7e,
TAG_GAMENAME = 0xe80d6970,
TAG_HOSTMEMORY = 0x3bf9d187,
TAG_MACRO = 0xd261338f,
TAG_MOVIE = 0xf3dca44b,
TAG_MOVIE_SRAM = 0xbbc824b7,
TAG_MOVIE_TIME = 0x18c3a975,
TAG_PROJECT_ID = 0x359bfbab,
TAG_ROMHASH = 0x0428acfc,
TAG_RRDATA = 0xa3a07f71,
TAG_SAVE_SRAM = 0xae9bfb2f,
TAG_SAVESTATE = 0x2e5bc2ac,
TAG_SCREENSHOT = 0xc6760d0e,
TAG_SUBTITLE = 0x6a7054d3,
TAG_RAMCONTENT = 0xd3ec3770,
TAG_ROMHINT = 0x6f715830,
TAG_BRANCH = 0xf2e60707,
TAG_BRANCH_NAME = 0x6dcb2155
};
#endif

View file

@ -0,0 +1,64 @@
#ifndef _moviefile_common__hpp__included__
#define _moviefile_common__hpp__included__
#include <functional>
#include "core/moviefile.hpp"
#define DEFAULT_RTC_SECOND 1000000000ULL
#define DEFAULT_RTC_SUBSECOND 0ULL
template<typename target>
static void moviefile_write_settings(target& w, const std::map<std::string, std::string>& settings,
core_setting_group& sgroup, std::function<void(target& w, const std::string& name,
const std::string& value)> writefn)
{
for(auto i : settings) {
if(!sgroup.settings.count(i.first))
continue;
if(sgroup.settings.find(i.first)->second.dflt == i.second)
continue;
writefn(w, i.first, i.second);
}
}
struct moviefile_branch_extractor_text : public moviefile::branch_extractor
{
moviefile_branch_extractor_text(const std::string& filename);
~moviefile_branch_extractor_text();
std::set<std::string> enumerate();
void read(const std::string& name, portctrl::frame_vector& v);
private:
zip::reader z;
};
struct moviefile_branch_extractor_binary : public moviefile::branch_extractor
{
moviefile_branch_extractor_binary(const std::string& filename);
~moviefile_branch_extractor_binary();
std::set<std::string> enumerate();
void read(const std::string& name, portctrl::frame_vector& v);
private:
int s;
};
struct moviefile_sram_extractor_text : public moviefile::sram_extractor
{
moviefile_sram_extractor_text(const std::string& filename);
~moviefile_sram_extractor_text();
std::set<std::string> enumerate();
void read(const std::string& name, std::vector<char>& v);
private:
zip::reader z;
};
struct moviefile_sram_extractor_binary : public moviefile::sram_extractor
{
moviefile_sram_extractor_binary(const std::string& filename);
~moviefile_sram_extractor_binary();
std::set<std::string> enumerate();
void read(const std::string& name, std::vector<char>& v);
private:
int s;
};
#endif

Some files were not shown because too many files have changed in this diff Show more