pretty much only affects NixHawk, where the wbox cores are in one dir and EmuHawk.exe and the other assemblies are in another, and all are symlinked into one tree
Add in liblua-* variant for Linux lua library names (resolves#3678)
Remove some more unused NLua code
Make LuaState internal, we don't need to see it (NLua.Lua API slightly changed to accommodate this, tests could be broken due to this?)
Make various other NLua classes internal, we don't need to see them
Check against lua library loading failing, provide a non-fatal message box if it has failed instead of crashing on some exception.
Remove UnixSearchPaths (unneeded with LD_LIBRARY_PATH being set) and unused IImportResolvers
We don't care for ANSI functions (no way somebody is going to run BizHawk on Windows 98/ME), and ExactSpelling = false (default) has a minor runtime cost, so this should be slightly more performant.
Also, replace ShellLink COM usage with custom COM interaction code. See https://github.com/TASEmulators/BizHawk/issues/3767. The same is yet to be done for the two other COM usages.
unloading the dll would forcefully evict these file handles. unknown whether Linux does the same with the .so, perhaps it does, perhaps it doesn't. not really any extra harm if it doesn't
cleanup some more win32 imports (new LoaderApiImports, although it isn't used for OSTailoredCode to avoid hard dep on BizHawk.Common, probably want to use same hack on LoaderApiImports)
also fix dinput not filtering out unknown key events (TODO: shouldn't this be handled higher up the input chain? surely we wouldn't want to respond at all to unknown key events)
Turn these OS specific key input impls into instantiable classes instead of a ton of static classes, a lot nicer to work with as don't need to constantly check CurrentOS to know which class to use, only the factory needs to check that!
* Make RamWatch double click action configurable
* Make RamWatch Enter press share double-click behavior
* Make RamWatch double-click action default to poke
* Fix code style
* Reduce total diff size from extracting method
* Make sub-menu text more specific
Doing this fixes tasproj prompting for save on bk2->tasproj conversion (which makes no sense) and generally seems senseful to do; there is no point ever having a changelog or changes bool set just after loading a tasproj
This should motivate widening the scope of profiles, and may also inspire additional features for onboarding such as paths/firmware, screen layout, or keybinds.
Fix GDI+ used for display method (got broken in some cleanup commits ago)
Remove some things meant to be removed in the last commit (fixes debug build)
fixes CA2211, CA2215, CA2241, CA2251
silence CA1816 because it's unnecessary
reduce severity of CA2201 because I like the concept but don't wanna fix them all
* Allow migrating non-SHA1 hashes on movie import
* Show more descriptive message on missing hash
* actually return null here
* Simplify LsmvImport
* add more hash HeaderKeys
* remove unnecessary IEmulator argument
this could potentially fix bugs even
* explicitly cast to ReadOnlySpan
in practice this means nothing for any Windows user (since D3D9 would support whatever garbage GPUs that had OGL 2.0 support but not OGL 3.0 support), so it only affects Linux users with GPUs from 2004-2010 (~2011 GPUs supported at least OGL 3.0), and those users probably have options to still use BizHawk if they really wanted to anyways
With this, switch the GuiRenderer (main) pipeline to use VAOs/VBOs instead of the old legacy fixed pipeline crap (other shaders still need that crap for now, so there is still a fallback path there). Also add in way to "free" the vertex layout (since it now can hold a VAO/VBO which needs to be freed once the vertex layout is finished)
* Swap System.Data.SQLite with Microsoft.Data.Sqlite
Apparently this is supposed to be a kind of successor? https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/compare
* Add e_sqlite3 libs to Assets, prevent runtimes folder creation with OS tailored libs plopped in, delete System.Data.SQLite references
winforms net6 doesn't support it, and "replacement" ContextMenuStrip doesn't work for this use case, so just create a slim wrapper using CreatePopupMenu/DestroyMenu directly
Probably can add in some first time message box warning the user that wine/proton isnt supported, although we probably shouldn't block wine/proton (considering it's the only option for some distros with read-only filesystems, like the Steam Deck)
Normally SDL doesn't do this as we don't ever call SDL_PumpEvents (or anything that calls that). However, OpenGL context creation code ends up calling WIN_PumpEvents regardless. This usually doesn't matter, however, in some cases, this can cause crashes, mainly with loading a state with Citra, as that ends up re-constructing its frame dumping OpenGL context (yeah that's dumb and useless but it's mostly harmless, outside of this message pumping). The WIN_PumpEvents calls appear to be unneeded anyways, so we can safely disable message pumping here.
Add in logic to not create the main rewinder if this flag is true, and add in logic to tastudio to avoid the main greenzone captures (instead only capture on branch save/load)
make it so CIAs past index 0 will be "installed" (mostly only relevant for movies, as the temp user folder is wiped each session in deterministic mode)
ensure XMLs won't load 3DS roms into memory (same reasoning as other hack, might be >=2GiB)
do some cleanup with this code
The main objective in this PR is to get rid of the main .NET Framework dependencies in Bizware packages. This PR doesn't do that completely per se, still having .NET Framework used for WinForms Controls, but that can easily be swapped over for whatever UI framework we use next as long as it exposes native window handles in some way.
For this PR, it does some reorganizing of Bizware, splitting Bizware.OpenTK3 and Bizware.DirectX into 3 packages based on usage; Bizware.Audio, Bizware.Graphics, and Bizware.Input. These packages in the future probably could have more functionality moved into them, but for now they are largely just a reshuffling of the Bizware.OpenTK3 and Bizware.DirectX packages.
As both SlimDX and OpenTK3 are .NET Framework, they have been removed in this PR. Their replacements are as follows:
SharpDX: DirectSound, Direct3D9
Vortice: XAudio2, DirectInput/XInput
Silk.NET: OpenAL, OpenGL
SDL2-CS / native SDL2: OpenGL context management, new gamepad backend (replacing OpenTK's role for gamepads)
native X11: New key input backend (replacing one of OpenTK's roles for keyboards)
GLControl has been replaced by custom made control which just uses SDL2 for context management.
The OpenTK input backend has been replaced with a combination of SDL2 and an OS tailored key input backend (DirectInput on Windows, X11 on Linux, and planned to be Quartz on macOS). This is just represented on the user side as "SDL2" without mentioning the key input backend. This does mean for a while DirectX will be mandatory on Windows again, until a RAWINPUT backend is written for handling key input on Windows for the SDL2 input backend.
Also make it so initial loading uses the zstdstream or filestream directly instead of a memorystream with it all loaded
something of note, not really happy with how these read/write callbacks get used in practice, it seems they get spammed in small chunks
for initial loading, it's 8192 byte chunks each, which can be a LOT of callbacks, depending on core size (gpgx is ~500, MAME is ~22K)
similarly, savestates suffer a similar issue, although instead it's a ton of 4096 byte chunks (page size eh?)
The unmanaged <-> managed transitions obviously are not exactly performant, and I imagine are taking a significant portion of the time here
Perhaps some buffering strategy should come in on the native waterboxhost side to alleviate callback spam?
have it generate "leadin" and "leadout" tracks for multisession discs... this is almost certainly wrong for leadin (doesn't matter so far), leadout is probably right...
Move the various synths using the CUE SS_Base to a file, mostly just a nicer organizational change as MDS and CDI use one of these but not CUE
Misc improvements elsewhere
I'm pretty sure all the existing instances were intended to use `default(T)` if
the key isn't present, except maybe the cheatcode converters but I don't care to
rewrite those at the moment
Instead of creating a new Task and destroying it every frame, just create a new thread and call the delegate when needed.
Also allow for rendering a frame twice, this is actually possible anyways (albeit rarely done).
This should also help against a potential deadlock due to the Task.Wait call on the UI thread (which has special semantics in WinForms)
Also minor nitpicks in RCheevos code
so simply sticking to newest rom sets is the safest, otherwise there's little user control, because there's no global list of all known dumps with indications which of them are bad and what to use instead.
* fix noise audio channel on SMS VDP
* Update SN76489sms.cs
also, white noise is generated by XORing bits 0 and 3, not 0 and 1, on an SMS/GG VDP
* Update SN76489sms.cs
reverting commit #7b857e7
TAStudio previously called `PlayerNumber(...)` for each visible cell with the column's name, only to determine whether its player number is odd or even.
Because that function uses regex and is potentially called extremely often, this had a noticable impact on fps.
I've decided to just cache the odd/even playernumber result in a dictionary for faster access, which while not being my preferred way of handling this at least results in a decent speedup.
* Workaround crashes in MAME's zlib decompression code (see https://github.com/TASEmulators/BizHawk/issues/3615)
* Use using block, only catch InvalidDataException (what will be thrown if the zip entry has an unsupported (likely lzma) compression method)
apparently some game had 2002 leaderboards which caused a crash when making a form for every one of them in the leaderboard list, I guess windows has a limit on the amount of forms that can be active at once?
this is a quick hack to prevent such a crash, design needs to be rethought
* Implement IBasicMovieInfo interface for IMovie
this allows parsing basic movie fields into an own class that is independent from Bk2Movie/TasMovie
This is mainly useful for the PlayMovie dialog which can now load movie information from files on disk without having to go through the entire Bk2Movie/TasMovie loading process
* don't potentially iterate input log twice
* Optimize LoadFramecount
Waterbox cores can't create files anyways, and trying to send in ? might make MAME try to make the directory anyways (which crashes due to the syscall for that being unimplemented), while "" will not do that
Cleanup this code so it plays nicer with BizHawk's "run everything on the main thread" (+ WinForms not playing nice with async methods)
Resend any game session start / achievement unlocks / leaderboard triggers if they failed. Wait for all achievement unlocks and leaderboard triggers to finish on Dispose() (mostly for catching them when user closes BizHawk)
Update rcheevos to 10.7.0
This becomes mostly apparent in the PlayMovie dialog where one zstd instance is created for every single movie, churning significant amounts of memory even though zstd isn't even used
* Nes.Core now updates the DataBus in WriteMemory()
This will fix open bus execution following write instructions.
* Properly formatted changes in previous commit
I have addressed the requested changes.
This call in `ToolManager.Restart` was to set `[{Optional.Required}Service]`
props to `null`, but the tool form would get `Close`d immediately afterwards, so
it never gets the chance to hit the `null` path if one exists. However, some
tools are written as though they keep the stale value, for example attempting to
call a cleanup function on it in their `Closed` event handler. These will now
work as intended.
`[OptionalService]`s that can't be satisfied are set to `null` by
`ServiceInjector.UpdateServices`, so clearing those isn't necessary, and
`ClearServices` has no other usages.
* Use source generator for VersionInfo
* Remove leftover hacks
* Use same fallbacks as NixHawk when Git not available
---------
Co-authored-by: YoshiRulz <OSSYoshiRulz@gmail.com>
mame won't care too much about how good the dump is, but it will warn you in orange that emulation is imperfect, and in red if it's broken. we happen to use rom status icon to inform the user about multidisk bundle, so using it for mame info feels natural, because it directly affects what users can safely submit to tasvideos. we warn them about bad dumps because it's banned for pub, so it's similar here.
This had two issues. One, relative pathing with dlls is a no-go. Our hackery with changing cwd seems to confuse lua, and while it can find the dll, it fails to load as Windows (at least) does not consider cwd for loading up dlls it appears. Secondly, people using luasockets never actually loaded up the luasockets dll, rather we were bundling it ourselves. From history it seems this was due to our lua being compiled with CLR/.NET and that didn't play nice with exceptions? Doesn't seem to be an issue anymore, but we should probably still bundle luasockets for the time being given it used in many different projects which use the same script with multiple different emulators (thus our own sockets are simply not usable).
This reverts commit 007442773a.
fixes#3268 but unfixes #3053, which should instead be fixed by something that doesn't lead to breaking other things and the author of the "fix" giving up on the project
Add in better docs for `DeltaSerializer`.
Fix C64 not remembering disk changes when swapping disks (swapping disks essentially just reset the disk previously)
denominator is determined by taking refresh attoseconts `as_ticks(numerator)` which reduces the initial 64bit value to what can be used for video
mame needs flat 60fps for screenless machines, so we use a numerator that is a multiple, while also being a tiny bit more accurate than with 1,000,000,000
The main ram previously seemed to just be a slice of the system bus between 0 - 0xbfff. this posed two problems: that area is banked, and that area could represent main ram or aux ram. main ram now represents all of the ram main ram can possible represent, ordered like how the core orders it (which the way it does it happens to be very natural in any case), and a new aux ram domain does the same thing but with aux ram
Also some other changes put in so Rider wouldn't error on building Virtu
Main changes here would be with cartridges, as it appears cartridge stating was just broken since 4ffcc9654a (that's all the way back in 1.13!!!) due to SyncStateInternal not actually getting used
a few other components also had some variables missing from states
disks are not properly savestated yet, it appears it was commented out due to an assumption that disks were write only, but this isn't the case
some other cleanups here, none of them actually affecting state quality here
* Waterbox setup has been revamped to use the latest llvm parts (llvm 16 for compiler_rt/libunwind/libcxx/libcxxabi).
* Clang is now possible to use, and is the preferred compiler (due to superior performance).
* Supported compilers are now clang 14/15/16, and gcc 12.
* Other core updates are mixed in.
---------
Co-authored-by: Morilli <35152647+Morilli@users.noreply.github.com>
currently unused, like `.ips` patch applier; will return to hook up to loading
(currently flagged as good dump if base was), write unit tests, and add a way to
save patched rom to disk