Commit Graph

1091 Commits

Author SHA1 Message Date
Yuri Kunde Schlesner 7ada357b2d Memmap: Re-organize memory function in two files
memory.cpp/h contains definitions related to acessing memory and
configuring the address space
mem_map.cpp/h contains higher-level definitions related to configuring
the address space accoording to the kernel and allocating memory.
2015-05-15 00:04:38 -03:00
Lioncash 150e700729 process: Get rid of warnings
Sign mismatches and "forcing value to bool" warnings.
2015-05-14 12:59:14 -04:00
Lioncash 207087c856 thread: Fix a conditional check in Reschedule 2015-05-14 11:10:04 -04:00
bunnei 7d21b0663b Merge pull request #756 from purpasmart96/ptm_service_changes
PTM: Changed the ptm services  to be like the IR, HID, and APT services.
2015-05-12 23:10:54 -04:00
bunnei cb2b2071a8 Merge pull request #748 from Subv/tls_max
Core/Memory: Add TLS support for creating up to 300 threads
2015-05-11 23:32:28 -04:00
bunnei ee8da4c356 Merge pull request #751 from yuriks/idle-thread
Thread: Remove the idle thread
2015-05-11 23:22:47 -04:00
bunnei 6e26d063a5 Merge pull request #757 from Subv/scheduling
Core/Scheduling: Prepare the new priority in the thread queue when svcSetPriority is called
2015-05-11 22:54:00 -04:00
Yuri Kunde Schlesner 4f7a055081 Thread: Remove the idle thread
Instead just use nullptr to represent no thread is active.
2015-05-11 22:39:39 -03:00
Subv dda94e56dd Core/Memory: Add TLS support for creating up to 300 threads 2015-05-11 20:09:23 -05:00
Yuri Kunde Schlesner 820b97787c Merge pull request #750 from Subv/process_svc
Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThread
2015-05-11 17:44:26 -07:00
Subv dbc1320923 Core/Scheduling: Prepare the new priority in the thread queue when svcSetPriority is called 2015-05-11 19:38:10 -05:00
purpasmart96 53130fffd9 PTM: Changed the way the ptm services are handled to be like the
IR, HID, and APT services.
2015-05-11 17:11:26 -07:00
Subv 25c010dc7d fixup! 2015-05-11 18:23:45 -05:00
purpasmart96 046044618d NWM_UDS: Fix a typo in the nwm service port name 2015-05-11 15:18:54 -07:00
Subv 41f74a16fd Core/HLE: Implemented the SVCs GetProcessId and GetProcessIdOfThread 2015-05-11 09:15:10 -05:00
Yuri Kunde Schlesner d16c2bd956 Thread: Correctly set main thread initial stack position 2015-05-11 05:08:47 -03:00
archshift e98fbadf4a Merge pull request #740 from yuriks/gsp-shmem
Fix crashes due to un-initialized GSP shared memory
2015-05-10 18:07:44 -07:00
Subv 115ad8e16a fixup! Set the TLS address in the scheduler 2015-05-10 18:43:59 -05:00
Subv 000876858d Core/Memory: Give every emulated thread it's own TLS area.
The TLS area for thread T with id Ti is located at TLS_AREA_VADDR + (Ti - 1) * 0x200.
This allows some games like Mario Kart 7 to continue further.
2015-05-10 18:35:37 -05:00
Yuri Kunde Schlesner fd85367621 fixup! GSP: Small tweaks to shared memory initialization 2015-05-10 20:09:41 -03:00
Yuri Kunde Schlesner 1538a34eda GSP: Small tweaks to shared memory initialization 2015-05-10 20:05:30 -03:00
Yuri Kunde Schlesner 774eea8374 Kernel: Zero-fill shared memory blocks when mapping
This works around crashes related to GSP/HID/etc. shared memory blocks
having garbage values. The proper fix requires proper management of
mapped memory blocks in the process.
2015-05-10 20:05:29 -03:00
Yuri Kunde Schlesner c96f22490a Kernel: Capture SharedMemory attributes at creation, not when mapping 2015-05-10 19:47:07 -03:00
Yuri Kunde Schlesner b700b55696 Common: Remove the BIT macro
When the macro was introduced in 326ec51261
it wasn't noticed that it conflicted in name with a heavily used macro
inside of dyncom. This causes some compiler warnings. Since it's only
lightly used, it was opted to simply remove the new macro.
2015-05-09 18:16:46 -03:00
Yuri Kunde Schlesner 1c0b87edc2 Memory: Re-organize and rename memory area address constants 2015-05-09 01:29:52 -03:00
Yuri Kunde Schlesner 7c50b999fa Kernel: Remove unused g_main_thread variable 2015-05-08 22:12:12 -03:00
Yuri Kunde Schlesner 3cb19c9589 Process: Rename StaticAddressMapping => AddressMapping 2015-05-08 22:12:10 -03:00
Yuri Kunde Schlesner 83ccf85bb2 Process: Add more documentation to the class members 2015-05-08 22:11:49 -03:00
Yuri Kunde Schlesner 2f5904611d Process: Use BitField to store process flags 2015-05-08 22:11:48 -03:00
Yuri Kunde Schlesner 2af30d465f Process: Support parsing of exheader kernel caps 2015-05-08 22:11:44 -03:00
Yuri Kunde Schlesner a5eba2f984 Kernel: Remove g_program_id
This has been obsoleted by the field in Process.
2015-05-08 22:11:03 -03:00
Yuri Kunde Schlesner 6d60acf0f1 Kernel: Introduce skeleton Process class to hold process data 2015-05-08 22:11:02 -03:00
Yuri Kunde Schlesner c956e8a686 Fix printf format warning 2015-05-07 15:45:22 -03:00
Yuri Kunde Schlesner e1fbac3ca1 Common: Remove common.h 2015-05-07 15:45:22 -03:00
Yuri Kunde Schlesner c0eaa662d4 Clean-up includes 2015-05-06 23:45:06 -03:00
Yuri Kunde Schlesner b89f644cfe FileSys: De-inline Path members 2015-05-06 23:45:06 -03:00
Yuri Kunde Schlesner 6f89d25f90 FileSys: Clean-up includes, de-inline destructors 2015-05-06 23:45:06 -03:00
Yuri Kunde Schlesner c916bcf7b5 Move typedefs from kernel.h to more appropriate places 2015-05-06 23:45:05 -03:00
Yuri Kunde Schlesner ecff2351a1 HLE: Clean up SVC dispatch mechanism 2015-05-06 00:24:39 -03:00
bunnei d3c2f9a4a4 HLE: Properly initialize and shutdown remaining modules. 2015-05-01 18:27:05 -04:00
bunnei c7dc799e19 Kernel: Properly initialize and shutdown all modules. 2015-05-01 18:27:03 -04:00
bunnei e0cb85691a Services: Initialize all state variables at bootup. 2015-05-01 18:27:02 -04:00
purpasmart96 8716445621 ConfigMem: Remove duplicate retail bit 2015-04-28 16:22:50 -07:00
bunnei 2cc6511039 Merge pull request #692 from purpasmart96/log_improvements
Services/Loader: Use more sensible log formats for certain functions along with more info being logged.
2015-04-28 10:12:50 -04:00
purpasmart96 c3a480160e Services/Loader: Use more sensible log formats for certain functions
along with more info being logged.
2015-04-27 23:07:08 -07:00
Lioncash 1baab50e7c ptm_sysm: Add static specifier to IsLegacyPowerOff 2015-04-24 18:23:20 -04:00
bunnei 3ee9f6c5d8 Merge pull request #696 from yuriks/interface-deinline
De-inline functions from Interface, removing them from service.h
2015-04-14 19:14:27 -04:00
Emmanuel Gil Peyrot 0d69b2f7bd Kernel: Use the correct format string for u64 hex. 2015-04-14 21:18:31 +02:00
Yuri Kunde Schlesner ad3e25b414 De-inline functions from Interface, removing them from service.h
This reduces the time for a full recompile from 65.43s to 59.53s (~9%)
2015-04-14 15:34:28 -03:00
bunnei db4bd98bac SVC: Assert on unsupported CreateThread processor ID. 2015-04-09 22:55:18 -04:00
bunnei c077bcefa9 SVC: Update various SVCs to cause a reschedule.
- CreateMutex/ReleaseMutex/ReleaseSemaphore/SetTimer/CancelTimer/ArbitrateAddress
2015-04-09 19:06:42 -04:00
bunnei 9c3419ebcc Kernel: Implemented priority inheritance for mutexes. 2015-04-09 19:06:39 -04:00
bunnei 7b9f428b23 Thread: Implement priority boost for starved threads.
SVC: Return correct error code on invalid CreateThread processor ID.

