early-access version 2011

This commit is contained in:
pineappleEA 2021-08-25 04:38:35 +02:00
parent c9c3dca3ef
commit 7ab94d57a1
5 changed files with 17 additions and 13 deletions

View file

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 2010. This is the source code for early-access 2011.
## Legal Notice ## Legal Notice

View file

@ -5,6 +5,7 @@
#include <atomic> #include <atomic>
#include <chrono> #include <chrono>
#include <climits> #include <climits>
#include <exception>
#include <thread> #include <thread>
#include <vector> #include <vector>
@ -152,7 +153,7 @@ public:
void EnableForStacktrace() override {} void EnableForStacktrace() override {}
}; };
bool initialization_in_progress_suppress_logging = false; bool initialization_in_progress_suppress_logging = true;
/** /**
* Static state as a singleton. * Static state as a singleton.
@ -161,17 +162,17 @@ class Impl {
public: public:
static Impl& Instance() { static Impl& Instance() {
if (!instance) { if (!instance) {
abort(); throw std::runtime_error("Using Logging instance before its initialization");
} }
return *instance; return *instance;
} }
static void Initialize() { static void Initialize() {
if (instance) { if (instance) {
abort(); LOG_WARNING(Log, "Reinitializing logging backend");
return;
} }
using namespace Common::FS; using namespace Common::FS;
initialization_in_progress_suppress_logging = true;
const auto& log_dir = GetYuzuPath(YuzuPath::LogDir); const auto& log_dir = GetYuzuPath(YuzuPath::LogDir);
void(CreateDir(log_dir)); void(CreateDir(log_dir));
Filter filter; Filter filter;

View file

@ -4,6 +4,7 @@
#include <array> #include <array>
#include <atomic> #include <atomic>
#include <exception>
#include <memory> #include <memory>
#include <utility> #include <utility>
@ -423,9 +424,16 @@ struct System::Impl {
System::System() : impl{std::make_unique<Impl>(*this)} {} System::System() : impl{std::make_unique<Impl>(*this)} {}
System::~System() = default; System::~System() = default;
System& System::GetInstance() {
if (!s_instance) {
throw std::runtime_error("Using System instance before its initialization");
}
return *s_instance;
}
void System::InitializeGlobalInstance() { void System::InitializeGlobalInstance() {
if (s_instance) { if (s_instance) {
abort(); throw std::runtime_error("Reinitializing Global System instance.");
} }
s_instance = std::unique_ptr<System>(new System); s_instance = std::unique_ptr<System>(new System);
} }

View file

@ -120,12 +120,7 @@ public:
* Gets the instance of the System singleton class. * Gets the instance of the System singleton class.
* @returns Reference to the instance of the System singleton class. * @returns Reference to the instance of the System singleton class.
*/ */
[[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance() { [[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
if (!s_instance) {
abort();
}
return *s_instance;
}
static void InitializeGlobalInstance(); static void InitializeGlobalInstance();

View file

@ -194,6 +194,7 @@ GMainWindow::GMainWindow()
: input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()},
config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
provider{std::make_unique<FileSys::ManualContentProvider>()} { provider{std::make_unique<FileSys::ManualContentProvider>()} {
Common::Log::Initialize();
LoadTranslation(); LoadTranslation();
setAcceptDrops(true); setAcceptDrops(true);
@ -3446,7 +3447,6 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
#endif #endif
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
Common::Log::Initialize();
Common::DetachedTasks detached_tasks; Common::DetachedTasks detached_tasks;
MicroProfileOnThreadCreate("Frontend"); MicroProfileOnThreadCreate("Frontend");
SCOPE_EXIT({ MicroProfileShutdown(); }); SCOPE_EXIT({ MicroProfileShutdown(); });