summaryrefslogtreecommitdiff
path: root/src/yuzu_cmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r--src/yuzu_cmd/config.cpp6
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp20
-rw-r--r--src/yuzu_cmd/yuzu.cpp34
3 files changed, 33 insertions, 27 deletions
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 150915c17..3a311b69f 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -27,17 +27,17 @@ bool Config::LoadINI(const std::string& default_contents, bool retry) {
27 const char* location = this->sdl2_config_loc.c_str(); 27 const char* location = this->sdl2_config_loc.c_str();
28 if (sdl2_config->ParseError() < 0) { 28 if (sdl2_config->ParseError() < 0) {
29 if (retry) { 29 if (retry) {
30 NGLOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location); 30 LOG_WARNING(Config, "Failed to load {}. Creating file from defaults...", location);
31 FileUtil::CreateFullPath(location); 31 FileUtil::CreateFullPath(location);
32 FileUtil::WriteStringToFile(true, default_contents, location); 32 FileUtil::WriteStringToFile(true, default_contents, location);
33 sdl2_config = std::make_unique<INIReader>(location); // Reopen file 33 sdl2_config = std::make_unique<INIReader>(location); // Reopen file
34 34
35 return LoadINI(default_contents, false); 35 return LoadINI(default_contents, false);
36 } 36 }
37 NGLOG_ERROR(Config, "Failed."); 37 LOG_ERROR(Config, "Failed.");
38 return false; 38 return false;
39 } 39 }
40 NGLOG_INFO(Config, "Successfully loaded {}", location); 40 LOG_INFO(Config, "Successfully loaded {}", location);
41 return true; 41 return true;
42} 42}
43 43
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index cfd8eb7e6..e6f0bbe8f 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -62,19 +62,19 @@ void EmuWindow_SDL2::Fullscreen() {
62 return; 62 return;
63 } 63 }
64 64
65 NGLOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); 65 LOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError());
66 66
67 // Try a different fullscreening method 67 // Try a different fullscreening method
68 NGLOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); 68 LOG_INFO(Frontend, "Attempting to use borderless fullscreen...");
69 if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { 69 if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
70 return; 70 return;
71 } 71 }
72 72
73 NGLOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError()); 73 LOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError());
74 74
75 // Fallback algorithm: Maximise window. 75 // Fallback algorithm: Maximise window.
76 // Works on all systems (unless something is seriously wrong), so no fallback for this one. 76 // Works on all systems (unless something is seriously wrong), so no fallback for this one.
77 NGLOG_INFO(Frontend, "Falling back on a maximised window..."); 77 LOG_INFO(Frontend, "Falling back on a maximised window...");
78 SDL_MaximizeWindow(render_window); 78 SDL_MaximizeWindow(render_window);
79} 79}
80 80
@@ -91,7 +91,7 @@ bool EmuWindow_SDL2::SupportsRequiredGLExtensions() {
91 unsupported_ext.push_back("ARB_vertex_attrib_binding"); 91 unsupported_ext.push_back("ARB_vertex_attrib_binding");
92 92
93 for (const std::string& ext : unsupported_ext) 93 for (const std::string& ext : unsupported_ext)
94 NGLOG_CRITICAL(Frontend, "Unsupported GL extension: {}", ext); 94 LOG_CRITICAL(Frontend, "Unsupported GL extension: {}", ext);
95 95
96 return unsupported_ext.empty(); 96 return unsupported_ext.empty();
97} 97}
@@ -103,7 +103,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
103 103
104 // Initialize the window 104 // Initialize the window
105 if (SDL_Init(SDL_INIT_VIDEO) < 0) { 105 if (SDL_Init(SDL_INIT_VIDEO) < 0) {
106 NGLOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting..."); 106 LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting...");
107 exit(1); 107 exit(1);
108 } 108 }
109 109
@@ -126,7 +126,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
126 SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); 126 SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
127 127
128 if (render_window == nullptr) { 128 if (render_window == nullptr) {
129 NGLOG_CRITICAL(Frontend, "Failed to create SDL2 window! Exiting..."); 129 LOG_CRITICAL(Frontend, "Failed to create SDL2 window! Exiting...");
130 exit(1); 130 exit(1);
131 } 131 }
132 132
@@ -137,17 +137,17 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
137 gl_context = SDL_GL_CreateContext(render_window); 137 gl_context = SDL_GL_CreateContext(render_window);
138 138
139 if (gl_context == nullptr) { 139 if (gl_context == nullptr) {
140 NGLOG_CRITICAL(Frontend, "Failed to create SDL2 GL context! Exiting..."); 140 LOG_CRITICAL(Frontend, "Failed to create SDL2 GL context! Exiting...");
141 exit(1); 141 exit(1);
142 } 142 }
143 143
144 if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) { 144 if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) {
145 NGLOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting..."); 145 LOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting...");
146 exit(1); 146 exit(1);
147 } 147 }
148 148
149 if (!SupportsRequiredGLExtensions()) { 149 if (!SupportsRequiredGLExtensions()) {
150 NGLOG_CRITICAL(Frontend, "GPU does not support all required OpenGL extensions! Exiting..."); 150 LOG_CRITICAL(Frontend, "GPU does not support all required OpenGL extensions! Exiting...");
151 exit(1); 151 exit(1);
152 } 152 }
153 153
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 95e568b7b..8ddd202d8 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -7,6 +7,7 @@
7#include <string> 7#include <string>
8#include <thread> 8#include <thread>
9 9
10#include "common/common_paths.h"
10#include "common/logging/backend.h" 11#include "common/logging/backend.h"
11#include "common/logging/filter.h" 12#include "common/logging/filter.h"
12#include "common/logging/log.h" 13#include "common/logging/log.h"
@@ -69,7 +70,7 @@ int main(int argc, char** argv) {
69 auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w); 70 auto argv_w = CommandLineToArgvW(GetCommandLineW(), &argc_w);
70 71
71 if (argv_w == nullptr) { 72 if (argv_w == nullptr) {
72 NGLOG_CRITICAL(Frontend, "Failed to get command line arguments"); 73 LOG_CRITICAL(Frontend, "Failed to get command line arguments");
73 return -1; 74 return -1;
74 } 75 }
75#endif 76#endif
@@ -102,7 +103,7 @@ int main(int argc, char** argv) {
102 break; 103 break;
103 case 'f': 104 case 'f':
104 fullscreen = true; 105 fullscreen = true;
105 NGLOG_INFO(Frontend, "Starting in fullscreen mode..."); 106 LOG_INFO(Frontend, "Starting in fullscreen mode...");
106 break; 107 break;
107 case 'h': 108 case 'h':
108 PrintHelp(argv[0]); 109 PrintHelp(argv[0]);
@@ -126,13 +127,18 @@ int main(int argc, char** argv) {
126#endif 127#endif
127 128
128 Log::Filter log_filter(Log::Level::Debug); 129 Log::Filter log_filter(Log::Level::Debug);
129 Log::SetFilter(&log_filter); 130 Log::SetGlobalFilter(log_filter);
131
132 Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
133 FileUtil::CreateFullPath(FileUtil::GetUserPath(D_LOGS_IDX));
134 Log::AddBackend(
135 std::make_unique<Log::FileBackend>(FileUtil::GetUserPath(D_LOGS_IDX) + LOG_FILE));
130 136
131 MicroProfileOnThreadCreate("EmuThread"); 137 MicroProfileOnThreadCreate("EmuThread");
132 SCOPE_EXIT({ MicroProfileShutdown(); }); 138 SCOPE_EXIT({ MicroProfileShutdown(); });
133 139
134 if (filepath.empty()) { 140 if (filepath.empty()) {
135 NGLOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); 141 LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
136 return -1; 142 return -1;
137 } 143 }
138 144
@@ -153,28 +159,28 @@ int main(int argc, char** argv) {
153 159
154 switch (load_result) { 160 switch (load_result) {
155 case Core::System::ResultStatus::ErrorGetLoader: 161 case Core::System::ResultStatus::ErrorGetLoader:
156 NGLOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filepath.c_str()); 162 LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filepath.c_str());
157 return -1; 163 return -1;
158 case Core::System::ResultStatus::ErrorLoader: 164 case Core::System::ResultStatus::ErrorLoader:
159 NGLOG_CRITICAL(Frontend, "Failed to load ROM!"); 165 LOG_CRITICAL(Frontend, "Failed to load ROM!");
160 return -1; 166 return -1;
161 case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: 167 case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted:
162 NGLOG_CRITICAL(Frontend, "The game that you are trying to load must be decrypted before " 168 LOG_CRITICAL(Frontend, "The game that you are trying to load must be decrypted before "
163 "being used with yuzu. \n\n For more information on dumping and " 169 "being used with yuzu. \n\n For more information on dumping and "
164 "decrypting games, please refer to: " 170 "decrypting games, please refer to: "
165 "https://yuzu-emu.org/wiki/dumping-game-cartridges/"); 171 "https://yuzu-emu.org/wiki/dumping-game-cartridges/");
166 return -1; 172 return -1;
167 case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: 173 case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat:
168 NGLOG_CRITICAL(Frontend, "Error while loading ROM: The ROM format is not supported."); 174 LOG_CRITICAL(Frontend, "Error while loading ROM: The ROM format is not supported.");
169 return -1; 175 return -1;
170 case Core::System::ResultStatus::ErrorNotInitialized: 176 case Core::System::ResultStatus::ErrorNotInitialized:
171 NGLOG_CRITICAL(Frontend, "CPUCore not initialized"); 177 LOG_CRITICAL(Frontend, "CPUCore not initialized");
172 return -1; 178 return -1;
173 case Core::System::ResultStatus::ErrorSystemMode: 179 case Core::System::ResultStatus::ErrorSystemMode:
174 NGLOG_CRITICAL(Frontend, "Failed to determine system mode!"); 180 LOG_CRITICAL(Frontend, "Failed to determine system mode!");
175 return -1; 181 return -1;
176 case Core::System::ResultStatus::ErrorVideoCore: 182 case Core::System::ResultStatus::ErrorVideoCore:
177 NGLOG_CRITICAL(Frontend, "VideoCore not initialized"); 183 LOG_CRITICAL(Frontend, "VideoCore not initialized");
178 return -1; 184 return -1;
179 case Core::System::ResultStatus::Success: 185 case Core::System::ResultStatus::Success:
180 break; // Expected case 186 break; // Expected case