SVC: Assert when creating a thread with an invalid userland priority.
2015-04-09 19:05:21 -04:00
bunnei ee3377b67d SVC: Reschedule on svcCreateThread. 2015-04-09 19:04:20 -04:00
bunnei bdd190363d APT: (Subv) Fix bug where start event was being incorrectly signaled. 2015-04-09 19:04:19 -04:00
bunnei e08f55b1a7 Kernel: Fixed default thread priority. 2015-04-09 19:04:19 -04:00
Gareth Higgins 25a43cd2ec Initialize base address to 0x0 2015-04-08 20:34:41 -04:00
bunnei e630fd2a95 Merge pull request #676 from purpasmart96/ir_service_refc
IR: Move The IR services to their own folder and implement "GetHandles"
2015-04-07 23:01:07 -04:00
Yuri Kunde Schlesner 34b009cf38 Clean-up mem_map constants and fix framebuffer translation errors 2015-04-05 20:14:33 -03:00
purpasmart96 d6c9af600f IR: Move The IR services to their own folder and implement "GetHandles" 2015-04-03 19:36:03 -07:00
bunnei 3fd2cc566b Merge pull request #641 from purpasmart96/service_stubs
Services: Stubs and minor changes
2015-04-03 22:16:50 -04:00
purpasmart96 198c0ddc72 Services: Stubs and minor changes 2015-04-02 20:05:11 -07:00
purpasmart96 e0c72ec871 ConfigMem: Set the app memory to be 96MB instead of the default 64MB 2015-03-23 18:53:22 -07:00
bunnei 03ceb7adf9 Merge pull request #656 from Subv/nz
Services/FS: Implemented DeleteExtSaveData, CreateSystemSaveData and Del...
2015-03-22 14:58:38 -04:00
Subv b9612fe919 Service/FS: Document and log some unknown values.
In CreateExtSaveData, DeleteExtSaveData and CreateSystemSaveData
2015-03-19 17:39:00 -05:00
bunnei 0bb4b77b78 Merge pull request #655 from purpasmart96/hid_fixes
HID: Proper Signal Interrupts for EnableAccelerometer & EnableGyroscopeLow along  with a stub for GetSoundVolume
2015-03-17 10:19:59 -04:00
purpasmart96 5b1757d6a5 HID: Proper Signal Interrupts for EnableAccelerometer & EnableGyroscopeLow along
with a stub for GetSoundVolume
2015-03-16 18:55:58 -07:00
Lioncash 8cf81643a9 arm_interface: Get rid of GetTicks.
Removes a TODO.
2015-03-16 12:18:37 -04:00
Subv 1d61cd4460 Services/FS: Implemented DeleteExtSaveData, CreateSystemSaveData and DeleteSystemSaveData
Also fixed a bug with CreateExtSaveData that made it unable to create ExtSaveData archives in the SDMC directory.
2015-03-14 12:00:01 -05:00
bunnei ed5b275d21 Merge pull request #642 from bunnei/touchpad
Touchpad support
2015-03-11 21:28:57 -04:00
bunnei 4bbddda377 hid_user: Removed unnecessary includes. 2015-03-11 00:01:03 -04:00
bunnei e79c27f1e0 HID: Removed unnecessary global variables. 2015-03-11 00:00:39 -04:00
bunnei 85cbccb1d3 HID: Added additional variable comments and some code cleanups. 2015-03-10 23:58:13 -04:00
bunnei d61b26b79f HID: Complete refactor of pad/touch input to fix threading issues. 2015-03-10 23:58:07 -04:00
bunnei b56829df02 Merge pull request #629 from archshift/lcdfb
Implement SetLcdForceBlack and add implementation for color filling in the GPU code
2015-03-10 18:08:55 -04:00
bunnei a1a1a5c6c5 HID: Cleanup how `next_touch_index` is calculated for Pad and touch. 2015-03-10 18:05:19 -04:00
bunnei 432aa1044c HID: Changed TouchDataEntry `valid` to a BitField and added some doc strings. 2015-03-10 18:05:19 -04:00
bunnei e9b9f1842b HID: Added static asserts to check register position in shared memory. 2015-03-10 18:05:19 -04:00
bunnei 1a904ded40 HID: Added functions to emulate the touchpad. 2015-03-10 18:05:17 -04:00
bunnei 3229b048d9 HID: Moved some docstrings to the header. 2015-03-10 18:05:17 -04:00
bunnei 83a66dd701 HID: Refactored shared memory decoding for touchpad support. 2015-03-10 18:05:16 -04:00
archshift 041e99b613 Added LCD registers, and implementation for color filling in OGL code. 2015-03-09 15:51:41 -07:00
bunnei 8a1cc5b805 Merge pull request #589 from kevinhartman/config-errors
Fix errorcodes for bad config block request
2015-03-09 15:44:34 -04:00
Tony Wasserka 93e32bce72 Merge pull request #538 from yuriks/perf-stat
Add profiling infrastructure and widget
2015-03-07 15:30:40 +01:00
archshift 47010fea31 Implement SetLcdForceBlack, move register enum to hw.h 2015-03-05 19:38:23 -08:00
Subv 83a8975cb8 Services: Moved the PTM and APT services to their own folder
This coincidentally fixes an issue about the PTM service failing to create its SharedExtSaveData archive due to the FS service not being initialized by the time the creating code runs.

