HLE: Rename namespaces to match move & fix initialization order
This commit is contained in:
parent
c72ccfa6db
commit
ca67bb7945
|
@ -157,12 +157,6 @@ void GMainWindow::BootGame(std::string filename)
|
||||||
LOG_INFO(Frontend, "Citra starting...\n");
|
LOG_INFO(Frontend, "Citra starting...\n");
|
||||||
System::Init(render_window);
|
System::Init(render_window);
|
||||||
|
|
||||||
if (Core::Init()) {
|
|
||||||
LOG_CRITICAL(Frontend, "Core initialization failed, exiting...");
|
|
||||||
Core::Stop();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load a game or die...
|
// Load a game or die...
|
||||||
if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) {
|
if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) {
|
||||||
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "core/hle/hle.h"
|
#include "core/hle/hle.h"
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
#include "core/hle/service/fs/archive.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ void RegisterAllModules() {
|
||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
Service::Init();
|
Service::Init();
|
||||||
|
Service::FS::ArchiveInit();
|
||||||
|
|
||||||
RegisterAllModules();
|
RegisterAllModules();
|
||||||
|
|
||||||
|
@ -63,6 +65,7 @@ void Init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
|
Service::FS::ArchiveShutdown();
|
||||||
Service::Shutdown();
|
Service::Shutdown();
|
||||||
|
|
||||||
g_module_db.clear();
|
g_module_db.clear();
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/kernel/thread.h"
|
#include "core/hle/kernel/thread.h"
|
||||||
#include "core/hle/service/fs/archive.h"
|
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -89,13 +88,11 @@ Object* ObjectPool::CreateByIDType(int type) {
|
||||||
/// Initialize the kernel
|
/// Initialize the kernel
|
||||||
void Init() {
|
void Init() {
|
||||||
Kernel::ThreadingInit();
|
Kernel::ThreadingInit();
|
||||||
Kernel::ArchiveInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shutdown the kernel
|
/// Shutdown the kernel
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
Kernel::ThreadingShutdown();
|
Kernel::ThreadingShutdown();
|
||||||
Kernel::ArchiveShutdown();
|
|
||||||
|
|
||||||
g_object_pool.Clear(); // Free all kernel objects
|
g_object_pool.Clear(); // Free all kernel objects
|
||||||
}
|
}
|
||||||
|
@ -106,8 +103,6 @@ void Shutdown() {
|
||||||
* @return True on success, otherwise false
|
* @return True on success, otherwise false
|
||||||
*/
|
*/
|
||||||
bool LoadExec(u32 entry_point) {
|
bool LoadExec(u32 entry_point) {
|
||||||
Init();
|
|
||||||
|
|
||||||
Core::g_app_core->SetPC(entry_point);
|
Core::g_app_core->SetPC(entry_point);
|
||||||
|
|
||||||
// 0x30 is the typical main thread priority I've seen used so far
|
// 0x30 is the typical main thread priority I've seen used so far
|
||||||
|
|
|
@ -15,10 +15,8 @@
|
||||||
#include "core/hle/kernel/session.h"
|
#include "core/hle/kernel/session.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
namespace Service {
|
||||||
// Kernel namespace
|
namespace FS {
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
// Command to access archive file
|
// Command to access archive file
|
||||||
enum class FileCommand : u32 {
|
enum class FileCommand : u32 {
|
||||||
|
@ -423,4 +421,5 @@ void ArchiveShutdown() {
|
||||||
g_archive_map.clear();
|
g_archive_map.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace FS
|
||||||
|
} // namespace Service
|
||||||
|
|
|
@ -10,10 +10,8 @@
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
namespace Service {
|
||||||
// Kernel namespace
|
namespace FS {
|
||||||
|
|
||||||
namespace Kernel {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens an archive
|
* Opens an archive
|
||||||
|
@ -104,4 +102,5 @@ void ArchiveInit();
|
||||||
/// Shutdown archives
|
/// Shutdown archives
|
||||||
void ArchiveShutdown();
|
void ArchiveShutdown();
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FS
|
||||||
|
} // namespace Service
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Namespace FS_User
|
// Namespace FS_User
|
||||||
|
|
||||||
namespace FS_User {
|
namespace Service {
|
||||||
|
namespace FS {
|
||||||
|
|
||||||
static void Initialize(Service::Interface* self) {
|
static void Initialize(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
@ -56,7 +57,7 @@ static void OpenFile(Service::Interface* self) {
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes);
|
LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes);
|
||||||
|
|
||||||
ResultVal<Handle> handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode);
|
ResultVal<Handle> handle = OpenFileFromArchive(archive_handle, file_path, mode);
|
||||||
cmd_buff[1] = handle.Code().raw;
|
cmd_buff[1] = handle.Code().raw;
|
||||||
if (handle.Succeeded()) {
|
if (handle.Succeeded()) {
|
||||||
cmd_buff[3] = *handle;
|
cmd_buff[3] = *handle;
|
||||||
|
@ -110,7 +111,7 @@ static void OpenFileDirectly(Service::Interface* self) {
|
||||||
|
|
||||||
// TODO(Link Mauve): Check if we should even get a handle for the archive, and don't leak it
|
// TODO(Link Mauve): Check if we should even get a handle for the archive, and don't leak it
|
||||||
// TODO(yuriks): Why is there all this duplicate (and seemingly useless) code up here?
|
// TODO(yuriks): Why is there all this duplicate (and seemingly useless) code up here?
|
||||||
ResultVal<Handle> archive_handle = Kernel::OpenArchive(archive_id);
|
ResultVal<Handle> archive_handle = OpenArchive(archive_id);
|
||||||
cmd_buff[1] = archive_handle.Code().raw;
|
cmd_buff[1] = archive_handle.Code().raw;
|
||||||
if (archive_handle.Failed()) {
|
if (archive_handle.Failed()) {
|
||||||
LOG_ERROR(Service_FS, "failed to get a handle for archive");
|
LOG_ERROR(Service_FS, "failed to get a handle for archive");
|
||||||
|
@ -119,7 +120,7 @@ static void OpenFileDirectly(Service::Interface* self) {
|
||||||
// cmd_buff[2] isn't used according to 3dmoo's implementation.
|
// cmd_buff[2] isn't used according to 3dmoo's implementation.
|
||||||
cmd_buff[3] = *archive_handle;
|
cmd_buff[3] = *archive_handle;
|
||||||
|
|
||||||
ResultVal<Handle> handle = Kernel::OpenFileFromArchive(*archive_handle, file_path, mode);
|
ResultVal<Handle> handle = OpenFileFromArchive(*archive_handle, file_path, mode);
|
||||||
cmd_buff[1] = handle.Code().raw;
|
cmd_buff[1] = handle.Code().raw;
|
||||||
if (handle.Succeeded()) {
|
if (handle.Succeeded()) {
|
||||||
cmd_buff[3] = *handle;
|
cmd_buff[3] = *handle;
|
||||||
|
@ -154,7 +155,7 @@ void DeleteFile(Service::Interface* self) {
|
||||||
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
|
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
|
||||||
filename_type, filename_size, file_path.DebugStr().c_str());
|
filename_type, filename_size, file_path.DebugStr().c_str());
|
||||||
|
|
||||||
cmd_buff[1] = Kernel::DeleteFileFromArchive(archive_handle, file_path).raw;
|
cmd_buff[1] = DeleteFileFromArchive(archive_handle, file_path).raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -194,7 +195,7 @@ void RenameFile(Service::Interface* self) {
|
||||||
src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(),
|
src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(),
|
||||||
dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str());
|
dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str());
|
||||||
|
|
||||||
cmd_buff[1] = Kernel::RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw;
|
cmd_buff[1] = RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -223,7 +224,7 @@ void DeleteDirectory(Service::Interface* self) {
|
||||||
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
|
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
|
||||||
dirname_type, dirname_size, dir_path.DebugStr().c_str());
|
dirname_type, dirname_size, dir_path.DebugStr().c_str());
|
||||||
|
|
||||||
cmd_buff[1] = Kernel::DeleteDirectoryFromArchive(archive_handle, dir_path).raw;
|
cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -251,7 +252,7 @@ static void CreateDirectory(Service::Interface* self) {
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
|
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
|
||||||
|
|
||||||
cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_path).raw;
|
cmd_buff[1] = CreateDirectoryFromArchive(archive_handle, dir_path).raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -291,7 +292,7 @@ void RenameDirectory(Service::Interface* self) {
|
||||||
src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(),
|
src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(),
|
||||||
dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str());
|
dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str());
|
||||||
|
|
||||||
cmd_buff[1] = Kernel::RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw;
|
cmd_buff[1] = RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OpenDirectory(Service::Interface* self) {
|
static void OpenDirectory(Service::Interface* self) {
|
||||||
|
@ -308,7 +309,7 @@ static void OpenDirectory(Service::Interface* self) {
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
|
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
|
||||||
|
|
||||||
ResultVal<Handle> handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path);
|
ResultVal<Handle> handle = OpenDirectoryFromArchive(archive_handle, dir_path);
|
||||||
cmd_buff[1] = handle.Code().raw;
|
cmd_buff[1] = handle.Code().raw;
|
||||||
if (handle.Succeeded()) {
|
if (handle.Succeeded()) {
|
||||||
cmd_buff[3] = *handle;
|
cmd_buff[3] = *handle;
|
||||||
|
@ -347,7 +348,7 @@ static void OpenArchive(Service::Interface* self) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultVal<Handle> handle = Kernel::OpenArchive(archive_id);
|
ResultVal<Handle> handle = OpenArchive(archive_id);
|
||||||
cmd_buff[1] = handle.Code().raw;
|
cmd_buff[1] = handle.Code().raw;
|
||||||
if (handle.Succeeded()) {
|
if (handle.Succeeded()) {
|
||||||
// cmd_buff[2] isn't used according to 3dmoo's implementation.
|
// cmd_buff[2] isn't used according to 3dmoo's implementation.
|
||||||
|
@ -372,7 +373,7 @@ static void IsSdmcDetected(Service::Interface* self) {
|
||||||
LOG_DEBUG(Service_FS, "called");
|
LOG_DEBUG(Service_FS, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
const Interface::FunctionInfo FunctionTable[] = {
|
const FSUserInterface::FunctionInfo FunctionTable[] = {
|
||||||
{0x000100C6, nullptr, "Dummy1"},
|
{0x000100C6, nullptr, "Dummy1"},
|
||||||
{0x040100C4, nullptr, "Control"},
|
{0x040100C4, nullptr, "Control"},
|
||||||
{0x08010002, Initialize, "Initialize"},
|
{0x08010002, Initialize, "Initialize"},
|
||||||
|
@ -464,11 +465,12 @@ const Interface::FunctionInfo FunctionTable[] = {
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Interface class
|
// Interface class
|
||||||
|
|
||||||
Interface::Interface() {
|
FSUserInterface::FSUserInterface() {
|
||||||
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
|
Register(FunctionTable, ARRAY_SIZE(FunctionTable));
|
||||||
}
|
}
|
||||||
|
|
||||||
Interface::~Interface() {
|
FSUserInterface::~FSUserInterface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace FS
|
||||||
|
} // namespace Service
|
||||||
|
|
|
@ -9,15 +9,16 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Namespace FS_User
|
// Namespace FS_User
|
||||||
|
|
||||||
namespace FS_User {
|
namespace Service {
|
||||||
|
namespace FS {
|
||||||
|
|
||||||
/// Interface to "fs:USER" service
|
/// Interface to "fs:USER" service
|
||||||
class Interface : public Service::Interface {
|
class FSUserInterface : public Service::Interface {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Interface();
|
FSUserInterface();
|
||||||
|
|
||||||
~Interface();
|
~FSUserInterface();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the string port name used by CTROS for the service
|
* Gets the string port name used by CTROS for the service
|
||||||
|
@ -28,4 +29,5 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace FS
|
||||||
|
} // namespace Service
|
||||||
|
|
|
@ -93,7 +93,7 @@ void Init() {
|
||||||
g_manager->AddService(new DSP_DSP::Interface);
|
g_manager->AddService(new DSP_DSP::Interface);
|
||||||
g_manager->AddService(new ERR_F::Interface);
|
g_manager->AddService(new ERR_F::Interface);
|
||||||
g_manager->AddService(new FRD_U::Interface);
|
g_manager->AddService(new FRD_U::Interface);
|
||||||
g_manager->AddService(new FS_User::Interface);
|
g_manager->AddService(new FS::FSUserInterface);
|
||||||
g_manager->AddService(new GSP_GPU::Interface);
|
g_manager->AddService(new GSP_GPU::Interface);
|
||||||
g_manager->AddService(new HID_User::Interface);
|
g_manager->AddService(new HID_User::Interface);
|
||||||
g_manager->AddService(new IR_RST::Interface);
|
g_manager->AddService(new IR_RST::Interface);
|
||||||
|
|
|
@ -74,7 +74,7 @@ ResultStatus LoadFile(const std::string& filename) {
|
||||||
|
|
||||||
// Load application and RomFS
|
// Load application and RomFS
|
||||||
if (ResultStatus::Success == app_loader.Load()) {
|
if (ResultStatus::Success == app_loader.Load()) {
|
||||||
Kernel::CreateArchive(new FileSys::Archive_RomFS(app_loader), "RomFS");
|
Service::FS::CreateArchive(new FileSys::Archive_RomFS(app_loader), "RomFS");
|
||||||
return ResultStatus::Success;
|
return ResultStatus::Success;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,10 +23,10 @@ void Init(EmuWindow* emu_window) {
|
||||||
Core::Init();
|
Core::Init();
|
||||||
Memory::Init();
|
Memory::Init();
|
||||||
HW::Init();
|
HW::Init();
|
||||||
|
Kernel::Init();
|
||||||
HLE::Init();
|
HLE::Init();
|
||||||
CoreTiming::Init();
|
CoreTiming::Init();
|
||||||
VideoCore::Init(emu_window);
|
VideoCore::Init(emu_window);
|
||||||
Kernel::Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunLoopFor(int cycles) {
|
void RunLoopFor(int cycles) {
|
||||||
|
@ -37,13 +37,13 @@ void RunLoopUntil(u64 global_cycles) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
Core::Shutdown();
|
|
||||||
Memory::Shutdown();
|
|
||||||
HW::Shutdown();
|
|
||||||
HLE::Shutdown();
|
|
||||||
CoreTiming::Shutdown();
|
|
||||||
VideoCore::Shutdown();
|
VideoCore::Shutdown();
|
||||||
|
CoreTiming::Shutdown();
|
||||||
|
HLE::Shutdown();
|
||||||
Kernel::Shutdown();
|
Kernel::Shutdown();
|
||||||
|
HW::Shutdown();
|
||||||
|
Memory::Shutdown();
|
||||||
|
Core::Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Reference in New Issue