summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/citra_qt/main.cpp6
-rw-r--r--src/core/hle/hle.cpp3
-rw-r--r--src/core/hle/kernel/kernel.cpp5
-rw-r--r--src/core/hle/service/fs/archive.cpp9
-rw-r--r--src/core/hle/service/fs/archive.h9
-rw-r--r--src/core/hle/service/fs/fs_user.cpp32
-rw-r--r--src/core/hle/service/fs/fs_user.h12
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/loader/loader.cpp2
-rw-r--r--src/core/system.cpp12
10 files changed, 43 insertions, 49 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 1299338ac..23d4925b8 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -157,12 +157,6 @@ void GMainWindow::BootGame(std::string filename)
157 LOG_INFO(Frontend, "Citra starting...\n"); 157 LOG_INFO(Frontend, "Citra starting...\n");
158 System::Init(render_window); 158 System::Init(render_window);
159 159
160 if (Core::Init()) {
161 LOG_CRITICAL(Frontend, "Core initialization failed, exiting...");
162 Core::Stop();
163 exit(1);
164 }
165
166 // Load a game or die... 160 // Load a game or die...
167 if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) { 161 if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) {
168 LOG_CRITICAL(Frontend, "Failed to load ROM!"); 162 LOG_CRITICAL(Frontend, "Failed to load ROM!");
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index 3f73b5538..cc3d5255a 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -8,6 +8,7 @@
8#include "core/hle/hle.h" 8#include "core/hle/hle.h"
9#include "core/hle/kernel/thread.h" 9#include "core/hle/kernel/thread.h"
10#include "core/hle/service/service.h" 10#include "core/hle/service/service.h"
11#include "core/hle/service/fs/archive.h"
11 12
12//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
13 14
@@ -56,6 +57,7 @@ void RegisterAllModules() {
56 57
57void Init() { 58void Init() {
58 Service::Init(); 59 Service::Init();
60 Service::FS::ArchiveInit();
59 61
60 RegisterAllModules(); 62 RegisterAllModules();
61 63
@@ -63,6 +65,7 @@ void Init() {
63} 65}
64 66
65void Shutdown() { 67void Shutdown() {
68 Service::FS::ArchiveShutdown();
66 Service::Shutdown(); 69 Service::Shutdown();
67 70
68 g_module_db.clear(); 71 g_module_db.clear();
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 95b4dfd68..929422b36 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -9,7 +9,6 @@
9#include "core/core.h" 9#include "core/core.h"
10#include "core/hle/kernel/kernel.h" 10#include "core/hle/kernel/kernel.h"
11#include "core/hle/kernel/thread.h" 11#include "core/hle/kernel/thread.h"
12#include "core/hle/service/fs/archive.h"
13 12
14namespace Kernel { 13namespace Kernel {
15 14
@@ -89,13 +88,11 @@ Object* ObjectPool::CreateByIDType(int type) {
89/// Initialize the kernel 88/// Initialize the kernel
90void Init() { 89void Init() {
91 Kernel::ThreadingInit(); 90 Kernel::ThreadingInit();
92 Kernel::ArchiveInit();
93} 91}
94 92
95/// Shutdown the kernel 93/// Shutdown the kernel
96void Shutdown() { 94void Shutdown() {
97 Kernel::ThreadingShutdown(); 95 Kernel::ThreadingShutdown();
98 Kernel::ArchiveShutdown();
99 96
100 g_object_pool.Clear(); // Free all kernel objects 97 g_object_pool.Clear(); // Free all kernel objects
101} 98}
@@ -106,8 +103,6 @@ void Shutdown() {
106 * @return True on success, otherwise false 103 * @return True on success, otherwise false
107 */ 104 */
108bool LoadExec(u32 entry_point) { 105bool LoadExec(u32 entry_point) {
109 Init();
110
111 Core::g_app_core->SetPC(entry_point); 106 Core::g_app_core->SetPC(entry_point);
112 107
113 // 0x30 is the typical main thread priority I've seen used so far 108 // 0x30 is the typical main thread priority I've seen used so far
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 8889c6339..5893a944b 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -15,10 +15,8 @@
15#include "core/hle/kernel/session.h" 15#include "core/hle/kernel/session.h"
16#include "core/hle/result.h" 16#include "core/hle/result.h"
17 17
18//////////////////////////////////////////////////////////////////////////////////////////////////// 18namespace Service {
19// Kernel namespace 19namespace FS {
20
21namespace Kernel {
22 20
23// Command to access archive file 21// Command to access archive file
24enum class FileCommand : u32 { 22enum class FileCommand : u32 {
@@ -423,4 +421,5 @@ void ArchiveShutdown() {
423 g_archive_map.clear(); 421 g_archive_map.clear();
424} 422}
425 423
426} // namespace Kernel 424} // namespace FS
425} // namespace Service
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index b50833a2b..a7ee212d3 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -10,10 +10,8 @@
10#include "core/hle/kernel/kernel.h" 10#include "core/hle/kernel/kernel.h"
11#include "core/hle/result.h" 11#include "core/hle/result.h"
12 12
13//////////////////////////////////////////////////////////////////////////////////////////////////// 13namespace Service {
14// Kernel namespace 14namespace FS {
15
16namespace Kernel {
17 15
18/** 16/**
19 * Opens an archive 17 * Opens an archive
@@ -104,4 +102,5 @@ void ArchiveInit();
104/// Shutdown archives 102/// Shutdown archives
105void ArchiveShutdown(); 103void ArchiveShutdown();
106 104
107} // namespace FileSys 105} // namespace FS
106} // namespace Service
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index c61b283c9..76689c6af 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -13,7 +13,8 @@
13//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
14// Namespace FS_User 14// Namespace FS_User
15 15
16namespace FS_User { 16namespace Service {
17namespace FS {
17 18
18static void Initialize(Service::Interface* self) { 19static void Initialize(Service::Interface* self) {
19 u32* cmd_buff = Kernel::GetCommandBuffer(); 20 u32* cmd_buff = Kernel::GetCommandBuffer();
@@ -56,7 +57,7 @@ static void OpenFile(Service::Interface* self) {
56 57
57 LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes); 58 LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes);
58 59
59 ResultVal<Handle> handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode); 60 ResultVal<Handle> handle = OpenFileFromArchive(archive_handle, file_path, mode);
60 cmd_buff[1] = handle.Code().raw; 61 cmd_buff[1] = handle.Code().raw;
61 if (handle.Succeeded()) { 62 if (handle.Succeeded()) {
62 cmd_buff[3] = *handle; 63 cmd_buff[3] = *handle;
@@ -110,7 +111,7 @@ static void OpenFileDirectly(Service::Interface* self) {
110 111
111 // TODO(Link Mauve): Check if we should even get a handle for the archive, and don't leak it 112 // TODO(Link Mauve): Check if we should even get a handle for the archive, and don't leak it
112 // TODO(yuriks): Why is there all this duplicate (and seemingly useless) code up here? 113 // TODO(yuriks): Why is there all this duplicate (and seemingly useless) code up here?
113 ResultVal<Handle> archive_handle = Kernel::OpenArchive(archive_id); 114 ResultVal<Handle> archive_handle = OpenArchive(archive_id);
114 cmd_buff[1] = archive_handle.Code().raw; 115 cmd_buff[1] = archive_handle.Code().raw;
115 if (archive_handle.Failed()) { 116 if (archive_handle.Failed()) {
116 LOG_ERROR(Service_FS, "failed to get a handle for archive"); 117 LOG_ERROR(Service_FS, "failed to get a handle for archive");
@@ -119,7 +120,7 @@ static void OpenFileDirectly(Service::Interface* self) {
119 // cmd_buff[2] isn't used according to 3dmoo's implementation. 120 // cmd_buff[2] isn't used according to 3dmoo's implementation.
120 cmd_buff[3] = *archive_handle; 121 cmd_buff[3] = *archive_handle;
121 122
122 ResultVal<Handle> handle = Kernel::OpenFileFromArchive(*archive_handle, file_path, mode); 123 ResultVal<Handle> handle = OpenFileFromArchive(*archive_handle, file_path, mode);
123 cmd_buff[1] = handle.Code().raw; 124 cmd_buff[1] = handle.Code().raw;
124 if (handle.Succeeded()) { 125 if (handle.Succeeded()) {
125 cmd_buff[3] = *handle; 126 cmd_buff[3] = *handle;
@@ -154,7 +155,7 @@ void DeleteFile(Service::Interface* self) {
154 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", 155 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
155 filename_type, filename_size, file_path.DebugStr().c_str()); 156 filename_type, filename_size, file_path.DebugStr().c_str());
156 157
157 cmd_buff[1] = Kernel::DeleteFileFromArchive(archive_handle, file_path).raw; 158 cmd_buff[1] = DeleteFileFromArchive(archive_handle, file_path).raw;
158} 159}
159 160
160/* 161/*
@@ -194,7 +195,7 @@ void RenameFile(Service::Interface* self) {
194 src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(), 195 src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(),
195 dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str()); 196 dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str());
196 197
197 cmd_buff[1] = Kernel::RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw; 198 cmd_buff[1] = RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw;
198} 199}
199 200
200/* 201/*
@@ -223,7 +224,7 @@ void DeleteDirectory(Service::Interface* self) {
223 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", 224 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
224 dirname_type, dirname_size, dir_path.DebugStr().c_str()); 225 dirname_type, dirname_size, dir_path.DebugStr().c_str());
225 226
226 cmd_buff[1] = Kernel::DeleteDirectoryFromArchive(archive_handle, dir_path).raw; 227 cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw;
227} 228}
228 229
229/* 230/*
@@ -251,7 +252,7 @@ static void CreateDirectory(Service::Interface* self) {
251 252
252 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); 253 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
253 254
254 cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_path).raw; 255 cmd_buff[1] = CreateDirectoryFromArchive(archive_handle, dir_path).raw;
255} 256}
256 257
257/* 258/*
@@ -291,7 +292,7 @@ void RenameDirectory(Service::Interface* self) {
291 src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(), 292 src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(),
292 dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str()); 293 dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str());
293 294
294 cmd_buff[1] = Kernel::RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw; 295 cmd_buff[1] = RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw;
295} 296}
296 297
297static void OpenDirectory(Service::Interface* self) { 298static void OpenDirectory(Service::Interface* self) {
@@ -308,7 +309,7 @@ static void OpenDirectory(Service::Interface* self) {
308 309
309 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str()); 310 LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
310 311
311 ResultVal<Handle> handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path); 312 ResultVal<Handle> handle = OpenDirectoryFromArchive(archive_handle, dir_path);
312 cmd_buff[1] = handle.Code().raw; 313 cmd_buff[1] = handle.Code().raw;
313 if (handle.Succeeded()) { 314 if (handle.Succeeded()) {
314 cmd_buff[3] = *handle; 315 cmd_buff[3] = *handle;
@@ -347,7 +348,7 @@ static void OpenArchive(Service::Interface* self) {
347 return; 348 return;
348 } 349 }
349 350
350 ResultVal<Handle> handle = Kernel::OpenArchive(archive_id); 351 ResultVal<Handle> handle = OpenArchive(archive_id);
351 cmd_buff[1] = handle.Code().raw; 352 cmd_buff[1] = handle.Code().raw;
352 if (handle.Succeeded()) { 353 if (handle.Succeeded()) {
353 // cmd_buff[2] isn't used according to 3dmoo's implementation. 354 // cmd_buff[2] isn't used according to 3dmoo's implementation.
@@ -372,7 +373,7 @@ static void IsSdmcDetected(Service::Interface* self) {
372 LOG_DEBUG(Service_FS, "called"); 373 LOG_DEBUG(Service_FS, "called");
373} 374}
374 375
375const Interface::FunctionInfo FunctionTable[] = { 376const FSUserInterface::FunctionInfo FunctionTable[] = {
376 {0x000100C6, nullptr, "Dummy1"}, 377 {0x000100C6, nullptr, "Dummy1"},
377 {0x040100C4, nullptr, "Control"}, 378 {0x040100C4, nullptr, "Control"},
378 {0x08010002, Initialize, "Initialize"}, 379 {0x08010002, Initialize, "Initialize"},
@@ -464,11 +465,12 @@ const Interface::FunctionInfo FunctionTable[] = {
464//////////////////////////////////////////////////////////////////////////////////////////////////// 465////////////////////////////////////////////////////////////////////////////////////////////////////
465// Interface class 466// Interface class
466 467
467Interface::Interface() { 468FSUserInterface::FSUserInterface() {
468 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 469 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
469} 470}
470 471
471Interface::~Interface() { 472FSUserInterface::~FSUserInterface() {
472} 473}
473 474
474} // namespace 475} // namespace FS
476} // namespace Service
diff --git a/src/core/hle/service/fs/fs_user.h b/src/core/hle/service/fs/fs_user.h
index 005382540..80e3804e0 100644
--- a/src/core/hle/service/fs/fs_user.h
+++ b/src/core/hle/service/fs/fs_user.h
@@ -9,15 +9,16 @@
9//////////////////////////////////////////////////////////////////////////////////////////////////// 9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace FS_User 10// Namespace FS_User
11 11
12namespace FS_User { 12namespace Service {
13namespace FS {
13 14
14/// Interface to "fs:USER" service 15/// Interface to "fs:USER" service
15class Interface : public Service::Interface { 16class FSUserInterface : public Service::Interface {
16public: 17public:
17 18
18 Interface(); 19 FSUserInterface();
19 20
20 ~Interface(); 21 ~FSUserInterface();
21 22
22 /** 23 /**
23 * Gets the string port name used by CTROS for the service 24 * Gets the string port name used by CTROS for the service
@@ -28,4 +29,5 @@ public:
28 } 29 }
29}; 30};
30 31
31} // namespace 32} // namespace FS
33} // namespace Service
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 68d199acc..037211e73 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -93,7 +93,7 @@ void Init() {
93 g_manager->AddService(new DSP_DSP::Interface); 93 g_manager->AddService(new DSP_DSP::Interface);
94 g_manager->AddService(new ERR_F::Interface); 94 g_manager->AddService(new ERR_F::Interface);
95 g_manager->AddService(new FRD_U::Interface); 95 g_manager->AddService(new FRD_U::Interface);
96 g_manager->AddService(new FS_User::Interface); 96 g_manager->AddService(new FS::FSUserInterface);
97 g_manager->AddService(new GSP_GPU::Interface); 97 g_manager->AddService(new GSP_GPU::Interface);
98 g_manager->AddService(new HID_User::Interface); 98 g_manager->AddService(new HID_User::Interface);
99 g_manager->AddService(new IR_RST::Interface); 99 g_manager->AddService(new IR_RST::Interface);
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index d7786f1b2..6ce752561 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -74,7 +74,7 @@ ResultStatus LoadFile(const std::string& filename) {
74 74
75 // Load application and RomFS 75 // Load application and RomFS
76 if (ResultStatus::Success == app_loader.Load()) { 76 if (ResultStatus::Success == app_loader.Load()) {
77 Kernel::CreateArchive(new FileSys::Archive_RomFS(app_loader), "RomFS"); 77 Service::FS::CreateArchive(new FileSys::Archive_RomFS(app_loader), "RomFS");
78 return ResultStatus::Success; 78 return ResultStatus::Success;
79 } 79 }
80 break; 80 break;
diff --git a/src/core/system.cpp b/src/core/system.cpp
index 43d0eef2c..2885ff45f 100644
--- a/src/core/system.cpp
+++ b/src/core/system.cpp
@@ -23,10 +23,10 @@ void Init(EmuWindow* emu_window) {
23 Core::Init(); 23 Core::Init();
24 Memory::Init(); 24 Memory::Init();
25 HW::Init(); 25 HW::Init();
26 Kernel::Init();
26 HLE::Init(); 27 HLE::Init();
27 CoreTiming::Init(); 28 CoreTiming::Init();
28 VideoCore::Init(emu_window); 29 VideoCore::Init(emu_window);
29 Kernel::Init();
30} 30}
31 31
32void RunLoopFor(int cycles) { 32void RunLoopFor(int cycles) {
@@ -37,13 +37,13 @@ void RunLoopUntil(u64 global_cycles) {
37} 37}
38 38
39void Shutdown() { 39void Shutdown() {
40 Core::Shutdown();
41 Memory::Shutdown();
42 HW::Shutdown();
43 HLE::Shutdown();
44 CoreTiming::Shutdown();
45 VideoCore::Shutdown(); 40 VideoCore::Shutdown();
41 CoreTiming::Shutdown();
42 HLE::Shutdown();
46 Kernel::Shutdown(); 43 Kernel::Shutdown();
44 HW::Shutdown();
45 Memory::Shutdown();
46 Core::Shutdown();
47} 47}
48 48
49} // namespace 49} // namespace