Ideally I'd like to move each process to its own folder, and have a single file per process that registers the service classes, which would be in their own files inside that folder. Then each service class would just call functions from the process to complete the commands.
2015-03-03 21:48:08 -05:00
Yuri Kunde Schlesner 44f46254dc Merge pull request #622 from Subv/titles
Services/AM: Stubbed TitleIDListGetTotal and GetTitleIDList.
2015-03-02 10:26:56 -03:00
Subv 9a72fb79fc Services/AM: Stubbed TitleIDListGetTotal and GetTitleIDList.
They will always return 0 titles for every media type for now.
This is needed to boot Home Menu further
2015-03-02 08:12:04 -05:00
bunnei d175f2b7f3 Merge pull request #623 from Subv/card
Services/FS: Stubbed CardSlotIsInserted to always return false
2015-03-01 22:49:29 -05:00
bunnei 9a47eb117c Merge pull request #618 from lioncash/ref
result: Make comparison operators take references
2015-03-01 22:27:28 -05:00
Yuri Kunde Schlesner cd1fbfcf1b Add profiling infrastructure and widget 2015-03-01 21:47:13 -03:00
Subv db1a5d4222 Services/FS: Stubbed CardSlotIsInserted to always return false
We won't be emulating this for the foreseeable future and it is needed for Home Menu to boot further
2015-02-28 23:00:46 -05:00
Subv c36778e602 Services/PTM: Stubbed PTM_Sysm::IsLegacyPowerOff.
This allows the Home Menu to boot further
2015-02-28 19:51:13 -05:00
Lioncash 99ff8bbb0c result: Make comparison operators take references
It's unnecessary to make copies for simple comparisons like this.
2015-02-27 21:16:21 -05:00
Yuri Kunde Schlesner 1b5ee96797 Merge pull request #604 from Subv/arc_ssd
Archives: Properly implemented the SystemSaveData archive.
2015-02-25 22:35:55 -03:00
Subv 9db5c9b6dc Archives: Properly implemented the SystemSaveData archive.
Ported to the new factory pattern we have for archives.
2015-02-25 19:37:10 -05:00
Subv ef66feaeba Services: Implemented Y2R_U::GetTransferEndEvent
Aero Porter was throwing an "Invalid Handle" fatal error without this.
2015-02-24 08:28:36 -05:00
bunnei 3700263f71 Merge pull request #595 from linkmauve/new-3ds-input
Frontends, HID: Add New 3DS specific pad buttons, and stub the touch one.
2015-02-23 21:13:29 -05:00
bunnei 50a0c4f14f Merge pull request #581 from archshift/tfe
Added information reporting from ThrowFatalError
2015-02-23 01:23:15 -05:00
archshift 0420a4d1de Added information reporting from ThrowFatalError
This was RE'd from the errdisp applet.
2015-02-22 12:19:30 -08:00
Emmanuel Gil Peyrot aa64f69af0 Frontends, HID: Add New 3DS specific pad buttons, and stub the touch one. 2015-02-22 21:09:08 +01:00
Kevin Hartman a6fdb8f217 Fix error message for bad config block request. 2015-02-20 21:47:58 -08:00
bunnei 5f9939070e Merge pull request #588 from archshift/somebranch
Sweeping cleanup of Common
2015-02-20 11:41:30 -05:00
archshift 4fb75d220a Misc cleanup of common and related functions 2015-02-19 22:26:25 -08:00
archshift 3c48697ea3 Convert a few C stdlib asserts to Citra's own asserts 2015-02-18 21:52:36 -08:00
Tony Wasserka 0da6a7e234 GPU: Properly implement memory fills. 2015-02-18 14:02:58 +01:00
bunnei 745b42d236 Merge pull request #570 from purpasmart96/config_mem
ConfigMem: Clean up the Config memory to be more like the shared page
2015-02-18 00:12:37 -05:00
purpasmart96 c3c309f33d ConfigMem: Clean up the Config memory to be more like the shared page and moved
the helper macro for padding to common_funcs.h
2015-02-16 15:12:05 -08:00
Subv cb3d254517 Services: Fixed "Tried to connect to named port err:f".
err:f is a named port, not a service
2015-02-16 15:24:15 -05:00
bunnei 12181c8a64 Merge pull request #529 from Subv/master
Build: Fixed some warnings
2015-02-14 15:50:26 -05:00
Lioncash 0c6434c379 core: Apply static to local functions 2015-02-13 10:48:32 -05:00
Subv 8e2b248e05 Build: Fixed some warnings 2015-02-12 09:25:35 -05:00
Kevin Hartman a56f3f290e Implemented WriteHWRegsWithMask for GSP. 2015-02-11 11:03:17 -08:00
archshift ef24e72b26 Asserts: break/crash program, fit to style guide; log.h->assert.h
Involves making asserts use printf instead of the log functions (log functions are asynchronous and, as such, the log won't be printed in time)
As such, the log type argument was removed (printf obviously can't use it, and it's made obsolete by the file and line printing)

Also removed some GEKKO cruft.
2015-02-10 18:30:31 -08:00
bunnei 168eb27aee GSP: Fixed typo in SignalInterrupt 2015-02-10 19:57:48 -05:00
bunnei 76e7d41f88 Merge pull request #552 from bunnei/setbufferswap-fix
GSP SetBufferSwap fix
2015-02-10 19:21:48 -05:00
bunnei 9eae2400c0 GSP: Call SetBufferSwap for each screen on corresponding signal interrupt. 2015-02-10 19:05:56 -05:00
bunnei ca22ee3239 Merge pull request #526 from purpasmart96/citra_stubs
Services: Stub some functions
2015-02-10 18:39:37 -05:00
Subv 0d2b6dd656 PTM: Fixed a problem with the gamecoin PTM file. 2015-02-10 13:43:46 -02:00
Subv 1bbf0567b1 Archives: Made the Format function more generic. 2015-02-10 13:43:46 -02:00
Subv 071663e074 Archives: Expose the File and Directory classes to HLE 2015-02-10 13:43:45 -02:00
Subv ca1a87ef7d ResultVal: Fixed compilation when reassigning a ResultVal. 2015-02-10 13:43:44 -02:00
Yuri Kunde Schlesner 3f1a3952d7 FS: Allow multiple instances of the same archive type to be open at once 2015-02-10 13:43:44 -02:00
Yuri Kunde Schlesner 4468625080 FS: Get rid of completely useless Archive class 2015-02-10 13:43:43 -02:00
Kevin Hartman 5fcbfc06eb Scheduler refactor Pt. 1
* Simplifies scheduling logic, specifically regarding thread status. It should be much clearer which statuses are valid
for a thread at any given point in the system.
* Removes dead code from thread.cpp.
* Moves the implementation of resetting a ThreadContext to the corresponding core's implementation.

Other changes:
* Fixed comments in arm interfaces.
* Updated comments in thread.cpp
* Removed confusing, useless, functions like MakeReady() and ChangeStatus() from thread.cpp.
* Removed stack_size from Thread. In the CTR kernel, the thread's stack would be allocated before thread creation.
2015-02-09 21:47:12 -08:00
bunnei 1b0bf00cbc Mutex: Locks should be recursive. 2015-02-09 22:06:09 -05:00
bunnei caa58acc84 WaitSynch: Always reschedule (verified behavior on hw). 2015-02-09 22:05:39 -05:00
purpasmart96 60ce36f721 Services: Stub some functions 2015-02-07 17:34:59 -08:00
Lioncash 676daef3c7 core: Fix some warnings on OSX 2015-02-03 08:14:42 -05:00
Yuri Kunde Schlesner 88a4a808c6 Kernel: Stop creating useless Handles during object creation
They're finally unnecessary, and will stop cluttering the application's
handle table.
2015-02-02 15:37:09 -02:00
Yuri Kunde Schlesner 52f58e64ef Kernel: Make WaitObjects share ownership of Threads waiting on them
During normal operation, a thread waiting on an WaitObject and the
object hold mutual references to each other for the duration of the
wait.

If a process is forcefully terminated (The CTR kernel has a SVC to do
this, TerminateProcess, though no equivalent exists for threads.) its
threads would also be stopped and destroyed, leaving dangling pointers
in the WaitObjects.

The solution is to simply have the Thread remove itself from WaitObjects
when it is stopped. The vector of Threads in WaitObject has also been
changed to hold SharedPtrs, just in case. (Better to have a reference
cycle than a crash.)
2015-02-02 15:37:08 -02:00
Yuri Kunde Schlesner 7725256f64 Explicitly instantiate constructors/destructors for Kernel objects
This should speed up compile times a bit, as well as enable more liberal
use of forward declarations. (Due to SharedPtr not trying to emit the
destructor anymore.)
2015-02-02 15:37:07 -02:00
Yuri Kunde Schlesner 4e84df8be3 Mutex: Replace g_mutex_held_locks with a set inside Thread 2015-02-02 15:37:06 -02:00
Yuri Kunde Schlesner 0f69668fc6 HID: Fix crash when pressing a key when the emulator is stopped 2015-02-02 15:37:05 -02:00
Yuri Kunde Schlesner c4208c1171 SVC: Enable CloseHandle, clean up DuplicateHandle 2015-02-02 15:37:04 -02:00
Yuri Kunde Schlesner e8330dd162 Kernel: Fix bug in HandleTable::Close 2015-02-02 15:37:04 -02:00
Yuri Kunde Schlesner 5354a479bc Kernel: Remove Object::GetHandle (it's not used anymore :D) 2015-02-02 15:37:04 -02:00
Yuri Kunde Schlesner 869ec46683 Kernel: Introduce unique Object ids for debugging 2015-02-02 15:37:03 -02:00
Yuri Kunde Schlesner a9b86db3cf Kernel: Use separate Handle tables for CoreTiming userdata
This is to support the removal of GetHandle soon
2015-02-02 15:37:03 -02:00
Yuri Kunde Schlesner ec9c773251 Kernel: Remove previous scheduled event when a Timer is re-Set 2015-02-02 15:37:02 -02:00
Yuri Kunde Schlesner 8441591659 FS: Remove use of GetHandle 2015-02-02 15:37:01 -02:00
Yuri Kunde Schlesner 664c79ff47 Thread: Modernize two functions that slipped through previous rebases 2015-02-02 15:37:01 -02:00
Yuri Kunde Schlesner 6e11570862 Service: Store function names as const char* instead of std::string
Uses less memory (strings and function table is stored in constant data)
and speeds up start up (no need to allocate and copy strings).
2015-02-02 15:37:00 -02:00
Yuri Kunde Schlesner a79d21c83e Service: Clean-up Interface 2015-02-02 15:36:59 -02:00
Yuri Kunde Schlesner 8779b31fe6 Make Port/Service registration and querying more HW-accurate 2015-02-02 15:36:59 -02:00
Yuri Kunde Schlesner 5e91fc0d1a Filesys: Move creation of Handles for File/Directory to service handlers 2015-02-02 15:36:58 -02:00
Lioncash 3f00dd9117 arm: Clean up ARMul_State
Remove unnecessary/unused struct variables.
2015-01-31 21:55:34 -05:00
Tony Wasserka 73a7a379d6 Merge pull request #512 from lioncash/assignment
shared_memory: Fix assignments in SharedMemory::Map
2015-01-31 12:59:00 +01:00
Lioncash 96c174aed4 shared_memory: Fix assignments in SharedMemory::Map 2015-01-30 11:37:53 -05:00
Lioncash 551264f815 archive: Fix initializer list order for the File class. 2015-01-30 11:30:22 -05:00
Lioncash 0c53cc52bd apt_u: Fix missing printf specifiers 2015-01-30 11:28:09 -05:00
Yuri Kunde Schlesner d917a9bf77 Kernel: Mark all appropriate kernel objects as "final" 2015-01-30 11:49:46 -02:00
Yuri Kunde Schlesner 58b544db99 SVC: Use CASCADE_RESULT in SVC handlers 2015-01-30 11:49:46 -02:00
Yuri Kunde Schlesner 09ae6e1fa3 Remove result.h InvalidHandle
It was only being used in two places, where it was replaced by a local
constant.
2015-01-30 11:49:45 -02:00
Yuri Kunde Schlesner 44f90340dc SVC: Change return type of handlers to ResultCode 2015-01-30 11:49:44 -02:00
Yuri Kunde Schlesner d52d859936 Kernel: Convert Event to not use Handles 2015-01-30 11:49:43 -02:00
Yuri Kunde Schlesner ad80ff1e32 Kernel: Convert Timer to (mostly) not use Handles 2015-01-30 11:47:07 -02:00
Yuri Kunde Schlesner 882b6fed75 Kernel: Convert Mutex to not use Handles 2015-01-30 11:47:06 -02:00
Yuri Kunde Schlesner 38e7122f23 Kernel: Convert AddressArbiter to not use Handles 2015-01-30 11:47:06 -02:00
Yuri Kunde Schlesner d9b19be1d9 Kernel: Convert Semaphore to not use Handles 2015-01-30 11:47:05 -02:00
Yuri Kunde Schlesner 4bb33dfc30 Kernel: Convert SharedMemory to not use Handles 2015-01-30 11:47:04 -02:00
Yuri Kunde Schlesner afc416c607 Additions to ResultVal to make it more convenient to use. 2015-01-30 11:47:02 -02:00
Yuri Kunde Schlesner b5ee4f9df9 Move VAddr/PAddr typedefs to kernel.h 2015-01-30 11:47:01 -02:00
Yuri Kunde Schlesner 9a345de2bd Kernel: Remove useless/duplicated comments; mark functions static 2015-01-30 11:47:01 -02:00
bunnei 206cabc0e4 Merge pull request #412 from purpasmart96/svc_table_cleanup
SVC: Update the SVC function table
2015-01-28 17:36:23 -05:00
purpasmart96 62f4365db1 SVC: Update the SVC function table 2015-01-26 20:42:28 -08:00
bunnei 326c451758 Merge pull request #345 from purpasmart96/apt_stubs
APT_U: Stub some functions & misc changes
2015-01-26 23:13:54 -05:00
bunnei e7dd4d34aa Merge pull request #485 from Subv/more_servs
Services: Stubbed more services.
2015-01-25 22:13:13 -05:00
Subv 2ea60bdc7f Services/HID: Removed some files due to a rebase error 2015-01-24 15:54:24 -05:00
Subv c2e9990149 Services: Stubbed more services.
Implemented FSUser::CreateExtSaveData
2015-01-24 15:44:40 -05:00
purpasmart96 2dd23b6467 APT_U: Stub some functions & misc changes 2015-01-22 16:03:48 -08:00
archshift 92a75df9b1 cam_u.h: fix indentation
Withholding my profanity towards Xcode.
2015-01-22 12:51:53 -08:00
bunnei 92550013cf Merge pull request #493 from archshift/ptmplay
Stubbed some services
2015-01-22 13:25:19 -05:00
bunnei 731154f79e WaitSynchronization: Added a result code for invalid result, fixed bug. 2015-01-21 20:49:43 -05:00
bunnei 68ddaaa2f5 Thread: Fix WaitSynchronization1 to not set register 1 on thread wakeup. 2015-01-21 20:48:46 -05:00
bunnei 4255f25647 Thread: Use std::find in CheckWait_WaitObject. 2015-01-21 20:48:46 -05:00
bunnei 2f3020a102 Mutex: Cleanup and remove redundant code. 2015-01-21 20:48:36 -05:00
bunnei f09806aed2 Kernel: Renamed some functions for clarity.
- ReleaseNextThread->WakeupNextThread
- ReleaseAllWaitingThreads->WakeupAllWaitingThreads.
2015-01-21 20:48:30 -05:00
bunnei 15b6a4d9ad Kernel: Changed "ShouldWait" to return bool and "Acquire" to return void. 2015-01-21 20:47:49 -05:00
bunnei c68eb15695 WaitObject: Renamed "Wait" to "ShouldWait", made "ShouldWait" and "Acquire" pure virtual. 2015-01-21 20:47:49 -05:00
bunnei 69c5830ef2 Event: Fix implementation of "non-sticky" events. 2015-01-21 20:47:48 -05:00
bunnei 9e6ec3b6cd Session: Change to a WaitObject. 2015-01-21 20:47:47 -05:00
bunnei d2759c578e Kernel: Reschedule on SignalEvent and SendSyncRequest, fix some bugs. 2015-01-21 20:47:47 -05:00
bunnei dde02f79af Mutex: Fix a bug where the thread should not wait if it already has the mutex. 2015-01-21 20:47:46 -05:00
bunnei 9412996c8f Kernel: Moved Wait and Acquire to WaitObject, added way to retrieve a WaitObject safely. 2015-01-21 20:47:46 -05:00
bunnei c06d64528a SVC: Removed a Sleep that made no sense
- Would deadlock the calling thread
- Code would never get hit anyways
2015-01-21 20:47:45 -05:00
bunnei 254e4ebd58 AddressArbiter: Changed to Kernel::Object, big cleanup, removed code that made no sense. 2015-01-21 20:47:45 -05:00
bunnei e5a9f1c644 Kernel: Get rid of WaitTypes and simplify lots of code, removing hacks. 2015-01-21 20:47:38 -05:00
bunnei 6deb1a0119 WaitSynchronizationN: Improved comments 2015-01-21 19:12:51 -05:00
bunnei 6643673f28 WaitSynchronizationN: Refactor to fix several bugs
- Separate wait checking from waiting the current thread
- Resume thread when wait_all=true only if all objects are available at once
- Set output to correct wait object index when there are duplicate handles
2015-01-21 19:11:47 -05:00
bunnei aa01c57ae9 Kernel: Separate WaitSynchronization into Wait and Acquire methods. 2015-01-21 19:10:24 -05:00
bunnei 627e96fc15 WaitSynchronizationN: Handle case where handles=nullptr. 2015-01-21 19:09:10 -05:00
bunnei f5c6d367c9 WaitSynchronizationN: Handle case where handle_count is invalid. 2015-01-21 19:09:09 -05:00
bunnei 064be2b86f WaitSynchronizationN: Handle case where handle_count=0. 2015-01-21 19:09:09 -05:00
bunnei 7faf2d8e06 WaitSynchronizationN: Implement return values 2015-01-21 19:09:03 -05:00
bunnei e4a5d8ad4f Event: Fixed some bugs and cleanup (Subv) 2015-01-21 18:43:50 -05:00
bunnei 1f7a04f05a Thread: Keep track of multiple wait objects. 2015-01-21 18:42:04 -05:00
bunnei 14cbbf4d9b Event: Get rid of permanent_lock hack. 2015-01-21 18:42:04 -05:00
bunnei 5e77e2e1de WaitObject: Added RemoveWaitingThread, fixed a bug, and cleanup. 2015-01-21 18:41:58 -05:00
bunnei c22bac6398 Kernel: Added WaitObject and changed "waitable" objects inherit from it. 2015-01-21 18:41:00 -05:00
archshift 1f109c6b49 Added HID_SPVR service and split HID_U implementation into service/hid/hid.xxx 2015-01-21 13:31:10 -08:00
archshift a68dda6328 Stubbed cam:u service 2015-01-21 12:50:18 -08:00
archshift 7516ceaf93 Stubbed ptm:play service 2015-01-21 12:50:18 -08:00
Lioncash a3f5e5605c core: Fix a few docstrings 2015-01-20 13:52:44 -05:00
bunnei cbbe9e1500 Merge pull request #492 from archshift/apt
Expose GetSharedFont and NotifyToWait to APT:A and APT:S respectively
2015-01-20 12:55:53 -05:00
bunnei be8f665142 Merge pull request #383 from zhuowei/shared_page
Add some support for the shared page
2015-01-18 18:31:52 -05:00
archshift 4d316cbd8e Expose GetSharedFont and NotifyToWait to APT:A and APT:S respectively 2015-01-18 15:15:14 -08:00
Zhuowei Zhang edb8450420 Add some support for the shared page (currently 3d slider is implemented) 2015-01-15 22:16:13 -05:00
bunnei 2572a62480 APT: Fix typo in setting return code for NotifyToWait 2015-01-15 18:23:53 -05:00
bunnei 350c5a7e32 DSP: Removed useless spam log for SignalInterrupt 2015-01-15 18:20:58 -05:00
bunnei 4b47ed6194 Merge pull request #482 from yuriks/fix-vblank
Correctness fixes for GPU flipping and interrupts
2015-01-15 18:11:03 -05:00
bunnei 3ff5a80d46 Merge pull request #481 from Subv/hm_b
APTU: Stubbed NotifyToWait, taken from 3dmoo.
2015-01-14 21:39:49 -05:00
Sebastian Valle fd1b600e05 APT: Fixed the comment style in some variables 2015-01-14 10:14:22 -05:00
bunnei 394d44cf74 Merge pull request #480 from Subv/arb_2
AddrArbiter: Implement arbitration types 3 and 4.
2015-01-14 10:04:33 -05:00
Yuri Kunde Schlesner 7630b31672 GSP: Fix appending of interrupts to the shared memory buffer
The code was previously appending the interrupt to after the end of the
buffer, instead of at the end.
2015-01-14 05:20:13 -02:00
Yuri Kunde Schlesner 5961a2852d GSP: Update framebuffer info on all interrupts
Hardware testing determined that the GSP processes shared memory
framebuffer update info even when no memory transfer or filling GX
commands are used. They are now updated on every interrupt, which isn't
confirmed correct but matches hardware behaviour more closely.

This also reverts the hack introduced in #404. It made a few games
behave better, but I believe it's incorrect and also breaks other games.
2015-01-14 05:20:12 -02:00
Yuri Kunde Schlesner 98e3274935 GPU: Fire GPU interrupts at the correct places.
PDC0 and PDC1 are both VBlank interrupts. PDC0 was being treated as a
HBlank interrupt and fired many more times than it should. They now both
fire together at 60 Hz. This puzzlingly *improves* apparent framerate on
many applications.

A few other interrupts were being fired inside the GSP command
processing instead of on the actual GPU register writes, so they were
moved there, which should cover direct writes tho those registers not
going through the GX command queue.
2015-01-14 05:07:35 -02:00
Subv 728c932dba APTU: Stubbed NotifyToWait, taken from 3dmoo.
Also renamed some handles in the APT:U service to be more descriptive.
Fixed a typo in InquireNotification
2015-01-13 19:18:10 -05:00
Subv 9e2ae289b8 AddrArbiter: Implement arbitration types 3 and 4. 2015-01-13 14:49:26 -05:00
Subv cf071cd897 Services: Added some missing services.
cfg:s, ptm:sysm, apt:s.
apt:s is almost exactly the same as apt:u as per 3dbrew
2015-01-13 14:43:30 -05:00
darkf 67c644e317 Fix building on MinGW 2015-01-11 20:22:08 -08:00
bunnei b33380ca59 Merge pull request #456 from Subv/waitsync1
SVC: Wake up the thread after the delay in WaitSync1
2015-01-11 18:52:09 -05:00
bunnei 542b0b0057 Merge pull request #466 from Subv/wake
Thread: Prevent waking a thread multiple times.
2015-01-11 13:39:23 -05:00
Subv b68d51ed30 Thread: Prevent waking a thread multiple times.
If a thread was woken up by something, cancel the wakeup timeout.
2015-01-11 13:18:52 -05:00
Subv 38da198aa1 SVC: Wake up the thread after the delay in WaitSync1 2015-01-11 10:42:59 -05:00
archshift 3b555e2512 Stubbed y2r:u IsBusyConversion
There is no documentation available on this function, but we set the result to false as a stub.
This allows Super Little Acorns to move all the way in game with pp3c.
2015-01-10 22:47:31 -08:00
archshift 95be6ad7ae Added Archive ID to fs:USER debug logs involving opening the archive. 2015-01-10 14:32:11 -08:00
archshift 228843c43e Logging: Log all called service functions (under trace). Compile out all trace logs under release for performance. 2015-01-10 14:32:10 -08:00
Yuri Kunde Schlesner 8ad41775cc Kernel: Start using boost::intrusive_ptr for lifetime management 2015-01-09 19:43:52 -02:00
Yuri Kunde Schlesner d751de7341 Kernel: Don't re-assign object's handle when duplicating one 2015-01-09 19:43:51 -02:00
bunnei 6ae12424df Merge pull request #444 from yuriks/handle-reform2
Kernel Lifetime Reform Pt. 2
2015-01-09 12:59:35 -05:00
bunnei 86e07124ad Merge pull request #436 from kevinhartman/system-core
Warn if a new thread is intended to be run on the system CPU core
2015-01-09 11:14:35 -05:00
Yuri Kunde Schlesner 78ea76e12f Thread: Fix nullptr access in a logging function 2015-01-09 04:02:28 -02:00
Yuri Kunde Schlesner 7f1557fbbd Thread: Rename thread_queue => thread_list 2015-01-09 04:02:17 -02:00
Yuri Kunde Schlesner 9bf8462b96 Thread: Reduce use of Handles and move some funcs to inside the class. 2015-01-09 04:02:15 -02:00
Yuri Kunde Schlesner ba72208cd4 Kernel: Move Thread's definition to the header file 2015-01-09 03:51:55 -02:00
Yuri Kunde Schlesner 7b3452c730 Move ThreadContext to core/core.h and deal with the fallout 2015-01-09 03:51:55 -02:00
bunnei d46f650036 Merge pull request #255 from Subv/cbranch_3
Implemented timers
2015-01-08 22:38:33 -05:00
Subv 07044651ef SVC: Implemented the Timer service calls. 2015-01-08 21:22:14 -05:00
Subv dfc440785a SVC: Fixed SleepThread.
It will now properly wait the specified number of nanoseconds and then wake up the thread.
2015-01-08 18:39:12 -05:00
Subv 60a373a786 Threads: Use a dummy idle thread when no other are ready.
This thread will not actually execute instructions, it will only advance the timing/events and try to yield immediately to the next ready thread, if there aren't any ready threads then it will be rescheduled and start its job again.
2015-01-07 20:31:31 -05:00
bunnei b659cac2dc Merge pull request #404 from bunnei/more-frame-synch-fixes
GPU: Toggle active framebuffer each frame
2015-01-07 18:13:48 -05:00
bunnei f7a3f45f1e GSP: Toggle active framebuffer each frame 2015-01-07 18:06:00 -05:00
bunnei e6864a1f41 Merge pull request #431 from yuriks/thread-queue-cleanup
Common: Clean up ThreadQueueList
2015-01-07 17:58:31 -05:00
Kevin Hartman 63be6aaadd Warn if a new thread is intended to be run on the system CPU core until we implement correct scheduling for such a thread. 2015-01-07 14:14:48 -08:00
Yuri Kunde Schlesner 122c2bb324 Common: Clean up ThreadQueueList
Replace all the C-style complicated buffer management with a std::deque.
In addition to making the code easier to understand it also adds support
for non-POD IdTypes.

Also clean the rest of the code to follow our code style.
2015-01-07 18:38:25 -02:00
Yuri Kunde Schlesner a6ad68190f Fix double-free in Service manager during shutdown
Fixes #423.
2015-01-07 17:32:31 -02:00
bunnei 088863c921 Merge pull request #376 from Subv/arc_reorder
Archives: Change the folder layout of some archives.
2015-01-06 20:13:56 -05:00
Subv 32dbb76e00 Archives: Changed the unimplemented archives comment.
It now refers to me as the PoC
2015-01-06 15:34:37 -05:00
Subv 5244ac0e9c Archives: Addressed some comments 2015-01-06 15:02:30 -05:00
bunnei 9eaef4e04a Merge pull request #413 from purpasmart96/serv_clean
Services: Clean up a few things and add a few function names
2015-01-05 22:48:58 -05:00
bunnei 9b83f0e158 Merge pull request #272 from rohit-n/sign-compare
Silence some -Wsign-compare warnings.
2015-01-05 22:10:56 -05:00
purpasmart96 379b39e583 Services: Clean up a few things and add a few function names 2015-01-05 16:07:15 -08:00
bunnei e9650f1c61 DSP: Signal (faked) interrupt on every frame.
- Hack to work around games checking that the DSP event has been signaled by a real DSP interrupt.
2015-01-05 00:25:37 -05:00
bunnei cc23269ff4 Merge pull request #407 from Subv/arbiter
AddressArbiter: Ported arbitration type 2 from 3dmoo.
2015-01-05 00:05:50 -05:00
bunnei 96e6b2aa50 Merge pull request #408 from Subv/mutex
Mutex: Add the calling thread to the waiting list when needed
2015-01-04 22:55:53 -05:00
bunnei 26f31a2dfb Merge pull request #386 from archshift/y2ru
Stub the y2r:u service
2015-01-04 21:40:58 -05:00
Subv ea80363cc2 Mutex: Add the calling thread to the waiting list when needed
This will happen when the mutex is already owned by another thread. Should fix some issues with games being stuck due to waiting threads not being awoken.
2015-01-04 12:52:34 -05:00
Subv 90dffe3fc1 Archives: Make SYSTEM_ID and SDCARD_ID strings 2015-01-04 09:10:27 -05:00
Subv 71a063f45c Archives: Changed the way paths are built for the archives.
Each archive now takes a mount point of either NAND or SDMC, and builds its own directory structure there, trying to simulate an HLE-friendly hardware layout
2015-01-03 20:46:05 -05:00
archshift 48130b1eaa Stub the y2r:u service 2015-01-03 16:42:39 -03:00
Subv 0276a75f24 AddressArbiter: Ported arbitration type 2 from 3dmoo.
(Thanks 3dmoo!)
2015-01-03 12:09:11 -05:00
Subv 3bc9f5509b Archives: Change the folder layout of some archives.
This is to better represent the hardware layout, they are still aren't quite accurate, but this better and will help a bit when implementing the other archives like NAND-RO and NAND-RW
2015-01-02 21:55:13 -05:00
Subv aade417b14 Archives: Reduced duplicate code in RomFS and SaveCheck.
Fixed a few warnings and cleaned up the code
2015-01-02 21:13:54 -05:00
Subv 13efbdc201 SaveDataCheck: Preliminary work in this archive.
This allows Steel Diver to boot further, some files are needed.

This is still not ready and needs a big cleanup, this will possibly be delayed until the way we handle archives is fixed (with factory classes instead of ahead-of-time creation of archives)
2015-01-02 21:13:53 -05:00
bunnei 3d9bf13439 Merge pull request #391 from lioncash/pedantic
archive/elf: Minor misc changes.
2015-01-02 21:04:49 -05:00
Lioncash 0d81b1e75b archive: Fix initializer list order 2015-01-02 20:30:57 -05:00
Lioncash bdbd111c7e soc_u: Fix a missing formatting argument 2015-01-02 19:54:21 -05:00
Rohit Nirmal c589d82052 Silence some -Wsign-compare warnings. 2015-01-01 16:38:36 -06:00
Subv 97a7381d29 SOC_U: Preliminary implementation of sockets.
Stubbed CreateMemoryBlock

Using Berkeley sockets, and Winsock2.2 on Windows.
So far ftpony creates the socket and accepts incoming connections

SOC_U: Renamed functions to maintain consistency

Also prevents possible scope errors / conflicts with the actual Berkeley socket functions

SOCU: Close all the opened sockets when cleaning up SOCU
2014-12-31 10:51:44 -05:00
Subv 545ded954d APT:A: Some style changes 2014-12-29 22:59:28 -05:00
Subv 2c89d4d5cd Archives: Implemented ExtSaveData and SharedExtSaveData
They will be stored in /extsavedata/SDMC and /extsavedata/NAND respectively.
Also redirect some APT_A functions to their APT_U equivalents.
Implemented the gamecoin.dat file in SharedExtSaveData in the PTM module.
Implemented formatting the savegame.
Retake a previous savegame if it exists instead of reporting them as not formatted every time a game is loaded.
2014-12-29 22:29:55 -05:00
Yuri Kunde Schlesner 7e2903cb74 Kernel: New handle manager
This handle manager more closely mirrors the behaviour of the CTR-OS
one. In addition object ref-counts and support for DuplicateHandle have
been added.

Note that support for DuplicateHandle is still experimental, since parts
of the kernel still use Handles internally, which will likely cause
troubles if two different handles to the same object are used to e.g.
wait on a synchronization primitive.
2014-12-28 11:52:55 -02:00
Yuri Kunde Schlesner 23f2142009 Kernel: Replace GetStaticHandleType by HANDLE_TYPE constants 2014-12-28 11:52:53 -02:00
Yuri Kunde Schlesner 73fba22c01 Rename ObjectPool to HandleTable 2014-12-28 11:52:52 -02:00
bunnei e5ddbfee02 Merge pull request #339 from bunnei/fixup-gsp-synch
Fixup gsp synch
2014-12-25 22:52:40 -05:00
bunnei 5d2ee78d8f Merge pull request #330 from purpasmart96/new_srv
More services & small clean ups
2014-12-25 22:51:38 -05:00
bunnei 4783133bbd ARM: Add a mechanism for faking CPU time elapsed during HLE.
- Also a few cleanups.
2014-12-25 22:46:44 -05:00
purpasmart96 9796bc1fa2 More services & small clean ups 2014-12-25 19:08:33 -08:00
archshift 81a538ccc2 Stubbed IsSdmcWriteable to always return writeable. 2014-12-23 22:22:48 -03:00
bunnei 2188af4a65 Merge pull request #322 from chinhodado/master
More warning cleanups
2014-12-22 00:12:43 -05:00
Subv 2030f9d946 CFG: Fixed some warnings and errors in Clang 2014-12-21 18:25:49 -05:00
Subv 304735fb52 CFG: More style changes 2014-12-21 18:02:27 -05:00
Subv f080e3ccfa CFGU: Indentation 2014-12-21 17:54:14 -05:00
Subv 6f304d3b00 CFG: Some indentation 2014-12-21 17:41:35 -05:00
Subv b3cee19289 CFG: Changed the CreateConfigInfoBlk search loop 2014-12-21 17:26:51 -05:00
Subv 3e94b9054c CFG: Corrected the licenses in cfg_i.cpp and cfg_u.cpp 2014-12-21 16:45:13 -05:00
Subv 6115f013a9 CFG: Create a new subfolder cfg inside service to handle cfg
Moved most of the shared CFG code there, implemented a few CFG:I functions
2014-12-21 16:41:06 -05:00
Subv 9e45240e23 CFGU: Some changes 2014-12-21 16:39:29 -05:00
Subv cdd78fa01d CFGU: Addressed some issues. 2014-12-21 16:39:26 -05:00
Subv 718a120754 CFGU: Addressed some comments. 2014-12-21 16:39:23 -05:00
Subv a1b9b80a55 Style: Addressed some comments 2014-12-21 16:39:20 -05:00
Subv a7cc7972de CFG_U: Use Common::make_unique instead of the std version 2014-12-21 16:39:17 -05:00
Subv 9029efd873 CFG:U: Implemented some more blocks 2014-12-21 16:39:14 -05:00
Subv 8b0ee93526 CFG: Implemented block 0x00070001 in the config savefile 2014-12-21 16:39:11 -05:00
Subv b3d1c8ba6a CFGU: Use an absolute offset in the config savefile blocks 2014-12-21 16:39:08 -05:00
Subv 95ca6ae1e1 CFG: Load the Config savedata file if it already exists. 2014-12-21 16:39:05 -05:00
Subv b49bdb6ba7 CFGU: Added block 0x000A0002 to the default savegame file
That's the language id block, we're using LANGUAGE_EN for now. This block allows some games to boot further
2014-12-21 16:39:02 -05:00
Subv 4cd21b43c1 CFG: Refactored how the config file works.
It is now kept in memory as per 3dbrew, all updates happen on memory, then they can be saved using UpdateConfigNANDSavegame.
2014-12-21 16:38:59 -05:00
Subv 462740278d CFG:U: Add some data to the 0x00050005 config block.
Seems to allow some games to boot further, thanks @Normmatt for sharing this information
2014-12-21 16:38:57 -05:00
Subv fa3d72ab3e CFG: Implemented the GetConfigInfoBlk2 function.
Added a "config" file to the CFG process service (CFG:U), and added a few default blocks to it.

Implemented GetSystemModel and GetModelNintendo2DS
2014-12-21 16:38:54 -05:00
bunnei 0de6a08d75 Merge pull request #291 from purpasmart96/license
License change
2014-12-21 16:05:44 -05:00
Chin 0199a7d9ef More warning cleanups 2014-12-21 10:58:55 -05:00
bunnei 572ce043c2 Merge pull request #271 from archshift/createf
Added CreateFile to the FS_USER service
2014-12-21 01:45:00 -05:00
archshift 0625dd09ea Added CreateFile to the FS_USER service
Tested with hwtests.
2014-12-21 02:21:49 -03:00
purpasmart96 ebfd831ccb License change 2014-12-20 21:20:24 -08:00
bunnei 4fcdbed9f6 Thread: Wait current thread on svc_SleepThread
- Removed unused VBLANK sleep mode
- Added error log for bad context switch
- Renamed VerifyWait to CheckWaitType to be more clear
2014-12-20 23:20:19 -05:00
bunnei 2e5869c939 Merge pull request #316 from yuriks/thread-handle
Kernel: Implement support for current thread pseudo-handle
2014-12-20 16:36:01 -05:00
bunnei 2b0d7a1d29 Merge pull request #315 from chinhodado/master
Clean up some warnings
2014-12-20 11:59:18 -05:00
Chin e795692614 Clean up some warnings 2014-12-20 10:03:36 -05:00
Yuri Kunde Schlesner 82528ba7df Common: Add a clone of std::make_unique 2014-12-20 03:45:02 -02:00
Yuri Kunde Schlesner adee775f44 Kernel: Implement support for current thread pseudo-handle
This boots a few (mostly Nintendo 1st party) games further.
2014-12-20 03:27:47 -02:00
bunnei f1309e6bf0 Merge pull request #306 from Subv/even_more_savedata
SaveData: Added some documentation to FormatSaveData
2014-12-19 23:20:31 -05:00
Subv fc73bef692 FS_U: Added the command to the docs of SaveData functions 2014-12-19 22:45:39 -05:00
bunnei 017e6a488e Merge pull request #302 from purpasmart96/flushshutup
GSP_GPU: Shut up FlushDataCache
2014-12-18 23:40:10 -05:00
purpasmart96 b2c64eb5ff GSP_GPU: Shut up FlushDataCache 2014-12-18 16:39:55 -08:00
bunnei 765dbabdb6 Merge pull request #308 from Subv/more_savedata
SystemSaveData: Fixed a typo that was segfaulting
2014-12-18 18:05:03 -05:00
Subv 78e0f36857 SystemSaveData: Fixed a typo that was segfaulting 2014-12-18 18:01:47 -05:00
bunnei c71f8840e5 Merge pull request #301 from Subv/more_savedata
SaveData: Implemented the SystemSaveData archive.
2014-12-18 17:29:34 -05:00
Subv 77f0cdfaf4 SaveData: Added some documentation to FormatSaveData
We still don't know what the other parameters do, but they appear to be very similar to those of FormatThisUserSaveData.
Most likely FormatThisUserSaveData is just an alias for FormatSaveData with LowPathType Empty
2014-12-18 15:30:28 -05:00
Subv bec527fa24 SaveData: Implemented the SystemSaveData archive.
It will be stored in the /syssavedata folder. This archive is user by various Services and possibly games via the FS:U service.
2014-12-17 23:44:32 -05:00
bunnei 7bae450379 Merge pull request #185 from purpasmart96/mem_perm
Kernel: Add missing permissions
2014-12-17 20:56:04 -05:00
Subv ea9ce0fba7 Filesystem/Archives: Implemented the SaveData archive
The savedata for each game is stored in /savedata/<ProgramID> for NCCH files. ELF files and 3DSX files use the folder 0 because they have no ID information

Got rid of the code duplication in File and Directory

Files that deal with the host machine's file system now live in DiskFile, similarly for directories and DiskDirectory and archives with DiskArchive.

FS_U: Use the correct error code when a file wasn't found
2014-12-17 19:21:38 -05:00
Yuri Kunde Schlesner 082bf803ab Comment out empty arrays causing compile errors in MSVC 2014-12-16 01:37:13 -02:00
bunnei cd2a31eaf4 Merge pull request #283 from yuriks/archive-refactor
Archive refactor
2014-12-15 22:15:08 -05:00
Yuri Kunde Schlesner 666f6deb47 Work around libstdc++'s lack of support for std::hash on enums 2014-12-16 01:09:21 -02:00
Yuri Kunde Schlesner 83e6e4ffec FS.Archive: Clean up treatment of archives and their handles
- Refactor FS::Archive internals to make Archive creation and lifetime
  management clearer.
- Remove the "Archive as a File" hack.
- Implement 64-bit Archive handles.
2014-12-16 01:08:44 -02:00
Yuri Kunde Schlesner 0931a42af0 Service.FS: Rename FileSys::File to FileBackend 2014-12-16 01:08:43 -02:00
Yuri Kunde Schlesner d51afab0bc Service.FS: Rename FileSys::Directory to DirectoryBackend 2014-12-16 01:08:43 -02:00
Yuri Kunde Schlesner 82fe821e87 Service.FS: Rename FileSys::Archive to ArchiveBackend 2014-12-16 01:08:42 -02:00
Yuri Kunde Schlesner f6153679b0 Service.FS: Do archive registration using IdCode instead of name 2014-12-16 01:08:42 -02:00
Yuri Kunde Schlesner ca67bb7945 HLE: Rename namespaces to match move & fix initialization order 2014-12-16 01:08:38 -02:00
Yuri Kunde Schlesner c72ccfa6db HLE: Move kernel/archive.* to service/fs/ 2014-12-16 01:08:14 -02:00
bunnei 5df176425b Merge pull request #282 from archshift/services
Added stubs for ldr:ro, cecd:u, nim:aoc, and am:app services
2014-12-15 19:28:13 -05:00
archshift 89eef9eb6d Added stub for nim:aoc service... 2014-12-15 15:32:42 -08:00
archshift 1356a6b313 Added stub for cecd:u service...
I couldn't find any information about this service...
2014-12-15 15:32:42 -08:00
archshift 6117fad036 Added stub for ldr:ro service... 2014-12-15 15:32:42 -08:00
archshift 6b51683bb1 Added am:app service stub.
Apparently nothing at all is known about this service...
2014-12-15 15:32:41 -08:00
Yuri Kunde Schlesner e321decf98 Remove SyncRequest from K::Object and create a new K::Session type
This is a first step at fixing the conceptual insanity that is our
handling of service and IPC calls. For now, interfaces still directly
derived from Session because we don't have the infrastructure to do it
properly. (That is, Processes and scheduling them.)
2014-12-15 18:26:17 -02:00
Subv 1051795c32 Kernel/Semaphores: Fixed build 2014-12-13 13:43:01 -05:00
Subv ea95876431 Kernel/Semaphore: Small style change 2014-12-13 13:40:19 -05:00
Subv effb181888 Kernel/Semaphores: Invert the available count checking.
Same semantics, idea by @yuriks
2014-12-13 13:40:18 -05:00
Subv 5e25986235 Kernel/Semaphores: Addressed some issues. 2014-12-13 13:40:16 -05:00
Subv cc81a510e3 Semaphore: Removed an unneeded function 2014-12-13 13:40:15 -05:00
Subv 61434651d8 Semaphores: Addressed some style issues 2014-12-13 13:40:13 -05:00
Subv abff4a7ee2 Semaphore: Implemented the initial_count parameter. 2014-12-13 13:40:12 -05:00
Subv 49b31badba SVC: Implemented ReleaseSemaphore.
This behavior was tested on hardware, however i'm still not sure what use the "initial_count" parameter has
2014-12-13 13:40:10 -05:00
Subv 82c84883a5 SVC: Implemented svcCreateSemaphore
ToDo: Implement svcReleaseSemaphore
* Some testing against hardware needed
2014-12-13 13:40:09 -05:00
Lioncash cfc0ee9c60 kernel: Remove unused log arguments 2014-12-13 10:15:58 -05:00
Yuri Kunde Schlesner 0600e2d8b5 Convert old logging calls to new logging macros 2014-12-13 02:08:02 -02:00
Yuri Kunde Schlesner 616d874443 New logging system 2014-12-13 01:59:52 -02:00
bunnei a6791e4fc7 Merge pull request #267 from bunnei/apt-shared-font
APT shared font loading
2014-12-12 22:12:12 -05:00
bunnei 6fe61d3deb APT_U: Added GetSharedFont service function. 2014-12-12 22:06:10 -05:00
bunnei 988998cca5 DSP: Added stub for ReadPipeIfPossible. 2014-12-12 00:53:51 -05:00
bunnei 4cb7a44d4e MemMap: Renamed "GSP" heap to "linear", as this is not specific to GSP.
- Linear simply indicates that the mapped physical address is always MappedVAddr+0x0C000000, thus this memory can be used for hardware devices' DMA (such as the GPU).
2014-12-12 00:15:47 -05:00
bunnei 3a75c8069e Merge pull request #256 from Subv/mutex
Kernel/Mutex: Properly lock the mutex when a thread enters it
2014-12-10 22:52:55 -05:00
Emmanuel Gil Peyrot 5a3b1b5f44 CFG:U: Store country codes as u16 instead of char pointers, and return the correct error in GetCountryCodeID. 2014-12-10 22:33:23 +00:00
bunnei f94d8f9603 GSP: Trigger GPU interrupts at more accurate locations. 2014-12-09 19:07:14 -05:00
bunnei e90b37b935 GSP: Updated TriggerCmdReqQueue to return success code. 2014-12-09 19:07:14 -05:00
bunnei 3e1654eaa8 GSP: Updated RegisterInterruptRelayQueue to return expected magic number. 2014-12-09 19:07:14 -05:00
bunnei 170123982d GPU: Fixed bug in command list size decoding. 2014-12-09 19:07:13 -05:00
bunnei b7327f807c Merge pull request #217 from archshift/cmd_buff
Log the cmd_buff arguments when citra comes across an unimplemented function
2014-12-08 23:13:07 -05:00
bunnei dd203f7068 Thread: Fixed to wait on address when in arbitration. 2014-12-08 19:44:10 -05:00
archshift 20d2ed0950 Make OpenDirectory fail if the directory doesn't exist
This is in line with what the hardware itself does.

It does this by splitting the initial directory opening into Directory.Open(), which will return false if a stat fails.
Then, Archive::OpenDirectory will return nullptr, and archive.cpp will return an error code .
2014-12-07 14:47:14 -08:00
Subv bc318c464b Mutex: Remove some forward declarations
Moved Mutex::WaitSynchronization to the end of the file.
2014-12-07 15:57:28 -05:00
Subv 64128aa61a Mutex: Release all held mutexes when a thread exits. 2014-12-07 15:44:21 -05:00
Subv e3c8e4901c Mutex: Properly lock the mutex when a thread enters it
Also resume only the next immediate thread waiting for the mutex when it is released, instead of resuming them all.
2014-12-05 23:40:43 -05:00
bunnei 17fae11fc7 Merge pull request #250 from Subv/cbranch_2
SVC: Implemented GetThreadId.
2014-12-04 22:15:03 -05:00
bunnei 5056329a80 Merge pull request #222 from archshift/renamexyz
Implemented RenameFile and RenameDirectory in FS:USER
2014-12-04 22:07:47 -05:00
bunnei 21d183e1e6 Merge pull request #248 from lioncash/kernel
Misc minor kernel-related changes.
2014-12-04 22:05:20 -05:00
Subv 6fac2bf0ab Threads: Remove a redundant function.
Use the next_thread_id variable directly.
2014-12-04 14:59:56 -05:00
Subv ef1d5cda06 Threads: Implemented a sequential thread id 2014-12-04 08:13:53 -05:00
archshift 139a4d91d9 Updated archive.cpp functions for proper error handling 2014-12-03 22:50:44 -08:00
Subv 029ff9f1fd SVC: Implemented GetThreadId.
For now threads are using their Handle value as their Id, it should not really cause any problems because Handle values are unique in Citra, but it should be changed. I left a ToDo there because this is not correct behavior as per hardware.
2014-12-04 00:25:35 -05:00
bunnei 306b5392ca Merge pull request #247 from lioncash/const
hid_user: Pass by reference with PadButtonPress/PadButtonRelease
2014-12-03 23:56:35 -05:00
bunnei abbc340957 Merge pull request #238 from archshift/dsp
Add stub for ConvertProcessFromDspDram
2014-12-03 23:35:06 -05:00
archshift a404ad5272 Add stub for ConvertProcessFromDspDram
Should theoretically push retail stuff further along
2014-12-03 20:03:57 -08:00
Lioncash 208598dbe2 kernel: Shorten GetCount 2014-12-03 22:52:02 -05:00
Lioncash 9b68d5e074 kernel: Make some functions const 2014-12-03 19:48:34 -05:00
Lioncash 7ff8f0d916 hid_user: Pass by reference with PadButtonPress/PadButtonRelease 2014-12-03 19:33:54 -05:00
purpasmart96 16fc98af64 PTM_U: Added a stub for GetBatteryLevel & GetBatteryChargeState & GetAdapterState 2014-12-03 15:09:59 -08:00
bunnei e5b2733801 Merge pull request #231 from purpasmart96/serv_ac_wifi_status
AC_U: Added a stub for GetWifiStatus
2014-12-03 10:00:13 -05:00
bunnei e2e56c7bac Merge pull request #219 from Subv/ptm
PTM_U: Implemented the GetShellState function.
2014-12-03 09:58:52 -05:00
purpasmart96 32d420330d AC_U: Added a stub for GetWifiStatus 2014-12-02 15:30:42 -08:00
bunnei 884ecd58ea Merge pull request #224 from bunnei/dsp-service-improvements
Dsp service improvements
2014-11-30 23:21:34 -05:00
bunnei b0a5b3d986 Merge pull request #214 from Subv/master
CFG:U: Implemented the GetCountryCodeID and GetCountryCodeString
2014-11-30 23:19:07 -05:00
bunnei 3e286fff7c DSP: Added stubs for several commonly used DSP service functions. 2014-11-30 23:14:57 -05:00
bunnei 45fd3fe5c4 DSP: Fixed typo in port name. 2014-11-30 23:14:48 -05:00
Subv 4cdaac44d3 PTM_U: Implemented the GetShellState function. 2014-11-30 19:50:14 -05:00
bunnei e3d1ffff4b Merge pull request #225 from bunnei/fix-release-mutex
Mutex: Changed behavior to always release mutex for all threads.
2014-11-30 08:47:49 -05:00
bunnei a5afad0937 Merge pull request #226 from bunnei/svc-and-thread-fixes
Svc and thread fixes
2014-11-30 08:41:49 -05:00
Subv 5753da89e4 CFG:U: Implemented the GetCountryCodeID and GetCountryCodeString. 2014-11-29 21:16:28 -05:00
vaguilar 223e76d51d Fixed formatting and switch statement warnings 2014-11-27 02:59:14 -08:00
bunnei de851ba1a1 Thread: Check that thread is actually in "wait state" when verifying wait. 2014-11-26 15:04:08 -05:00
bunnei f985469901 SVC: Add debug log to ArbitrateAddress. 2014-11-26 15:04:07 -05:00
bunnei e0e7443517 SVC: SleepThread should yield to the next ready thread. 2014-11-26 15:04:07 -05:00
bunnei a449e0e11a Mutex: Changed behavior to always release mutex for all threads. 2014-11-26 14:38:42 -05:00
archshift 43a682a106 Log the cmd_buff arguments when citra comes across an unimplemented function 2014-11-24 15:51:48 -08:00
archshift e5ff01c2cd Implemented RenameDirectory in FS:USER 2014-11-24 15:09:12 -08:00
archshift 45afc15aa6 Implemented RenameFile in FS:USER 2014-11-24 15:09:11 -08:00
Yuri Kunde Schlesner 8189593255 Use pointers instead of passing handles around in some functions. 2014-11-24 17:08:37 -02:00
Yuri Kunde Schlesner 22c86824a4 Remove duplicated docs/update them for changed parameters. 2014-11-24 17:08:36 -02:00
Yuri Kunde Schlesner c2588403c0 HLE: Revamp error handling throrough the HLE code
All service calls in the CTR OS return result codes indicating the
success or failure of the call. Previous to this commit, Citra's HLE
emulation of services and the kernel universally either ignored errors
or returned dummy -1 error codes.

This commit makes an initial effort to provide an infrastructure for
error reporting and propagation which can be use going forward to make
HLE calls accurately return errors as the original system. A few parts
of the code have been updated to use the new system where applicable.

One part of this effort is the definition of the `ResultCode` type,
which provides facilities for constructing and parsing error codes in
the structured format used by the CTR.

The `ResultVal` type builds on `ResultCode` by providing a container for
values returned by function that can report errors. It enforces that
correct error checking will be done on function returns by preventing
the use of the return value if the function returned an error code.

Currently this change is mostly internal since errors are still
suppressed on the ARM<->HLE border, as a temporary compatibility hack.
As functionality is implemented and tested this hack can be eventually
removed.
2014-11-24 17:08:36 -02:00
bunnei ef1b16a7eb Merge pull request #191 from archshift/deletexyz
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
2014-11-23 20:02:23 -05:00
archshift 8aeadbd95a Added DeleteFile and DeleteDirectory functions to FS:USER and the archives. 2014-11-23 00:33:43 -08:00
purpasmart96 9821bfcb8e Add more services and some fixes, along with more "override"
in the service's headers
2014-11-20 17:09:57 -08:00
bunnei c0cd0fa78e Merge pull request #211 from linkmauve/master
Remove trailing spaces from the entire project
2014-11-19 15:24:46 -05:00
bunnei 112768f436 Merge pull request #208 from lioncash/statics
Add static to some variables
2014-11-19 09:39:20 -05:00
Emmanuel Gil Peyrot f5d38649c7 Remove trailing spaces in every file but the ones imported from SkyEye, AOSP or generated 2014-11-19 09:03:07 +00:00
Lioncash 7cbecde2ca Add static to some variables 2014-11-18 20:04:00 -05:00
purpasmart96 66431bceda Kernel:Add missing permissions in shared memory & svc 2014-11-18 15:57:25 -08:00
Lioncash 1a8f466217 Remove extraneous semicolons 2014-11-18 08:27:16 -05:00
Lioncash 72846c418e core: Mark some hle functions as static
These functions are not referred to by their linkage name outside of the translation unit, so they can be marked as static.
2014-11-17 22:41:49 -05:00
bunnei 11641b5e79 Archive: Fixed to not destroy archive handle on close. 2014-11-17 22:19:14 -05:00
bunnei bcb0dbf7e1 Archive: Fixed close archive before freeing. 2014-11-17 22:19:14 -05:00
bunnei 3e09c07378 FS_User: Support FileSye::Path in a more generic way.
added a todo to kernel archive
2014-11-17 22:18:58 -05:00
bunnei a3107a6b57 FileSys: Updated backend code to use FileSys::Path instead of string for paths. 2014-11-17 21:49:24 -05:00
archshift e27f169acb Add missing boss:U service, needed according to Nintendo Zone logs. 2014-11-17 07:31:37 -08:00
Lioncash ac58b76e71 Fix two format strings. 2014-11-14 12:08:26 -05:00
bunnei 3cfdabb2e3 Merge pull request #183 from archshift/lowpath
Add support for UTF-16 strings for LowPaths in FS:USER
2014-11-12 22:56:27 -05:00
archshift 1f7c4ab7f6 Use std::u16string for conversion between UTF-8 and UTF-16, FS:USER functions 2014-11-12 19:30:17 -08:00
bunnei a490490336 Merge pull request #188 from bunnei/apt-fixes
APT_U: Various improvements and bug fixes.
2014-11-12 00:06:45 -05:00
bunnei 9fb549cb84 APT_U: Added stub for function AppletUtility. 2014-11-11 23:51:54 -05:00
bunnei 19cfcfe8c0 APT_U: Set a valid parameter buffer size in GlanceParameter.
- Also Clarified GlanceParameter/ReceiveParameter documentation.
2014-11-11 23:51:54 -05:00
bunnei 8eced1b697 APT_U: Release service lock on initialization. 2014-11-11 23:51:54 -05:00
bunnei 0df9c34410 APT_U: Fixes for GetLockHandle to boot system titles.
- Also added comment to GetLockHandle function.
2014-11-11 23:51:33 -05:00
archshift 37e582c395 Add FRD:U service and functions 2014-11-10 22:43:45 -08:00
archshift 0ad5964c8b Add support for UTF-16 strings for LowPaths in FS:USER 2014-11-10 10:53:26 -08:00
bunnei 9be17e4d84 Merge pull request #163 from archshift/create-directory
Added CreateDirectory function to service/fs.cpp, and in Archive.
2014-11-02 17:15:52 -05:00
archshift 04c90c395d Added CreateDirectory function to service/fs.cpp, and in Archive. 2014-11-02 10:48:28 -08:00
archshift 40a84833ae Added ReceiveNotification, PublishToSubscriber unimplemented functions to SRV 2014-11-01 23:15:38 -07:00
archshift c22923f8c4 Added stub err:f service. 2014-11-01 20:07:59 -07:00
purpasmart96 539b4c883d Added a bunch of services 2014-11-01 15:28:35 -07:00
bunnei 01e37962e7 Merge pull request #162 from SeannyM/warning-fixes
Fix some warnings
2014-10-29 21:07:27 -04:00
archshift ed797a4354 FS:USER - Implemented IsSdmcDetected 2014-10-29 17:43:48 -07:00
Sean 9a012ff007 Fix some warnings 2014-10-29 20:26:15 -04:00
Gareth Poole 38df9e96dd Renamed souce files of services to match port names 2014-10-29 15:55:51 -04:00
bunnei a110b06fb6 Merge pull request #141 from archshift/crash-hunt
hid.cpp: Fixed crash when updating pad data while null
2014-10-27 21:35:01 -04:00
Yuri Kunde Schlesner d72708c1f5 Add `override` keyword through the code.
This was automated using `clang-modernize`.
2014-10-26 16:18:05 -02:00
bunnei 53a22b84da ARM: Integrate SkyEye faster "dyncom" interpreter.
Fixed typo (make protected member public)

Added license header back in. I originally removed this because I mostly rewrote the file, but meh

ARM: Fixed a type error in dyncom interpreter.

ARM: Updated dyncom to use unique_ptr for internal ARM state.
2014-10-25 14:11:39 -04:00
Emmanuel Gil Peyrot 2d960f5040 Don’t fail on empty filename in OpenFileDirectly, return the archive handle instead 2014-10-25 16:12:57 +00:00
archshift 366ae1b351 hid.cpp: Fixed crash when updating pad data while null
Fixes #137
2014-10-13 22:18:03 -07:00
bunnei 8d1154c24e Merge pull request #128 from purpasmart96/master
APT:U Added a stub fuction for "GlanceParameter"
2014-10-07 20:30:21 -04:00
purpasmart96 20f15f31dd APT: Added a stub for the "GlanceParameter" function. 2014-10-07 17:10:54 -07:00
Emmanuel Gil Peyrot 0be5c03176 FileSys: split the constructor into an Open method, in order to notify the opener something went wrong.
Kernel: Return an invalid handle to OpenFile when it failed to open.
2014-10-06 19:58:42 +02:00
Emmanuel Gil Peyrot 23c2fbfc7a FileSys/Kernel: Implement SetSize service call for File objects. 2014-10-06 19:58:37 +02:00
purpasmart96 1d0ac47832 Added some more names to the function table
Added "SetApplicationCpuTimeLimit" and "GetApplicationCpuTimeLimit" to apt.cpp
2014-10-04 15:01:36 -07:00
purpasmart96 7d6f7684e1 added "StoreDataCache" to the function table
seems simple enough
2014-09-30 09:13:29 -07:00
archshift 1966f7b0ad Use the citra user path for the sdmc directory 2014-09-21 09:34:33 -07:00
Emmanuel Gil Peyrot 3a570a9fee Kernel: Implement the Close command for Archive, File and Directory. 2014-09-17 14:35:46 +00:00