mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-25 00:44:05 +00:00
HLE: Rename namespaces to match move & fix initialization order
This commit is contained in:
parent
c72ccfa6db
commit
ca67bb7945
10 changed files with 43 additions and 49 deletions
|
@ -157,12 +157,6 @@ void GMainWindow::BootGame(std::string filename)
|
|||
LOG_INFO(Frontend, "Citra starting...\n");
|
||||
System::Init(render_window);
|
||||
|
||||
if (Core::Init()) {
|
||||
LOG_CRITICAL(Frontend, "Core initialization failed, exiting...");
|
||||
Core::Stop();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Load a game or die...
|
||||
if (Loader::ResultStatus::Success != Loader::LoadFile(filename)) {
|
||||
LOG_CRITICAL(Frontend, "Failed to load ROM!");
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "core/hle/hle.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/service/service.h"
|
||||
#include "core/hle/service/fs/archive.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -56,6 +57,7 @@ void RegisterAllModules() {
|
|||
|
||||
void Init() {
|
||||
Service::Init();
|
||||
Service::FS::ArchiveInit();
|
||||
|
||||
RegisterAllModules();
|
||||
|
||||
|
@ -63,6 +65,7 @@ void Init() {
|
|||
}
|
||||
|
||||
void Shutdown() {
|
||||
Service::FS::ArchiveShutdown();
|
||||
Service::Shutdown();
|
||||
|
||||
g_module_db.clear();
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "core/core.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/service/fs/archive.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -89,13 +88,11 @@ Object* ObjectPool::CreateByIDType(int type) {
|
|||
/// Initialize the kernel
|
||||
void Init() {
|
||||
Kernel::ThreadingInit();
|
||||
Kernel::ArchiveInit();
|
||||
}
|
||||
|
||||
/// Shutdown the kernel
|
||||
void Shutdown() {
|
||||
Kernel::ThreadingShutdown();
|
||||
Kernel::ArchiveShutdown();
|
||||
|
||||
g_object_pool.Clear(); // Free all kernel objects
|
||||
}
|
||||
|
@ -106,8 +103,6 @@ void Shutdown() {
|
|||
* @return True on success, otherwise false
|
||||
*/
|
||||
bool LoadExec(u32 entry_point) {
|
||||
Init();
|
||||
|
||||
Core::g_app_core->SetPC(entry_point);
|
||||
|
||||
// 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/result.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Kernel namespace
|
||||
|
||||
namespace Kernel {
|
||||
namespace Service {
|
||||
namespace FS {
|
||||
|
||||
// Command to access archive file
|
||||
enum class FileCommand : u32 {
|
||||
|
@ -423,4 +421,5 @@ void ArchiveShutdown() {
|
|||
g_archive_map.clear();
|
||||
}
|
||||
|
||||
} // namespace Kernel
|
||||
} // namespace FS
|
||||
} // namespace Service
|
||||
|
|
|
@ -10,10 +10,8 @@
|
|||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/result.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Kernel namespace
|
||||
|
||||
namespace Kernel {
|
||||
namespace Service {
|
||||
namespace FS {
|
||||
|
||||
/**
|
||||
* Opens an archive
|
||||
|
@ -104,4 +102,5 @@ void ArchiveInit();
|
|||
/// Shutdown archives
|
||||
void ArchiveShutdown();
|
||||
|
||||
} // namespace FileSys
|
||||
} // namespace FS
|
||||
} // namespace Service
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Namespace FS_User
|
||||
|
||||
namespace FS_User {
|
||||
namespace Service {
|
||||
namespace FS {
|
||||
|
||||
static void Initialize(Service::Interface* self) {
|
||||
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);
|
||||
|
||||
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;
|
||||
if (handle.Succeeded()) {
|
||||
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(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;
|
||||
if (archive_handle.Failed()) {
|
||||
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[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;
|
||||
if (handle.Succeeded()) {
|
||||
cmd_buff[3] = *handle;
|
||||
|
@ -154,7 +155,7 @@ void DeleteFile(Service::Interface* self) {
|
|||
LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
|
||||
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(),
|
||||
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",
|
||||
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());
|
||||
|
||||
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(),
|
||||
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) {
|
||||
|
@ -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());
|
||||
|
||||
ResultVal<Handle> handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path);
|
||||
ResultVal<Handle> handle = OpenDirectoryFromArchive(archive_handle, dir_path);
|
||||
cmd_buff[1] = handle.Code().raw;
|
||||
if (handle.Succeeded()) {
|
||||
cmd_buff[3] = *handle;
|
||||
|
@ -347,7 +348,7 @@ static void OpenArchive(Service::Interface* self) {
|
|||
return;
|
||||
}
|
||||
|
||||
ResultVal<Handle> handle = Kernel::OpenArchive(archive_id);
|
||||
ResultVal<Handle> handle = OpenArchive(archive_id);
|
||||
cmd_buff[1] = handle.Code().raw;
|
||||
if (handle.Succeeded()) {
|
||||
// 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");
|
||||
}
|
||||
|
||||
const Interface::FunctionInfo FunctionTable[] = {
|
||||
const FSUserInterface::FunctionInfo FunctionTable[] = {
|
||||
{0x000100C6, nullptr, "Dummy1"},
|
||||
{0x040100C4, nullptr, "Control"},
|
||||
{0x08010002, Initialize, "Initialize"},
|
||||
|
@ -464,11 +465,12 @@ const Interface::FunctionInfo FunctionTable[] = {
|
|||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Interface class
|
||||
|
||||
Interface::Interface() {
|
||||
FSUserInterface::FSUserInterface() {
|
||||
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 Service {
|
||||
namespace FS {
|
||||
|
||||
/// Interface to "fs:USER" service
|
||||
class Interface : public Service::Interface {
|
||||
class FSUserInterface : public Service::Interface {
|
||||
public:
|
||||
|
||||
Interface();
|
||||
FSUserInterface();
|
||||
|
||||
~Interface();
|
||||
~FSUserInterface();
|
||||
|
||||
/**
|
||||
* 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 ERR_F::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 HID_User::Interface);
|
||||
g_manager->AddService(new IR_RST::Interface);
|
||||
|
|
|
@ -74,7 +74,7 @@ ResultStatus LoadFile(const std::string& filename) {
|
|||
|
||||
// Load application and RomFS
|
||||
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;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -23,10 +23,10 @@ void Init(EmuWindow* emu_window) {
|
|||
Core::Init();
|
||||
Memory::Init();
|
||||
HW::Init();
|
||||
Kernel::Init();
|
||||
HLE::Init();
|
||||
CoreTiming::Init();
|
||||
VideoCore::Init(emu_window);
|
||||
Kernel::Init();
|
||||
}
|
||||
|
||||
void RunLoopFor(int cycles) {
|
||||
|
@ -37,13 +37,13 @@ void RunLoopUntil(u64 global_cycles) {
|
|||
}
|
||||
|
||||
void Shutdown() {
|
||||
Core::Shutdown();
|
||||
Memory::Shutdown();
|
||||
HW::Shutdown();
|
||||
HLE::Shutdown();
|
||||
CoreTiming::Shutdown();
|
||||
VideoCore::Shutdown();
|
||||
CoreTiming::Shutdown();
|
||||
HLE::Shutdown();
|
||||
Kernel::Shutdown();
|
||||
HW::Shutdown();
|
||||
Memory::Shutdown();
|
||||
Core::Shutdown();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
Loading…
Reference in a new issue