mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 00:04:49 +02:00
@@ -100,7 +100,7 @@
|
||||
#define LOGGER_CONFIG "Logger.ini"
|
||||
|
||||
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
|
||||
#define MAIN_LOG "dolphin.log"
|
||||
#define MAIN_LOG "ppsspp.log"
|
||||
|
||||
// Sys files
|
||||
#define TOTALDB "totaldb.dsy"
|
||||
|
||||
+23
-2
@@ -68,6 +68,8 @@ LogManager::LogManager()
|
||||
m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str());
|
||||
m_consoleLog = new ConsoleListener();
|
||||
m_debuggerLog = new DebuggerLogListener();
|
||||
#else
|
||||
m_fileLog = NULL;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
@@ -88,8 +90,9 @@ LogManager::~LogManager()
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
{
|
||||
if (m_fileLog != NULL)
|
||||
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
#if !defined(ANDROID) && !defined(IOS) && !defined(BLACKBERRY)
|
||||
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_consoleLog);
|
||||
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_debuggerLog);
|
||||
#endif
|
||||
@@ -97,12 +100,30 @@ LogManager::~LogManager()
|
||||
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
delete m_Log[i];
|
||||
if (m_fileLog != NULL)
|
||||
delete m_fileLog;
|
||||
#if !defined(ANDROID) && !defined(IOS) && !defined(BLACKBERRY)
|
||||
delete m_fileLog;
|
||||
delete m_consoleLog;
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogManager::ChangeFileLog(const char *filename)
|
||||
{
|
||||
if (m_fileLog != NULL)
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
m_logManager->RemoveListener((LogTypes::LOG_TYPE)i, m_fileLog);
|
||||
delete m_fileLog;
|
||||
}
|
||||
|
||||
if (filename != NULL)
|
||||
{
|
||||
m_fileLog = new FileLogListener(filename);
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
|
||||
m_Log[i]->AddListener(m_fileLog);
|
||||
}
|
||||
}
|
||||
|
||||
void LogManager::SaveConfig(IniFile::Section *section)
|
||||
{
|
||||
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
|
||||
|
||||
@@ -179,6 +179,8 @@ public:
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
void ChangeFileLog(const char *filename);
|
||||
|
||||
void SaveConfig(IniFile::Section *section);
|
||||
void LoadConfig(IniFile::Section *section);
|
||||
};
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace MainWindow
|
||||
HWND hwndGameList;
|
||||
HMENU menu;
|
||||
BOOL skinMode = FALSE;
|
||||
CoreState nextState = CORE_POWERDOWN;
|
||||
|
||||
HINSTANCE hInst;
|
||||
|
||||
@@ -244,7 +245,6 @@ namespace MainWindow
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
PostMessage(hWnd, WM_COMMAND, ID_FILE_LOAD, 0);
|
||||
break;
|
||||
|
||||
case WM_MOVE:
|
||||
@@ -467,7 +467,7 @@ namespace MainWindow
|
||||
memoryWindow[0]->Show(true);
|
||||
break;
|
||||
case ID_DEBUG_LOG:
|
||||
LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());
|
||||
LogManager::GetInstance()->GetConsoleListener()->Show(LogManager::GetInstance()->GetConsoleListener()->Hidden());
|
||||
break;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -617,6 +617,9 @@ namespace MainWindow
|
||||
disasmWindow[0]->NotifyMapLoaded();
|
||||
if (memoryWindow[0])
|
||||
memoryWindow[0]->NotifyMapLoaded();
|
||||
|
||||
if (nextState == CORE_RUNNING)
|
||||
PostMessage(hwndMain, WM_COMMAND, ID_EMULATION_RUN, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -762,6 +765,11 @@ namespace MainWindow
|
||||
}
|
||||
}
|
||||
|
||||
void SetNextState(CoreState state)
|
||||
{
|
||||
nextState = state;
|
||||
}
|
||||
|
||||
HINSTANCE GetHInstance()
|
||||
{
|
||||
return hInst;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <Core/Core.h>
|
||||
|
||||
namespace MainWindow
|
||||
{
|
||||
@@ -14,6 +15,8 @@ namespace MainWindow
|
||||
HINSTANCE GetHInstance();
|
||||
HWND GetDisplayHWND();
|
||||
void SetPlaying(const char*text);
|
||||
void BrowseAndBoot();
|
||||
void SetNextState(CoreState state);
|
||||
void _ViewFullScreen(HWND hWnd);
|
||||
void _ViewNormal(HWND hWnd);
|
||||
}
|
||||
|
||||
+66
-16
@@ -21,6 +21,7 @@
|
||||
#include "file/zip_read.h"
|
||||
|
||||
#include "../Core/Config.h"
|
||||
#include "EmuThread.h"
|
||||
|
||||
#include "LogManager.h"
|
||||
#include "ConsoleListener.h"
|
||||
@@ -50,23 +51,65 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
{
|
||||
Common::EnableCrashingOnCrashes();
|
||||
|
||||
char *token = szCmdLine;
|
||||
char fileToLoad[256] = "";
|
||||
const char *fileToStart = NULL;
|
||||
const char *fileToLog = NULL;
|
||||
bool hideLog = true;
|
||||
bool autoRun = true;
|
||||
|
||||
token = strtok(szCmdLine," ");
|
||||
#ifdef _DEBUG
|
||||
hideLog = false;
|
||||
#endif
|
||||
|
||||
g_Config.Load();
|
||||
VFSRegister("", new DirectoryAssetReader("assets/"));
|
||||
VFSRegister("", new DirectoryAssetReader(""));
|
||||
|
||||
while (token)
|
||||
for (int i = 1; i < __argc; ++i)
|
||||
{
|
||||
if (strcmp(token,"-run"))
|
||||
{
|
||||
//run immediately
|
||||
}
|
||||
if (__argv[i][0] == '\0')
|
||||
continue;
|
||||
|
||||
token = strtok(NULL," ");
|
||||
if (__argv[i][0] == '-')
|
||||
{
|
||||
switch (__argv[i][1])
|
||||
{
|
||||
case 'j':
|
||||
g_Config.iCpuCore = CPU_JIT;
|
||||
break;
|
||||
case 'i':
|
||||
g_Config.iCpuCore = CPU_INTERPRETER;
|
||||
break;
|
||||
case 'f':
|
||||
g_Config.iCpuCore = CPU_FASTINTERPRETER;
|
||||
break;
|
||||
case 'l':
|
||||
hideLog = false;
|
||||
break;
|
||||
case 's':
|
||||
autoRun = false;
|
||||
break;
|
||||
case '-':
|
||||
if (!strcmp(__argv[i], "--log") && i < __argc - 1)
|
||||
fileToLog = __argv[++i];
|
||||
if (!strncmp(__argv[i], "--log=", strlen("--log=")) && strlen(__argv[i]) > strlen("--log="))
|
||||
fileToLog = __argv[i] + strlen("--log=");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (fileToStart == NULL)
|
||||
{
|
||||
fileToStart = __argv[i];
|
||||
if (!File::Exists(fileToStart))
|
||||
{
|
||||
fprintf(stderr, "File not found: %s\n", fileToStart);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Can only boot one file");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
//Windows, API init stuff
|
||||
@@ -98,16 +141,23 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
MainWindow::UpdateMenus();
|
||||
|
||||
LogManager::Init();
|
||||
bool hidden = false;
|
||||
#ifndef _DEBUG
|
||||
hidden = true;
|
||||
#endif
|
||||
LogManager::GetInstance()->GetConsoleListener()->Open(hidden, 150, 120, "PPSSPP Debug Console");
|
||||
if (fileToLog != NULL)
|
||||
LogManager::GetInstance()->ChangeFileLog(fileToLog);
|
||||
LogManager::GetInstance()->GetConsoleListener()->Open(hideLog, 150, 120, "PPSSPP Debug Console");
|
||||
LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
|
||||
if (strlen(fileToLoad))
|
||||
if (fileToStart != NULL)
|
||||
{
|
||||
// TODO: load the thing
|
||||
MainWindow::SetPlaying(fileToStart);
|
||||
MainWindow::Update();
|
||||
MainWindow::UpdateMenus();
|
||||
|
||||
EmuThread_Start(fileToStart);
|
||||
}
|
||||
else
|
||||
MainWindow::BrowseAndBoot();
|
||||
|
||||
if (autoRun)
|
||||
MainWindow::SetNextState(CORE_RUNNING);
|
||||
|
||||
//so.. we're at the message pump of the GUI thread
|
||||
MSG msg;
|
||||
|
||||
@@ -185,6 +185,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_directory, co
|
||||
case 'j':
|
||||
g_Config.iCpuCore = CPU_JIT;
|
||||
break;
|
||||
case 'f':
|
||||
g_Config.iCpuCore = CPU_FASTINTERPRETER;
|
||||
break;
|
||||
case 'i':
|
||||
g_Config.iCpuCore = CPU_INTERPRETER;
|
||||
break;
|
||||
|
||||
@@ -74,8 +74,8 @@ void printUsage(const char *progname, const char *reason)
|
||||
if (reason != NULL)
|
||||
fprintf(stderr, "Error: %s\n\n", reason);
|
||||
fprintf(stderr, "PPSSPP Headless\n");
|
||||
fprintf(stderr, "This is primarily meant for non-inactive test tool.\n\n");
|
||||
fprintf(stderr, "Usage: %s [options] file.elf\n\n", progname);
|
||||
fprintf(stderr, "This is primarily meant as a non-interactive test tool.\n\n");
|
||||
fprintf(stderr, "Usage: %s file.elf [options]\n\n", progname);
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -m, --mount umd.cso mount iso on umd:\n");
|
||||
fprintf(stderr, " -l, --log full log output, not just emulated printfs\n");
|
||||
|
||||
Reference in New Issue
Block a user