Commit Graph

12 Commits

Author SHA1 Message Date
Moritz Bender 5d20862f26
Implement bsnes version 115 as a new core (#2740)
* Slam all this shit in here i don't care

* no lzma pls

* un-hack things that i hacked earlier (closer to bsnes source now)

* remove more unused files

* remove more files

* get some stuff working on this weird ass branch

* do this to get actual video (holy shit it works) while palette is incorrect

* make video look correct and hopefully fix stack waterbox allocation size uh ?

* Move the new bsnes core to its own dir as a new core and get input working

* remove leftover files from old bsnes

* fix some shit for now

* make lag frame detection work

* Improve cartridge loading to hopefully make sgb work (haven't tested)

- also changes some audio buffer stuff, might be better or worse than before idk
- need to figure out the saveram stuff
- path requests might actually completely fail atm, no idea how to verify that

* refactor to use a switch instead of some weird array with function pointers

- and implement snes_get_mapper, might be helpful or smth idk

* implement entropy c++-side and delete all this useless code holy

* delete dumb unnecessary code

* implement snes_peek_logical_register c++-side

* normalize all indentation

* attempt to properly support sharprtc and epsonrtc data loading and writing

* Duplicate winforms code to add entropy support c#-side and implement layer_enable functionality

The duplicated code is just so i can have a proper window for the new bsnes core. I do not like duplicating code like this, so this should be improved if possible

* Checkpoint for the start of getting rid of the ugly api wrapper stuff

* Next checkpoint for a full api refactor

* bullshit denied

just no.
every file is either copied or manually edited or written from scratch etc.
do not. force. one indent_style on every single file.
It just does not work.

* remove the entire eMessage_CMD handling and convert to native function calls

* general improvements regarding functionality

- adds hotfixes and fast_ppu core options
- add back the alwaysDoubleSize setting
- use bsnes's own serialize function for savestating now
- generate and use the color palette only in c# cause it doesn't need to be on the c++-side
- and more cleanup like always

* somewhat implement IMemoryDomains

* Implement trace logger and cleanup more unused stuff

* Implement ISaveRam, fix controller mapping for TAStudio and remove the pwrap stuff

* Fix ISaveRam, add a controller configuration box for the new core, (hopefully) fix controller inputs

- also differentiates BG prio0 and prio1 now (with options for it)
- some minor irrelevant edits in bsnes source

* Cleanup some more and optimize a bit

* Support firmware loading and make sgb work (hopefully)

* Remove all unused files

* Add back CropSGBFrame option and cleanup snes_video_refresh logic

* Some hopefully sensible changes

* One more cleanup pass

* Change to new PortedCore attribute

necessary after the changes in 98b07c42d5

Co-authored-by: nattthebear <goyuken@gmail.com>
2021-05-14 20:06:13 -05:00
nattthebear 07c7c329d3
Experiment to speed up libco and hence libsnes (#2248)
The compiler now can fully inline the co_switch, and with most registers being specified as clobbers and not saved explicitly, the compiler can choose to save only what it needs to (we don't have to defensively save everything).

Practically speaking, the co_switch calls are usually inlined, but the functions they're in don't seem to be that big and don't make direct use of r12..r15 too much anyway, so (push r12..r15, switch, pop r12..r15) is a common emit.  But I see a miniscule FPS increase.
2020-07-22 16:13:19 -04:00
nattthebear 3a18f6356d Rebuild all of waterbox as sysvabi, not msabi
This helps linux at the expense of windows, except it seems like windows gets a nice little speed up as well
2020-07-03 18:21:48 -04:00
nattthebear fa5885d7a1
Rewrite WaterboxHost in rust. (#2190)
This replaces the old managed one.  The only direct effect of this is to fix some hard to reproduce crashes in bsnes.

In the long run, we'll use this new code to help build more waterbox features.
2020-07-03 11:45:59 -04:00
nattthebear 7792eb2e80 Improve waterbox "lazystates"
Cores that used the .invisible section to store data were saving it; this was a regression from before, so PCFX states should be back down to the previous release size, or perhaps a bit smaller.

Add the ability to dirty track libco cothreads, as used in the bsnes core.  This saves a lot of space in those states and they're now quite competitive in size.
2020-06-04 12:13:28 -04:00
nattthebear 6e366b7590 waterbox libsnes cothreads: set TEB/TIB stuff
some bsnes cothreads call callbacks that hit managed threads.  We shouldn't do that, but we do, and sometimes those threads run MSVC's __stkchk which can, depending on circumstances, blow up if the thread extents aren't set.

This also means that we cannot save space on a lot of cothread stacks because __stkchck will blow up any detection guards we try
2020-06-03 15:48:06 -04:00
nattthebear d06ed05929 waterbox - track writes for smaller savestates
The waterbox system now uses host os facilities to track whether memory has been written to, to automatically choose what thing to savestate.  This results in a large size decrease for some cores, like snes9x or gpgx (when running cartridge games).  Doesn't do much for cores that were already memory efficient, or for bsnes because of libco compatibility issues; but those cores don't regress either.
2020-06-03 07:13:40 -04:00
nattthebear 21cdf5120b
Revamp waterbox build environment and runtime. (#2027)
Create an all new waterbox build environment:
WSL2 + Ubuntu 20.04 LTS (Other linuxes may work)
Musl libc with waterbox customizations
LLVM's libclang-rt, libunwind, libcxxabi, libcxx
Static linking to elf files

Compared with the old system, this is easier to set up a dev env for and easier to update in the future. The executables are larger but produce smaller savestates due to static linking. The modern toolchain means advanced library features and language features that sometimes appear in some upstream cores will be reusable.
2020-05-20 15:34:24 -04:00
nattthebear 626de2d7c8 waterbox: add guard pages to libco stacks 2017-06-11 20:10:37 -04:00
nattthebear 67ff767f95 libsnes: recreate the emu cothread at the end of init, to avoid pointer poison that was breaking xor state consistency. Big todo: all init functionality really needs to happen from the main thread, as there are many syscalls that reenter managed in that code, and reentering managed from a cothread stack is a Bad Thing 2017-06-10 19:51:59 -04:00
nattthebear dde953d612 fix a libco issue that was breaking xorstate consistency 2017-06-10 18:20:58 -04:00
nattthebear d8c19f3787 waterbox libco (not yet tested) 2017-06-09 19:54:20 -04:00