aboutsummaryrefslogtreecommitdiff
path: root/src/ARMJIT_Memory.cpp
Commit message (Collapse)AuthorAge
* Fix some minor instances of undefined behaviorJesse Talavera-Greenberg2023-12-08
|
* Soften restrictions around `ARMJIT_Memory::RemapNWRAM`Jesse Talavera-Greenberg2023-12-08
| | | | | - If in NDS mode, return instead of `assert`ing - Use `static_cast` and `ConsoleType` instead of `dynamic_cast`
* Refactor `NDS` and `DSi` to be objects (#1893)Jesse Talavera-Greenberg2023-11-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * First crack at refactoring NDS and DSi into objects - Remove all global/`static` variables in `NDS` and related classes - Rely more on virtual dispatch when we need to pick methods at runtime - Pass `NDS&` or `DSi&` to its constituent components where necessary - Introduce some headers or move some definitions to break `#include` cycles * Refactor the frontend to accommodate the core's changes * Move up `SchedList`'s declaration - Move it to before the components are initialized so the `map`s inside are initialized - Fields in C++ are initialized in the order they're declared * Fix a crash when allocating memory * Fix JIT-free builds * Fix GDB-free builds * Fix Linux builds - Explicitly qualify some member types in NDS, since they share the same name as their classes * Remove an unnecessary template argument - This was causing the build to fail on macOS * Fix ARM and Android builds * Rename `Constants.h` to `MemConstants.h` * Add `NDS::IsRunning()` * Use an `#include` guard instead of `#pragma once`
* Move all core types into namespaces (#1886)Jesse Talavera-Greenberg2023-11-25
| | | | | | | | * Reorganize namespaces - Most types are now moved into the `melonDS` namespace - Only good chance to do this for a while, since a big refactor is next * Fix the build
* Refactor the JIT to be object-oriented (#1879)Jesse Talavera-Greenberg2023-11-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move TinyVector to a new file - So it's less sensitive to #include ordering * Forgot to include assert.h * Refactor ARMJIT_Memory into an object * Oops, forgot a declaration * Refactor ARMJIT to be contained in an object * Remove an unused function declaration * Add a missing #include * Remove a now-unused global * Use ARMJIT_Memory's own memory access functions * Fix some omissions in the ARM JIT * Move libandroid to be a member of ARMJIT_Memory instead of a global * Default-initialize most fields in ARMJIT_Compiler.h * Define NOOP_IF_NO_JIT * Finish refactoring the JIT to be object-oriented
* Refactor the GPU to be object-oriented (#1873)Jesse Talavera-Greenberg2023-11-09
| | | | | | | | | | | | | | | | | * Refactor GPU3D to be an object - Who has two thumbs and is the sworn enemy of global state? This guy! * Refactor GPU itself to be an object - Wow, it's used in a lot of places - Also introduce a new `Melon` namespace for a few classes - I expect other classes will be moved into `Melon` over time * Change signature of Renderer3D::SetRenderSettings - Make it noexcept, and its argument const * Remove some stray whitespace
* Move NDSCart-related global state into objects (#1871)Jesse Talavera-Greenberg2023-11-09
| | | | | | | | | | | | | | | | | | * Move NDSCart-related global state into objects - RAII will now do the heavy lifting - Mark some methods as const or noexcept * Move GBACart-related global state into objects (#1870) - RAII will now do the heavy lifting - Mark some methods as const or noexcept - Once the `NDS` object is finalized, most of these `assert`s can go away * Make AREngine::RunCheat public (#1872) - I use it directly in melonDS DS to apply single cheats without using ARCodeFile - Before the AREngine refactor I could just redeclare the function in my code - Now I can't
* convert Wifi and WifiAPArisotura2023-11-04
|
* convert SPU to OOPArisotura2023-11-04
|
* update copyright yearsArisotura2023-11-04
|
* Make the NDS teardown more robust (#1798)Jesse Talavera-Greenberg2023-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make cleanup a little more robust to mitigate undefined behavior - Add some null checks before cleaning up the GPU3D renderer - Make sure that all deleted objects are null - Move cleanup logic out of an assert call - Note that deleting a null pointer is a no-op, so there's no need to check for null beforehand - Use RAII for GLCompositor instead of Init/DeInit methods * Replace a DeInit call that I missed * Make ARMJIT_Memory less likely to generate errors - Set FastMem7/9Start to nullptr at the end - Only close and unmap the file if it's initialized * Make Renderer3D manage its resources with RAII * Don't try to deallocate frontend resources that aren't loaded * Make ARMJIT_Memory::DeInit more robust on the Switch * Reset MemoryFile on Windows to INVALID_HANDLE_VALUE, not nullptr - There is a difference * Don't explicitly store a Valid state in GLCompositor or the 3D renderers - Instead, create them with static methods while making the actual constructors private * Make initialization of OpenGL resources fail if OpenGL isn't loaded * assert that OpenGL is loaded instead of returning failure
* Assorted portability enhancements (#1800)Jesse Talavera-Greenberg2023-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Introduce some Platform calls for managing dynamic libraries * Add Platform::WriteFATSectors * Introduce some Platform calls for managing dynamic libraries * Add Platform::WriteFATSectors * Change includes of "../types.h" to "types.h" - Makes it easier to directly include these headers in downstream projects * Change an include of "../Wifi.h" to "Wifi.h" * Allow CommonFuncs.cpp to compile on Android * Tidy up some logging calls - Use Platform::Log in LAN_Socket.cpp - Soften some warnings to Debug logs (since they don't necessarily represent problems) * Add Platform::EnterGBAMode - Gracefully stop the emulator if trying to enter GBA mode * Soften some logs that most players won't care about * Soften some more logs * Introduce Platform wrappers for file operations * Fix pointer spacing * Fix more style nits * Log the errno when ftruncate fails * Fix FileSeek offset argument - With an s32 offset, we couldn't access files larger than 2GB * Revise Platform::StopEmu to address feedback - Remove Platform::EnterGBAMode in favor of adding a reason to Platform::StopEmu - Also rename Platform::StopEmu to Platform::SignalStop - Add an optional argument to NDS::Stop - Use the new argument everywhere that the console stops itself * Rename FileGetString to FileReadLine - It conveys the meaning better * Rename FileSeekOrigin::Set to Start - It conveys the meaning better * Change definition of FileGetString to FileReadLine - Oops, almost forgot it * Rename FlushFile to FileFlush - To remain consistent with the other File functions * Add a FileType usage * Fix line break in FileSeekOrigin * Document Platform::DeInit * Clarify that StopReason::Unknown doesn't always mean an error * Move and document FileType::HostFile * Remove Platform::OpenDataFile - Nothing currently uses it * Refactor Platform::OpenFile and Platform::OpenLocalFile to accept a FileMode enum instead of a string - The enum is converted to fopen flags under the hood - The file type is used to decide whether to add the "b" flag - Some helper functions are exposed for the benefit of consistent behavior among frontends - Equivalent behavior is maintained * Fix a tab that should be spaces * Use Windows' 64-bit implementations of fseek/ftell * Move Platform::IsBinaryFile to Platform.cpp - It could vary by frontend * Remove an unused FileType * Rename an enum constant * Document various Platform items * Use Platform::DynamicLibrary to load libandroid - And clean it up at the end * Fix a typo * Pass the correct filetype to FATStorage - Since it can be used for DSI NAND images or for SD cards * Remove Platform::FileType
* Introduce `Platform::Log` (#1640)Jesse Talavera-Greenberg2023-03-23
| | | | | | | | | | | | | * Add Platform::Log and Platform::LogLevel * Replace most printf calls with Platform::Log calls * Move a brace down * Move some log entries to one Log call - Some implementations of Log may assume a full line * Log the MAC address as LogLevel::Info
* JIT: Add bits for Windows ARM64 supportNadia Holmquist Pedersen2022-11-05
|
* add support for the mainRAM mirror at 0x0C000000 in DSi mode, makes SM64DSi ↵Arisotura2022-04-10
| | | | work correctly
* fix copyright headersArisotura2022-03-07
|
* update copyright headersArisotura2022-01-09
|
* dtcm not dtcbRSDuck2021-10-29
|
* get rid of DTCMSizeRSDuck2021-10-29
|
* don't printf from exception handlerRSDuck2021-06-07
| | | | it was handy for debugging, but it's dangerous
* Fix some compiler warningsWaluigiWare642021-05-03
|
* Update copyright year and add missing GPL headers part 2WaluigiWare642021-03-21
| | | | | Looks like a lot of files were missed... Closes #1036
* remove direct reference to Switch frontend headerRSDuck2021-03-03
|
* Define CONTEXT_PC and use instead for much cleaner code (#1017)WaluigiWare642021-02-25
| | | | | * Define CONTEXT_PC and use instead for much cleaner code Also include ways to get the Program Counter on ARM64 FreeBSD and NetBSD
* fix #994RSDuck2021-02-09
|
* wild shot into the darkRSDuck2021-02-09
|
* Add NetBSD support (#985)WaluigiWare642021-02-03
| | | | Note - This will require PaX MPROTECT to be disabled for melonDS by running: paxctl +m melonDS
* Add FreeBSD support (#939)WaluigiWare642021-01-22
| | | | | | | | | | | | | | | | | | | | | | | | | * Add FreeBSD support * Fix indentation * Fix Linux not finding OpenGL * Link POSIX Realtime Extensions library * Link POSIX Realtime Extensions when OpenGL is enabled too * Fail if shm_open memory exists and also check for errors * fix the last commit * (try to) Setup FreeBSD CI * Fix some issues with FreeBSD CI * Make with all cores * Remove FreeBSD CI It doesn't want to work for some reason
* JIT A64: fixesRSDuck2021-01-05
| | | | also update Switch code for latest libnx
* Fix fastmem building on ARM64 Macs (#841)WaluigiWare642020-12-11
|
* aligned_alloc instead of memalignRSDuck2020-12-09
| | | | also carry over new Switch changes
* Use ashmem instead of memfd_create on Android. (#816)Filippo Scognamiglio2020-11-30
| | | | | | | | | * Use ashmem instead of memfd_create on Android. * Fix code styling issues. * fix small mistake in merge commit Co-authored-by: RSDuck <RSDuck@users.noreply.github.com>
* Add support for macOS (#771)WaluigiWare642020-11-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * use shm_open() instead of memfd_create() on macOS malloc.h isn't a header on macOS * Change OpenGL headers + create ifdef for DO_PROCLIST macOS seems to already have the OpenGL functions defined, without the ifdef, it gives "ambiguous references" errors. * macOS doesn't have ->gregs in uc_mcontext and it doesn't have REG_RIP either https://github.com/gperftools/gperftools/blob/master/m4/pc_from_ucontext.m4 * use getpid() to make memory file name unique * #ifndef __APPLE__ for AF_PACKET and linux/if_packet.h * Add include and link directories for macOS and link the OpenGL framework * Add macOS CI * Use newly added libslirp package from Homebrew https://github.com/Homebrew/homebrew-core/pull/63412 * Use Apple's Clang instead of GNU GCC on macOS * Add macOS build instructions to README * Try to fix macOS undefined symbol * snprintf doesn't take null terminator into account * Map new memory on macOS for JIT * Only use gcc-ar if using GNU Compiler * re-add fastmem code - whoops! * Fix style issue - use camelCase not snake_case * Set Minimum macOS version * Switch Minimum OS X version to 10.9 * Add macOS libpcap library name * fix memory leak * Fix binding keys in macOS * Allow getting MAC address on macOS melonDS on Linux uses AF_PACKET, which doesn't exist on macOS. Instead, this commit uses AF_LINK on macOS to get the MAC address. * Remove unneeded macOS CI dependencies * Build melonDS app bundle on macOS Now it is no longer required to install the libraries on macOS, they come with the app bundle. * fix macOS CI not being able to find macdeployqt * copy melonDS.app with recursive because it's a folder * Disable fastmem checkbox on macOS * Disable fastmem by default in config * forgot a semicolon * Don't bundle libraries, causes issues on macOS <10.15 * Update README + allow finding version in Finder on macOS * Make sure fastmem checkbox stays uncheckable
* make fastmem work againRSDuck2020-11-13
|
* fix WindowsRSDuck2020-11-09
|
* JIT fixesRSDuck2020-11-09
| | | | | | | | - fix fastmem problems on linux - small fix memory leak - SlowWrite functions always take in a 32-bit variable so that the C compiler knows that the values aren't necessary zero extended - a few other stylistic things - handle SIGBUS as well (for macos)
* fix build on SwitchRSDuck2020-09-11
|
* JIT fastmem: fix out of bounds readRSDuck2020-08-25
| | | | seems to fix #727
* use unordered map for JIT RestoreCandidatesRSDuck2020-08-14
| | | | also fix WifiRead32?
* fix JIT for code in VRAMRSDuck2020-08-09
| | | | | apparantely Pokemon B/W needs this fixes #708
* reset fastmem on DSi soft resetRSDuck2020-07-31
|
* fix unterminated string + remove some JIT loggingRSDuck2020-07-29
|
* for some reason tabs and spaces were mixedRSDuck2020-07-23
|
* attempt at fixing aarch64 linux yet againRSDuck2020-07-08
|
* fix for fastmem when pc is used as immediateRSDuck2020-07-08
| | | | and (hopefully) make SIGSEGV handler work for aarch64 linux
* misc JIT changesRSDuck2020-07-08
|
* make linux work and fix a few bugsRSDuck2020-07-04
|
* reconcile DSi and JIT, fastmem for x64 and WindowsRSDuck2020-06-30
|
* first steps in bringing over the JIT refactor/fastmemRSDuck2020-06-16