Enable a few command line switches on Windows.

This commit is contained in:
Unknown W. Brackets 2012-12-22 09:21:23 -08:00
parent 2861a21658
commit d745bddc23
3 changed files with 65 additions and 14 deletions

View file

@ -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;

View file

@ -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);
}

View file

@ -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,51 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
{
Common::EnableCrashingOnCrashes();
char *token = szCmdLine;
char fileToLoad[256] = "";
token = strtok(szCmdLine," ");
const char *fileToStart = NULL;
bool showLog = false;
bool autoRun = true;
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 (__targv[i][0] == '\0')
continue;
token = strtok(NULL," ");
if (__targv[i][0] == '-')
{
switch (__targv[i][1])
{
case 'j':
g_Config.iCpuCore = CPU_JIT;
break;
case 'i':
g_Config.iCpuCore = CPU_INTERPRETER;
break;
case 'l':
showLog = true;
break;
case 's':
autoRun = false;
break;
}
}
else if (fileToStart == NULL)
{
fileToStart = __targv[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
@ -104,10 +133,21 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
#endif
LogManager::GetInstance()->GetConsoleListener()->Open(hidden, 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 (showLog)
PostMessage(hwndMain, WM_COMMAND, ID_DEBUG_LOG, 0);
if (autoRun)
MainWindow::SetNextState(CORE_RUNNING);
//so.. we're at the message pump of the GUI thread
MSG msg;