Commit Graph

18229 Commits

Author SHA1 Message Date
nattthebear fbee96c76b GPGX: Allow writing to rom memory domains
Don't let the diff fool you, a massive amount of work went into making this possible.
2020-12-13 19:49:04 -05:00
nattthebear 72ea5ce866
Waterbox: Allow SEH unwinding through guest calls. (#2519)
The goal of the separate stacks was to allow this, but I never quite finished the job.  Now, when a SEH exception (generally a Rust panic in a guest syscall handler, or a C# Exception in a callback) tries to unwind through guest code, it works.  Note that we don't actually unwind the guest stack, as there's nothing useful to be gained from that;  When an emulator core throws an exception like this, it should be considered completely hosed.  Throw it out and get a new one.

There were two bugs stopping this from working.

First of all, we had custom thunks that lacked sufficient unwind information for RtlUnwind to get through.  For the sysv <-> msabi adapter, this was fixed by making it regular Rust code instead of hand assembled junkus.  So the compiler generates valid unwind information for all of that.  Then we just JIT a small stub on top in the MsHostSysVGuest code, which needs no unwind information because it won't throw an exception itself and transparently passes execution to something with valid unwind information without invalidating that information.  (NB:  Clr JIT stubs use the same strategy.)  For the host <-> guest stack transition code, a small hand generated unwind stub was added to interop.s that is registered with `RtlAddFunctionTable`.  I've seen the unwind work successfully without this second set of unwind information, but better safe than sorry.

Secondly, our misuse of SubSystemTib caught up with us.  It's an old field, allegedly from OS/2, that we repurposed to hold TLS information needed for the waterbox stack transitions.  Most people think nothing uses it any more, but in fact if it's set to a non-NULL value, but doesn't contain valid information, `KERNELBASE!GetModuleFileNameW` will crash when it tries to get a module name from there.  The fix here was to simply tighten up our usage of SubSystemTib:  We were already nulling it out when returning from guest code, but not when calling back to host code in guest code.

Fixes #2487.  Unwinding of this sort has never worked well in waterbox; the reason why that issue is more recent is that the particular reproducing case of firmware didn't cause an exception in a callback in older code; the exception happened in pure managed code.
2020-12-13 19:12:16 -05:00
YoshiRulz fa6fd88d62
Import and use OSTailoredCode in DiscoHawk program class 2020-12-14 06:40:06 +10:00
YoshiRulz 24f90c922f
Fix incorrect import
I blame Rider
2020-12-14 06:33:46 +10:00
adelikat 28f161ce18 remove unnecessary string interpolation in a few places 2020-12-13 12:12:42 -06:00
adelikat 10d4f66248 Hex Editor - some small cleanups 2020-12-13 11:44:10 -06:00
nattthebear 6130a7241f Fix Saturn cart detection
Closes #2513.
Similar to ddd229e03d, Mednafen internals expect enumeration setting types to work with MDFN_GetSettingI, but we weren't doing that.
2020-12-12 13:40:33 -05:00
nattthebear 2f2f104e3d Update nyma cores to Mednafen 1.26.1
See Mednafen release notes for full changes.  Mostly just Sega Saturn stuff.

Closes #2464
Closes #2162
2020-12-12 10:50:18 -05:00
alyosha-tas 4447d5ddc7 GBHawk: bug fix, initial ram change, and double speed mode input dumping 2020-12-09 22:54:12 -05:00
Andrew Cook 58cbec6dd6
[PSX] Make Octoshock more debuggable (#2508)
* [PSX] Bodge in a system bus memory domain

Fixes: debugger window crashes when adding a breakpoint

* [PSX] Use Octoshock's built-in disassembler

* [PSX] Add support for execute memcbs to the core

* [PSX] Have memcbs include actual values

* [PSX] Use SafeHandles instead of raw pointers

* [PSX] Use core's internal peek and poke functions for System Bus

* [PSX] Move memory maps into IDebuggable impl to be next to memory map hooks

* [PSX] Revert using SafeHandles

* [PSX] Fire execution callback after trace callback instead of at end of fetch
2020-12-08 11:34:24 -06:00
alyosha-tas e81fa92f80 GBHawk: forgot a commit 2020-12-08 11:04:03 -05:00
alyosha-tas 401d635afc GBHawk: properly fade to white in GBC mode 2020-12-08 10:41:37 -05:00
zeromus 28af57de18 fix mistake in libsnes CARTROM-D CDL block 2020-12-07 15:55:15 -05:00
alyosha-tas 699fb1171c GBHawk: more mode 1 work 2020-12-06 19:39:25 -05:00
alyosha-tas a46ffefc77 GBHawk: mode 1 overhaul, fixes several bugs 2020-12-06 15:50:21 -05:00
zeromus e9f365a4a5 libsnes - core dll update for prior commits 2020-12-05 23:37:16 -05:00
zeromus 96aa3e85c0 libsnes - remove pointless registers 2020-12-05 23:37:16 -05:00
zeromus f580773342 add CARTROM-DB and CARTROM-D blocks to libsnes CDL 2020-12-05 23:37:16 -05:00
alyosha-tas b7c821f8d6 GBHawk: mode1 bug fix 2020-12-05 19:32:34 -05:00
YoshiRulz 877c11d5f9
Merge UpdateChecker.ParseVersion into VersionInfo.VersionStrToInt 2020-12-06 07:35:12 +10:00
YoshiRulz 66e0d4b214
Misc. cleanups in VersionInfo 2020-12-06 07:28:31 +10:00
YoshiRulz 508dc4a9d9
Use readonly instead of const in VersionInfo 2020-12-06 07:28:23 +10:00
YoshiRulz 9dcc8f56f4
Move VersionStrToInt helper to VersionInfo 2020-12-06 07:27:54 +10:00
YoshiRulz 98e2d494a2
Bump supported Windows versions 2020-12-06 07:12:27 +10:00
YoshiRulz eeae3f023f
Merge Sound.Instance into MainForm.Sound and pass back to Program
now I don't have to feel bad about sweeping a global under the rug
2020-12-06 05:59:36 +10:00
YoshiRulz cf901753ba
Update Lua libs' ApiContainer when updating services
I don't think this mattered unless the tool restart was triggered by reloading
the rom with client.reboot_core(), which in my defence has always been jank
2020-12-06 05:41:58 +10:00
YoshiRulz febd4f1340
Remove unused prop EventsLibrary 2020-12-06 05:34:46 +10:00
YoshiRulz ce7aa1ff64
Convert abstract class LuaLibraries to an interface 2020-12-05 07:51:14 +10:00
YoshiRulz e42a021215
Move props from LuaLibraries to Win32LuaLibraries 2020-12-05 07:51:11 +10:00
YoshiRulz c46719c602
Do type checks on LuaConsole.LuaImp
this is more safe than is strictly necessary but it's not really less code to
use a direct cast
2020-12-05 07:51:08 +10:00
YoshiRulz bf116f3ecf
Inline LuaLibraries.RunningScripts 2020-12-05 07:51:05 +10:00
YoshiRulz c3c02eaad3
Inline LuaLibraries.EnableUpdate/SupressUpdate
"suppress" isn't even speled corectly
2020-12-05 07:51:02 +10:00
YoshiRulz e4a0175351
Extract interface from NamedLuaFunction 2020-12-05 07:50:59 +10:00
YoshiRulz 8f10ce66a6
Merge EventsLuaLibrary.RegisteredFunctions into Win32LuaLibraries 2020-12-05 07:50:56 +10:00
YoshiRulz 6aefa75cff
Add helpers for manipulating NamedLuaFunctions 2020-12-05 07:50:53 +10:00
YoshiRulz 3024bc0d0f
Inline some methods from EventsLuaLibrary into Win32LuaLibraries 2020-12-05 07:50:50 +10:00
YoshiRulz a54aa0706d
Deprecate emu.getluacore in favour of new func client.get_lua_engine 2020-12-05 07:50:46 +10:00
YoshiRulz f57897515e
Add prop EngineName to abstract class LuaLibraries 2020-12-05 07:50:43 +10:00
YoshiRulz 89a66563f1
Cleanup FormsLuaLibrary.WindowClosed and usages 2020-12-05 07:50:40 +10:00
YoshiRulz d51f9c3e88
Use LINQ instead of dumb in FormsLuaLibrary implementations 2020-12-05 07:50:37 +10:00
YoshiRulz 30d9a8b458
Inline Designer and resource files for LuaCanvas 2020-12-05 07:50:33 +10:00
YoshiRulz b541fe5b40
Use NLuaTableHelper for more conversion to/from LuaTable
also fix indexing that I broke in c8e10120d
2020-12-05 07:50:28 +10:00
YoshiRulz 46504b4880 Add and use more extensions for IDialogParent 2020-12-05 07:47:01 +10:00
YoshiRulz b752b09d62 Implement IDialogParent in some more forms 2020-12-05 07:47:01 +10:00
YoshiRulz 8a6c7be6aa Cleanup MainForm interfaces, move ShowDialogAsChild to extension 2020-12-05 07:47:01 +10:00
YoshiRulz f0664ce018 Add and use interface IDialogParent 2020-12-05 07:47:01 +10:00
YoshiRulz f0657b358d Inline ShowHawkDialog
there were 8 unnecessary double-mutes where ShowHawkDialog was called with a
InputPrompt receiver
2020-12-05 07:47:01 +10:00
YoshiRulz 9d620116f3 Shoehorn IDialogController into ShowHawkDialog call chains 2020-12-05 07:47:01 +10:00
YoshiRulz dd44ff7f6c Ensure owner param of ShowHawkDialog overloads are never null 2020-12-05 07:47:01 +10:00
YoshiRulz aad612593b Add and use helper method DoWithTempMute (void and generic flavours) 2020-12-05 07:47:01 +10:00